aquatradehub Posted July 4, 2013 Share Posted July 4, 2013 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 Link to comment https://forums.phpfreaks.com/topic/279879-displaying-mysql-results-not-working/ Share on other sites More sharing options...
mac_gyver Posted July 4, 2013 Share Posted July 4, 2013 you already posted this question on this forum, about three minutes ago Link to comment https://forums.phpfreaks.com/topic/279879-displaying-mysql-results-not-working/#findComment-1439478 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 Link to comment https://forums.phpfreaks.com/topic/279879-displaying-mysql-results-not-working/#findComment-1439479 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()); Link to comment https://forums.phpfreaks.com/topic/279879-displaying-mysql-results-not-working/#findComment-1440232 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. Link to comment https://forums.phpfreaks.com/topic/279879-displaying-mysql-results-not-working/#findComment-1440273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.