Re: weird MySQL resource error
| From: | Rasmus Lerdorf | Date: | Sat, 28 Dec 2002 20:53:49 +0000 |
| Subject: | Re: weird MySQL resource error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129530@lists.php.net to get a copy of this message | ||
Because you are wiping out your $sponsor variable in that commented-out
code.
On Sat, 28 Dec 2002, James Brennan wrote:
> I am getting a "Warning: mysql_fetch_row(): supplied argument is not a valid
> MySQL result resource" error only when the commented-out code bellow
> (starting from $id = bb_sponsor...) is added. If I omit the code the
> resource is recognized as valid. Can anyone explain?
>
> Thanks,
> loop
>
> P.S. - I know my conditions for comparing values are far from accurate, but
> they work for this particular purpose.
>
> /* variables for sponsor table insert */
> $insert = '';
> $insert_pre = "INSERT INTO
bb_sponsor (
> id , name ,
> url ) VALUES
> (";
> $insert_post = ");\n";
>
> /* if inputed sponsor name exists, define it's index and url value.*/
> while ($row = mysql_fetch_row($sponsor)) {
> foreach ($bb_sponsor as $key=>$value) {
> if (levenshtein($bb_sponsor[$key]['name'], $row[1]) <=3 or
> stristr(($bb_sponsor[$key]['name']), $row[1])) {
> $bb_sponsor[$key]['id'] = $row[0];
> $bb_sponsor[$key]['url'] = $row[2];
> }
> /*
> $id = $bb_sponsor[$key]['id'];
> $name = $bb_sponsor[$key]['name'];
> $sponsor = $bb_sponsor[$key]['url'];
> $insert = $insert . $insert_pre . "'', '$name',
> '$sponsor'" .
> $insert_post; */
> }
> }
>
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.
>
> http://join.msn.com/?page=features/featuredemail&xAPID=42&PS=47575&PI=7324&DI=7474&SU=
>
> http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_addphotos_3mf
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>