Hey...

Ok Firs Mike.. Yes I have been "fixing" some of her scripts and saw she used
this too..

Unbelievably I also so this point about the string in the string without
concat op's but incredibly it works..



Now back to reason why it don't work..


Okay Jenny..

Hi again :)

Next..

Do you have anything actually IN your table ({$config["prefix"]}_users) ??


If so does the username in it match {$session["uid"]} ??


If it doesn't and mysql_query returns a error cos a) table don't exist or b)
some other sql error such as column name wrong etc..

Then mysql_fetch_array will cough up error..




This happened when I setup your scripts on my box.. And whenever I setup any
scripts in which I don't yet have any records matching the query so
mysql_fetch_array goes nuts..




Ok.. Hope it helped..


:::::::::::::::::::::::::::::::::::::::::::
:  Julien Bonastre [The-Spectrum.org CEO]
:  A.K.A. The_RadiX
:  [EMAIL PROTECTED]
:  ABN: 64 235 749 494
:  QUT Student :: 04475739
:::::::::::::::::::::::::::::::::::::::::::


----- Original Message -----
From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]>
To: "'Jennifer Downey'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, April 24, 2002 10:05 PM
Subject: RE: [PHP] SQL Warning


> > -----Original Message-----
> > From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
> > Sent: 24 April 2002 04:46
> >
> > Would you please direct your attention to this URL
> >
> > http://testphp.netfirms.com/code1.html
> >
> > Look at the bottom where the big orange commented syntax is
> > and explain what
> > is going on there?
>
> ========================================
> $query = "SELECT name FROM {$config["prefix"]}_users WHERE
uid={$session["uid"]}";
>
> $ret = mysql_query($query);
>
>
>
> // this is line 14
> while($row = mysql_fetch_array($ret))
> .
> .
> .
> // this is the problem area. It is giving me this sql warning Warning:
Supplied argument is not a valid MySQL result resource in
/home/public_html/sortitems.php on line 14 look at top for line 14 why is it
>
> // looking at line 14 I am not asking for any of that information?
> ========================================
>
> No idea why the error message is so far down the page, but it is certainly
referring to line 14 -- it is telling you that the $ret you are supplying to
mysql_fetch_array is invalid.  Why?  Because the mysql_query failed, and so
$ret was not assigned valid result resource.  This is why you should ALWAYS
check the return value of a mysql_query call before trying to fetch its
results.
>
> Now, why is the query failing?  Well, let's take a look at this line:
>
>     $query = "SELECT name FROM {$config["prefix"]}_users WHERE
uid={$session["uid"]}";
>
> The stuff to the right of the "=" consists of:
>
>     (1) the string "SELECT name FROM {$config["
>     (2) the constant named prefix (which, I guess, doesn't exist)
>     (3) the string "]}_users WHERE uid={$session["
>     (4) the constant named uid (ditto!)
>     (5) the string "]}"
>
> with NO concatenation operators in between.
>
> This line ought to generate multiple warnings and notices -- you must have
error_reporting set to suppress all these useful messages, so I suggest you
change it to something more useful forthwith (such as E_ALL, or at least
E_ALL ^ E_NOTICE).
>
> So, the final solution to your problem would be either of the following:
>
>     $query = "SELECT name FROM {$config[\"prefix\"]}_users WHERE
uid={$session[\"uid\"]}";
>
>     $query = "SELECT name FROM {$config['prefix']}_users WHERE
uid={$session['uid']}";
>
> Hope this helps.
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to