Re: Weird php problem

by "Rudy Gomez" <rudy(at)cyberangler.com>

 Date:  Thu, 22 Feb 2001 16:20:01 -0500
 To:  "Steve Segarra" <ssegarra(at)mitre.org>
 Cc:  <hwg-techniques(at)hwg.org>
 References:  mitre
  todo: View Thread, Original
First, I'm not a PHP guru...

But, I have 2 ideas:

First, I've been in your same shoes and have gotten this error well into
projects, and it was a head scratcher the first few times.  Most of the time
this error was caused when I used a SELECT statement within a function and
forgot to pass it the connect variable - $dbconn in your case.  So, make
sure you pass $dbconn to any function needing it.

The second thing I notice is that you are using two arguments for your
mysql_fetch_array function.  I know that the this function can use a second
optional "result_type" argument, but I've never used it, and I'm not sure
that $dbconn is a valid argument.  I always used just one argument with this
function - in your case I would use $row = mysql_fetch_array($r);

I hope this helps.

Warmest regards,

Rudy Gomez                   \      ,,,,,,\\,,              ...><`>
rudy(at)cyberangler.com    }><(((((())))�� ...><`>
http://cyberangler.com/    /      `````//''             ...><`>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Steve Segarra <ssegarra(at)mitre.org> wrote:
=================================
> the following code tells me that I am supplying invalid Link resources
> ($dbconn) for every line after the connect statement.
>
> $dbconn = mysql_connect("localhost", "ics","pw") || print "errro
connecting";
> mysql_select_db("inventory", $dbconn) || print "error selecting db";
>
> $r = mysql_query("select * from locations", $dbconn) || print "error
querying";
>
> $row = mysql_fetch_array($r, $dbconn);
>
> echo $row[0]." ".$row[1];
>
>
> any ideas?  I have much more advanced code that was working, then it
> stopped working all of the sudden.

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA