aquatradehub Posted July 4, 2013 Share Posted July 4, 2013 (edited) Hi, I got a page with labels for aquatic species. Next to the labels I want to display the results from the db table for that row, but I cant get it to work. Here is what I got <?php $commonName = 'African Butter Catfish'; $connect_error = 'Sorry, we are currently experiencing database issues. We are working to resolve this and should be up and running again shortly.'; mysql_connect('localhost', 'username', 'password') or die($connect_error); mysql_select_db('equatics_tropics') or die($connect_error); mysql_query("SELECT * FROM species WHERE commonName='$commonName'") or die(mysql_error()); ?> <section id="content"> <article id="index"> <section class="index"> <fieldset title="e-quatics.com"> <legend>PHP CODE TO SHOW COMMON NAME</legend> <p><img src="../_images/tropical.png" height="250" width="250"> Common Name: <? echo $rows['speciesCommon']; ?><br> Scientific Name: <? echo $rows['speciesScientific']; ?> <br> Synonym: <? echo $rows['speciesSynonym']; ?><br> Origin: <? echo $rows['origin']; ?><br> Size: <? echo $rows['size']; ?><br> Environment: <? echo $rows['environment']; ?><br> Water Chemistry: <? echo $rows['waterChemistry']; ?><br> Temperature: <? echo $rows['temperature']; ?><br> Feeding: <? echo $rows['feeding']; ?><br> Sexing: <? echo $rows['sexing']; ?><br> Compatability: <? echo $rows['compatability']; ?><br> Temperament: <? echo $rows['temperament']; ?><br> Sexing: <? echo $rows['sexing']; ?><br> Breeding: <? echo $rows['breeding']; ?><br> Comments: <? echo $rows['comments']; ?></p> </fieldset> </form> </section> </article> <?php include 'includes/overall/footer.php'; ?> </body> Thanks Edited July 15, 2013 by fenway code tags Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted July 4, 2013 Share Posted July 4, 2013 (edited) you already posted this question on this forum, about three minutes ago Edited July 4, 2013 by mac_gyver Quote Link to comment Share on other sites More sharing options...
aquatradehub Posted July 4, 2013 Author Share Posted July 4, 2013 sorry, it came up with a message saying it hadnt been posted and to wait and try posting again lol Quote Link to comment Share on other sites More sharing options...
dodgeitorelse3 Posted July 10, 2013 Share Posted July 10, 2013 try mysql_query("SELECT * FROM species WHERE commonName='".$commonName."'") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
web_craftsman Posted July 11, 2013 Share Posted July 11, 2013 $res = mysql_query('your query...'); while ($row = mysql_fetch_assoc($res)) { ?> <fieldset title="e-quatics.com"> <legend>PHP CODE TO SHOW COMMON NAME</legend> <p><img src="../_images/tropical.png" height="250" width="250"> Common Name: <? echo $row['speciesCommon']; ?><br> ... <?php } p.s. Do you know that mysql driver is deprecated by now? It is advisible to use mysqli or Pdo instead. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.