Re: mysql_fetch_array problem
| From: | Seung Hwan Kang | Date: | Sat, 09 Nov 2002 06:54:26 +0000 |
| Subject: | Re: mysql_fetch_array problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16828@lists.php.net to get a copy of this message | ||
It supports to be mysql_fetch_array.
while($r=mysql_fetch_array($result))
"Zeus" <zeus_dreamer@myrealbox.com> 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
>