On Mon, 11 Feb 2002, [AFQ]T1T4N wrote:

>  dear friends..
> 
>  i'm doing a simple script that use mysql_fetch_array() and it give me the
>  following error.
> 
>  Warning: Supplied argument is not a valid MySQL result resource in
>  /apache/htdocs/html/intranet.domus.cl/base.php on line 10
> 
>  Warning: Supplied argument is not a valid MySQL result resource in
>  /apache/htdocs/html/intranet.domus.cl/base.php on line 16
> 
> 
>  here is the code, there is no problem with the connection to BD, i probe it
>  and it works.. but this problem don't let print nothing in a web page..
> 
>  i'll appreciate your help...
> 

You say there is no problem connecting to the db, but the code you've
supplied doesn't check.  Since $result is "not a valid MySQL result
resource", it appears that the call to mysql_query failed somehow,
probably because mysql_connect or mysql_select_db failed.  I'd suggest
adding code to check:

 <html>
 <body>
 <?
 include("config.inc");
 $db = mysql_connect($servidor, $usuariodb, $password)
       or die("Couldn't connect " . mysql_error());
 mysql_select_db($base,$db) or die("Couldn't select $db: ".mysql_error());
 ?>
 <?
 $result = mysql_query("select nombres,email from usuarios")
           or die ("Couldn't query: " . mysql_error());
 while ($row = mysql_fetch_array($result)) {
     echo "user_id: ".$row["nombres"]."<br>\n";
     echo "user_id: ".$row[0]."<br>\n";
     echo "email: ".$row["email"]."<br>\n";
     echo "fullname: ".$row[1]."<br>\n";
 }
 mysql_free_result($result);
 ?>
 </body>
 </html>

Chances are you'll find the problem.  Unless this turns out to be a MySQL
problem, which I doubt, you'll probably have better luck on the PHP
lists.  See http://www.php.net/mailing-lists.php

Good luck.

Michael


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to