owen.aaron Posted June 11, 2007 Share Posted June 11, 2007 Im not sure if this is a php or mysql issue honestly. Im trying to set up a basic call from a MySQL DB. I have added the lines, if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; In the connect string so I can see the bd is connected but no data is displayed. The output of this code can be found here http://kerseyre.com/waterfront.php, if anyone can help me find the error of my ways it would be greatly appreciated =) <?php include('dbconnect.php'); $query=mysql_query("SELECT * FROM Property ORDER by price"); while($fetch=@mysql_fetch_array($query)) { $waterfront.=" <td width='200' bgcolor='8BA446'>$fetch[address]</td><td width='75' bgcolor='8BA446'>$fetch[acreage]</td><td width='100' bgcolor='8BA446'><p>$</p>$fetch[price]</td><td width='125' bgcolor='8BA446'>Pictures</td>"; } print " </html> <head></head> <body bgcolor='FEF1B5'> <center> <table border='1' cellpadding='0' cellspacing='1' bordercolor='4F4F2F'> <tr> <td colspan='4' bgcolor='458B00'><center><div style='font-size:20;font-weight: bold;' >County</div></center></td> </tr> <tr> <td width='200' bgcolor='8BA446'>Address</td> <td width='75' bgcolor='8BA446'>Acreage</td> <td width='100' bgcolor='8BA446'>Price</td> <td width='125' bgcolor='8BA446'>Pictures</td> </tr> <tr> $waterfront </tr> </table> </center> </body> </html>"; ?> Link to comment https://forums.phpfreaks.com/topic/55167-solved-issue-with-a-simple-select-statement/ Share on other sites More sharing options...
owen.aaron Posted June 11, 2007 Author Share Posted June 11, 2007 Thought i would add the DB info, version 5.0.24a table setup... Field Type Null Default address text No type text No lot_number smallint(6) No acreage smallint(6) No picture1 text No id tinyint(4) No price mediumint(10) No 0 Indexes: Keyname Type Cardinality Field PRIMARY PRIMARY 2 id Link to comment https://forums.phpfreaks.com/topic/55167-solved-issue-with-a-simple-select-statement/#findComment-272710 Share on other sites More sharing options...
Wildbug Posted June 11, 2007 Share Posted June 11, 2007 When creating an app, always check for errors after a query. $query=mysql_query("SELECT * FROM Property ORDER by price"); if (mysql_errno()) echo "Error: " . mysql_error(); See if that produces any output. Also, is there any data in your table? Link to comment https://forums.phpfreaks.com/topic/55167-solved-issue-with-a-simple-select-statement/#findComment-272720 Share on other sites More sharing options...
owen.aaron Posted June 11, 2007 Author Share Posted June 11, 2007 ahh Error: No database selected yeah that helps. Now its displaying fine... well somewhat. I just have some coding to rearrange. thanks for the help amigo! Link to comment https://forums.phpfreaks.com/topic/55167-solved-issue-with-a-simple-select-statement/#findComment-272738 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.