chessmonster Posted December 3, 2009 Share Posted December 3, 2009 her is my code.. the problem is i cant let the contents of the database appear on the screen. i assume that i am wrong with inserting the objects or how i retrieved the recordset's contents are wrong. but still, i can't get the answer. <?php $conn = mysql_connect("localhost","root","") or die(mysql_error()); //mysql_query("CREATE DATABASE lana",$conn) or die(mysql_error()); mysql_select_db("lana",$conn) or die(mysql_error()); $ctq = "CREATE TABLE itd ( name varchar(100), address varchar(100), standing varchar(100), mukha varchar(100) )"; //if (!mysql_query($ctq,$conn)) echo "buracha " . mysql_error(); //mysql_query("INSERT INTO (name,address,standing,mukha) itd VALUES ('simon','cavite','balik','gwapo')"); //mysql_query("INSERT INTO (name,address,standing,mukha) itd VALUES ('darwin','pque','balik','hindi')"); //mysql_query("INSERT INTO (name,address,standing,mukha) itd VALUES ('jayson','mindanao','balik','negative')"); //mysql_query("INSERT INTO (name,address,standing,mukha) itd VALUES ('dizo','visayas','balik2x','ungas')"); //echo "insert successful"; $result = mysql_query("SELECT * FROM itd"); while($row = mysql_fetch_array($result)) { echo $row['name'] . " " . $row['address']; echo "<br />"; echo "acheche!"; } mysql_close($conn); ?> tnx in advance Quote Link to comment Share on other sites More sharing options...
cags Posted December 3, 2009 Share Posted December 3, 2009 $result = mysql_query("SELECT * FROM itd"); while($row = mysql_fetch_array($result)){ echo $row['name'] . " " . $row['address']; echo "<br />"; echo "acheche!"; } Looks correct for what it appears your database looks like. Have you tried using PHPMyAdmin to check the database is actually there and to see what's in it? Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 3, 2009 Share Posted December 3, 2009 just check using this one mysql_num_rows($result); and see how many rows are coming using ur select query.. Quote Link to comment Share on other sites More sharing options...
cags Posted December 3, 2009 Share Posted December 3, 2009 just check using this one mysql_num_rows($result); and see how many rows are coming using ur select query.. There obviously aren't any, since the syntax for output is correct given the information provided. 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.