Well, PHP seems to think that $link is not working, so your db_connect() is
in fact, the problem. You say you use db_connect several times in this
script without problem - why do you keep connecting to the same database
repeatedly in the same script - one connection will do for all your queries.
HTH,
Julian
on 3/10/01 12:11 PM, John Vanderbeck at [EMAIL PROTECTED] wrote:
>
>
> Ok,
>
> Well I got 3 replies saying that my use of && is incorrect, and that I
> should use AND. This confused me for 2 reasons. First, is that I use && in
> all my other SELECT queries, with no problems. In fact, the MySQL docs,
> show the use of &&, not AND. Secondly, because if I had a bad query, it
> should have given me some sort of error when I output mysql_error(). No?
>
> However, I did of course try changing it to AND instead of &&. But the
> problem remains. Same error.
> Any other ideas?
>
> - John Vanderbeck
> - Admin, GameDesign
>
>> -----Original Message-----
>> From: Rick St Jean [mailto:[EMAIL PROTECTED]]
>> Sent: Saturday, March 10, 2001 2:09 PM
>> To: PHP User Group
>> Subject: Re: [PHP] MySQL problem - stumped
>>
>>
>> At 01:58 PM 3/10/01 -0500, John Vanderbeck wrote:
>>
>>
>> You are using && in your statement ... should be "AND"
>>
>> .
>>
>>
>>> The following code is giving an me problems, I can't figure it
>> out to save
>>> my soul. The last line gives:
>>>
>>> Here is the code:
>>>
>>> $link = db_connect();
>>> $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
>>> WHERE username='$user' && password='$password'";
>>> $result = mysql_query($query, $link);
>>> $err = mysql_error();
>>> echo "Errors:".$err;
>>> $rows = mysql_affected_rows($result);
>>>
>>> And here is the output:
>>> Errors:
>>> Warning: Supplied argument is not a valid MySQL-Link resource in
>>> /****/*****/****/**********.********.***/db.php on line 147
>>>
>>> Line 147, is the last line in the above snippet. I cleared out the path
>>> name for security, no offense intended :)
>>>
>>> Now, I KNOW that the db_connect() function is not the problem,
>> as I use it
>>> in many other places in this script with no errors. What am I missing?
>>>
>>> - John Vanderbeck
>>> - Admin, GameDesign
>>>
>>>
--
Julian Wood
Learning Technologies and Digital Media
University of Calgary
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]