Jump to content

Ulterior

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by Ulterior

  1. Ah I thought about that briefly lol. So something like this below, is perfectly fine? Or is there a more efficient way of doing it? <?phprequire_once 'login.php';$db_server = mysql_connect($db_hostname, $db_username, $db_password) or die("could not connect" . mysql_error());mysql_select_db($db_database, $db_server) or die("Couldn't select DB" . mysql_error());if (isset($_POST['City']) && isset($_POST['delete'])) { $cit = get_post('City'); if (isset($_POST['delete']) && $cit != ""){ $query = "DELETE FROM test WHERE city='$cit'"; if(!mysql_query($query, $db_server)) echo "Delete failed: $query <br /> " . mysql_error() . " <br />";}}if (isset($_POST['Continent']) &&isset($_POST['Country']) &&isset($_POST['City'])){ $cont = get_post('Continent'); $count = get_post('Country'); $cit = get_post('City'); if (isset($_POST['add'])){$query = "INSERT INTO test VALUES" ."('$cont','$count','$cit')"; if(!mysql_query($query, $db_server)) echo "Add failed: $query <br /> " . mysql_error() . " <br />"; }}
  2. Trying to write some code to add functions to database, just as a learning tool really. I got the add record to work but I can't delete a record from the page. The error message doesn't show for it either. <?phprequire_once 'login.php';$db_server = mysql_connect($db_hostname, $db_username, $db_password) or die("could not connect" . mysql_error());mysql_select_db($db_database, $db_server) or die("Couldn't select DB" . mysql_error());if (isset($_POST['Continent']) &&isset($_POST['Country']) &&isset($_POST['City'])){ $cont = get_post('Continent'); $count = get_post('Country'); $cit = get_post('City'); if (isset($_POST['delete']) && $cit != ""){ $query = "DELETE FROM test WHERE city='$cit'"; if(!mysql_query($query, $db_server)) echo "Delete failed: $query <br /> " . mysql_error() . " <br />";}elseif (isset($_POST['add'])){$query = "INSERT INTO test VALUES" ."('$cont','$count','$cit')"; if(!mysql_query($query, $db_server)) echo "Add failed: $query <br /> " . mysql_error() . " <br />"; }}echo <<<_END<form action='test.php' method='post' ><pre>Continent <input type='text' name='Continent' />Country <input type='text' name='Country' />City <input type='text' name='City' /><input type='hidden' name='add' value='yes' /><input type='submit' value='ADD RECORD' /></pre></form>_END; $query = "SELECT * FROM $db_database";$result = mysql_query($query); if (!$result) die("Database access failed" . mysql_error());$rows = mysql_num_rows($result);for ($p = 0 ; $p < $rows ; ++$p){$row = mysql_fetch_row($result); echo <<<_END<pre>Continent $row[0]Country $row[1]City $row[2]</pre><form action='test.php' method='post' /><input type='hidden' name='delete' value='yes' /><input type="hidden" name="City" value="$row[2]" /><input type ='submit' value='DELETE RECORD' /></form>_END;}mysql_close($db_server);function get_post($var){return mysql_real_escape_string($_POST[$var]);}?>
  3. Ulterior

    MP4 Videos

    I've searched and tried out many different variations of code attempting to put up an MP4 video file onto my webpage, but I can't seem to manage it for compatability with different browsers, among other issues. What's a good way of doing it, javascript? I want to make it as good quality as possible, compatible with most if not all browsers, autoplay and have the option of removing the controls. Also is it possible to resize a video by aspect ratio on the webpage, I mean would that result in better quality rather than rendering the video out and cutting it to that size?
  4. Ulterior

    Hyperlink text

    Yeah I thought about that, tried deleting stuff etc, but couldn't find it. It's a bit of mess in there lol, gonna try and clean it up a bit. That's very useful the !important thing thanks.
  5. Ulterior

    Hyperlink text

    Ok just tried that, the Telephone Systems text is till blue though.
  6. Ulterior

    Hyperlink text

    Tried tons of different bits of code to attempt to change the color for this hyperlinked text but can't get it right. <a href="PHONESYS.php" class="lab"><span class="top-label"> <span class="label-txt">Telephone Systems</span> </span></a> a:top-label li {color:white;} ...For example, am I close?
  7. Ulterior

    Session variables

    I am trying to carry a a database name in the form of a variable from one page to the next but can't get it to work. Tried a few different ways etc. But I'm not good with php. session_name("DATA");session_start();$db = 'mobiles'; $_SESSION['dbs'] = $db; $result = mysql_query("SELECT * FROM mobiles WHERE mobiles='".$db."'"); so the database on the products page is mobiles and I want to set that as a session variable so that another page can recieve that and use it to also query the same database. session_name("DATA");session_start(); $vas = $_SESSION['dbs']; $row=mysql_fetch_assoc(mysql_query("SELECT * FROM '$vas' WHERE img='".$img."'")); That isn't the exact layout of the code by the way, the bottom lines on both are further down, for example the first query, $result is inside a div, Hope this makes sense to whoever can help.
  8. Ok cool, thanks for that bit of code. I'm gonna try to learn some php, what's the best way in your opinion to learn php? One other thing, I have a shopping cart which you can drag products into, I want to try to turn that into an enquiry form so that when the email is sent the products go with it. Right now it's just a shopping cart with a checkout that goes to a separate page, this is 'Tutorialzines demo' btw don't know if you heard of it. So yeah, is that still too ambitious for me? ;p
  9. Ok so would you be able to get that single file to load a different database depending on which button was clicked? Thanks for the link I'll check it out, as I think I still don't fully understand this.
  10. But technically that'd be the same as just copying out product.php for instance, however many times to create a bunch of new pages and just switching out the database loaded from with another? Or am I misunderstanding you? I don't want to have 60 different pages for different products really, want a decent way it can be displayed on a few or one page if needs be.
  11. Not sure I understand. So I could have a button('s) next to the products content div, and on click just have them reload the page with different mysql databases?
  12. Oh ok, so It's probably not worth looking to do it that way until i get decent with Ajax, PHP and Javascript. Is there another way I can get many products displaying on one page that's a little easier?
  13. Ok I have a products page which querys using php to a mysql database and echo's the results to a page. I want to be able to have seperate products lists, so that I can click a button on the side and have it delete/hide what was already echo'ed there and fetch the new rows, Either a button or a drop down list. But I don't know much of PHP at all, and don't know if there's a way to hide or delete an result from mysql using php. Or to create a certain 'function'? in php that can be toggled in javascript? Anyways enough of me attempting to explain it I'll just post the code up: <?php $result = mysql_query("SELECT * FROM internet_shop");while($row=mysql_fetch_assoc($result)){echo '<div class="product"><img src="img/products/'.$row['img'].'" alt="'.htmlspecialchars($row['name']).'" width="128" height="128" class="pngfix" /></div>';} ?> Any other code you need to see I'd be happy to paste up here.
  14. How would I go about modding the iframe? Ok some html code: <!--FOOTER STARTS--> <div id="footer"> <p>Copyright © ***********</p><a href="#">Terms Of Use</a> <a href="https://twitter.com/#!/********" class="twit" target="_blank"> <img src="http://www.niftybuttons.com/classic/twitter.png"></a> </div> <!--FOOTER ENDS--> I've just put both divs of text to float left and the logo, the only division that floats left however is the 1st one the rest sit in the middle of the page why is this? Both divisions are styled as this: .box7{ float: left; /*floats left*/padding-top: 10px;padding-left: 0px; text-align: justify;font-size: 14px;color: #2c2c2c; /* margin-bottom: 15px; /*adds a bottom margin*/} Also here I am trying to get a title and text below it floated left below another division with title and text above but it just won't have it. <div class="box7"><!--BOX STARTS--><h2 class="boxtitle6"><b>E-mail</b></h2><p><a href="mailto:paul@ryanventura.com?subject=feedback">paul@ryanventura.com</a><p/><p><a href="mailto:sales@ryanventura.com?subject=feedback">sales@ryanventura.com</a><p/><p><a href="mailto:tash@ryanventura.com?subject=feedback">accounts@ryanventura.com</a><p/></div><!--BOX ENDS--><a href="http://twitter.com/ryanventuraltd"><img src="http://www.twitterbuttons.com/upload/images/6a2fe834b0twitter-wb-fm.png" class="follow" title="Twitter" width="259" height="88" /></a><iframe width="425" height="350" class="maps" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=uckfield+TN22+1QG&aq=&sll=50.987259,-0.00368&sspn=0.151067,0.41851&ie=UTF8&hq=&hnear=Uckfield+TN22+1QG,+United+Kingdom&t=m&z=14&ll=50.966023,0.08223&output=embed"></iframe><br /><small><a href="https://maps.google.co.uk/maps?f=q&source=embed&hl=en&geocode=&q=uckfield+TN22+1QG&aq=&sll=50.987259,-0.00368&sspn=0.151067,0.41851&ie=UTF8&hq=&hnear=Uckfield+TN22+1QG,+United+Kingdom&t=m&z=14&ll=50.966023,0.08223" style="color:#0000FF;text-align:left">View Larger Map</a></small> </div> .box7{ float: left; /*floats left*/padding-top: 10px;padding-left: 0px; text-align: justify;font-size: 14px;color: #2c2c2c; /* margin-bottom: 15px; /*adds a bottom margin*/}.boxtitle6 { color: #2c2c2c; /*text color*/ text-transform: uppercase; /*transforms text to uppercase*/ font-weight: normal; /*sets font weight*/font-size: 16px; text-align: center;
  15. Ah thanks for the heads up on the float issue. What I'm trying to get my content + footer area like is this: ....Title..............................########texttexttexttext...................[............]........................................[.............]....Title..............................[............]textxtxtxtxtxtxtx....................####### Logo (twitter logo + link)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~footer.......T.................text..........................text Like that if you can understand ;p.The box above is google maps. I'm having the most trouble with the google maps and 'T' logo, the google maps will either make my page 30% wider or position way down below the content area and drag other things with it. And the T logo will position differently in other computers if I use absolute positioning, and if I use relative pos, it will drag the center aligned footer text across a little bit. But I think maybe the problems with the divisions, as I've looked at in Visual Studio, and the boxes are taking up half the page and aren't sitting where I want them. Hope you can understand what I mean from the detailed illustration above lol. Yeah I'm not sure why that's there really lol. Thanks though.
  16. <div id="content"><div class="box6"><!--BOX STARTS--><h2 class="boxtitle5"><b>*****</b></h2><p>****</p><p>******</p><p>*****</p><p style="margin-bottom: 1em;">**************</p> <p></p></div><!--BOX ENDS--> Yeah kinda I guess. I just place all my content like this above right now and the CSS for example: .box8{ float: top-right; /*floats left*/ width: 333px; /*adds a fixed width*/ padding-top: 50px;text-align: justify; font-size: 12px;color: #2c2c2c /* margin-bottom: 15px; /*adds a bottom margin*/} And yes I do know that this is for box 8 and above I used box6 ;p, this is just an example.
  17. I am trying to get some text and images placed in a certain way on my page, I've put the text into boxes and floated them left and bottom left, but I cant get the images to float right, unless I use absolute positioning, which seems to place it differently on other computers which isn't what I want. How should I go about putting content on my pages, I mean for instance in Visual studio, the boxes I placed don't seem to go under one another, rather they place right next to it, It's all just a mess. The google maps I have put on the page seems to always place itself outside of my division which I don't understand at all, same with the logo. I'm starting to wonder whether I should just stop using boxes to place my content. I've read about how your elements need to be within the 'flow' of the page and stuff, and not to use absolute positioning, but I've found float right: seems to just mean sit below the rest of the content and drag everything else on page around it. Is there a better way of doing this?
  18. No need man, I fixed the problem already. Unless you mean you want to just see it in general, I would say though, that there's nothing groundbreaking in there lol.
  19. So the problem is using margin to bump up and I should just use top? I still don't quite understand why it does that, but thanks you fixed the problem .
  20. Sorry to keep on posting for help, just having alot of issues getting this to work, everything's fine except when I add this code line : .E:hover { opacity: 0.8;margin-top: 6px;-moz-box-shadow: 1px 1px 5px #999;-webkit-box-shadow: 1px 1px 5px #999; box-shadow: 1px 1px 5px #999;} I have 9 images now like this 1 2 3 4 5 6 7 8 9 Now when hovered on with the margin top part in, as a bump effect most of them work fine except when I hover on 3 and 6, for instance if I hovered on 3 it would make 6 and 9 bump up with it and make 4,5,7 and 8 push right down to my footer, moving anything that was there before. No. 6 does this too, to the images below it,
  21. Feel free to delete these 2 posts, sorry.
  22. Haven't managed to get that working either, it seems to be to do with the z index set at -1, which is there so that the image doesn't show over the top of the navigation drop down menu, how can I get around it?
  23. Can't seem to get this image to position with a hyperlink, every time I position either relative, absolute or fixed, it positions right but then removes the link. <a href="#"><img src="images/template.png" class="img3" alt="our img" style="border: 1px solid #000101; position: relative; top: 0px; right: -192px; WIDTH:205px; HEIGHT:154px" > </a> .img3 {margin-top: 10px;z-index:-1;} Overall I'm trying to position 9 images equally spaced on the page, 3 then 3 then 3. Is there a better way of doing this?
  24. Ah right, thought It'd be more complicated. Thanks.
×
×
  • Create New...