Hi,
I have the following code that connects to a database and updates an item in a record -
require_once('Connections/CLIENT_DATABASE.php');
$QUERY = "UPDATE website_info SET Pass ='".$_POST['Password']."' WHERE WebID ='".$_POST['ID']."'";
$INFO = QUERY_DATA($QUERY,$database_CLIENT_DATABASE,$CLIENT_DATABASE); // function in CLIENT_DATABASE file
$updated = mysql_affected_rows($INFO);
$results = mysql_fetch_row($INFO);
header('Location: acc_info.php');
exit;
on executing this script i get
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource
Now what i can't get is that although i get these errors the record is updated never the less.
even did it through mysql client and i got an error free output.
Now im thinking maybe its because of the way i have it required from a function. But i have this coding in another script which does it with out error. probably only difference is it SELECTS
Now my question is if its updating the record y am i getting the error
supplied argument is not a valid MySQL-Link resource
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
supplied argument is not a valid MySQL-Link resource
AAAH,
i think i figured out my answer
in my notes i see that in a UPDATE or INSERT the mysql_fetch... isn't being used to get results. YOU CAN'T after an update statement there no results to get and instead you use rows_affected as something to use for results
YES
i think thats it, does anyone care to differ?
i think i figured out my answer
in my notes i see that in a UPDATE or INSERT the mysql_fetch... isn't being used to get results. YOU CAN'T after an update statement there no results to get and instead you use rows_affected as something to use for results
YES
i think thats it, does anyone care to differ?
No $result
mysql_query() does not return a $result when the query is a 'UPDATE', 'INSERT', or 'DELETE';
As such, you can even freely code it as
mysql_query($query);
- instead of -
$result = mysql_query($query);
As such, you can even freely code it as
mysql_query($query);
- instead of -
$result = mysql_query($query);