It supports to be mysql_fetch_array. while($r=mysql_fetch_array($result))
"Zeus" <[EMAIL PROTECTED]> wrote in message news:000201c28788$00d50e20$0200a8c0@;ncus... > I try to display mysql database using fetch_array but there seem to problem, > i m new with PHP and mysql. > I didn't quite sure, what's worng with my codes.i havent include the form > yet. > > the error messages: > Warning: mysql_fetch_field(): supplied argument is not a valid MySQL result > resource in c:\apache\htdocs\zeus\shoutbox.php on line 17 > > > code in shoutbox.php: > > <?PHP > > mysql_connect('localhost', 'zeus', 'pass') or die ("deadconnect"); > mysql_select_db('zeussama_db') or die ("no db"); > > if($submit) > { > $time=date("h:ia d/j/y"); > $result=mysql_query("INSERT INTO shoutbox (id,name,message,time)","values > ('NULL','$name','$message','$time')"); > } > ?> > > > <?php > $result = mysql_query("SELECT * FROM shoutbox BY ID desc LIMIT 5"); > while($r=mysql_fetch_field($result)) > { > $time=$r["time"]; > $id=$r["id"]; > $message=$r["message"]; > $name=$r["name"]; > > echo "$time <br>"; > echo "$name <br>"; > echo "$message <br>"; > } > ?> > > ================================ > :.zeus:. > http://www.redrival.com/zeussama > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php