Jump to content

Ulterior

Members
  • Posts

    30
  • Joined

  • Last visited

Previous Fields

  • Languages
    English....

Profile Information

  • Interests
    Half decent understanding of HTML + CSS, trying to get to grips with Javascript/jquery and PHP. Also into Graphics and video design.

Ulterior's Achievements

Newbie

Newbie (1/7)

1

Reputation

  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.
×
×
  • Create New...