Hi [snip] <? while($ouput_row = mysql_fetch_array($result)) { ?> [/snip]
Try: while($ouput_row = mysql_fetch_array($result, MYSQL_ASSOC)) [snip] <?=$output_row["projTitle"]?><br /> [/snip] You have missed the ; (semicolon) after ["projTitle"] also Dan -----Original Message----- From: Paul Jinks [mailto:[EMAIL PROTECTED] Sent: 09 December 2005 11:51 To: php-general@lists.php.net Subject: [PHP] PHP/MySql noob falls at first hurdle Hi all I've been asked to put simple database interactivity on an academic site. They want users to enter a few details of their projects so other researchers can search and compare funding etc. How difficult can that be, I thought.... I've built the database in MySQL and entered some dummy data, and I'm now trying in the first place to get the data to display with a simple select query to display the variable "projTitle" from the table "project" thus: <head> <snip> <? $SQLquery = "SELECT projTitle FROM project"; $result = mysql_query($SQLquery) or die ("couldn't execute query"); mysql_close($connect) ?> <body> <p>Result of <b><?=$SQLquery ?></b></p> <p> <? while($ouput_row = mysql_fetch_array($result)) { ?> <?=$output_row["projTitle"]?><br /> <? } ?> </p> </body> When I view the page I get this: <p>Result of <b>SELECT projTitle FROM project</b></p> <p> <br /> <br /> <br /> <br /> </p> There are indeed 4 entries in the database, but I can't figure out why it's not displaying the data. It worked fine on my "PHP/Mysql-in-a-box" course. No, we didn't study the syntax :( Any help gratefully received. Thanks Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __________ NOD32 1.1316 (20051208) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php