-
December 14th, 2006, 03:38 PM
#1
Senior Member
Can't find an error in the code
function update_error_reasons ($hostid, $hostname, $error_reason)
{
$db_server = '';
$db_user = '';
$db_pwd = '';
$db_name = '';
$db_link = @mysql_connect($db_server, $db_user, $db_pwd);
$database = @mysql_select_db($db_name, $db_link);
$update_error_reasons = mysql_query ("
update server_error_reasons set error_reasons = $error_reason
where
hostid = $hostid
and
hostname = $hostname;");
}
Hi guys I don't seem to be able to find an error in this function, yet it doesn't update the table
Any ideas?
Don\'t post if you\'ve got nothing constructive to say. Flooding is annoying
-
December 14th, 2006, 03:45 PM
#2
here ???
hostname = $hostname;");
2 semi colons??
MLF
How people treat you is their karma- how you react is yours-Wayne Dyer
-
December 14th, 2006, 04:14 PM
#3
Senior Member
The first semicolon is a part of a SQL statement
"update server_error_reasons set error_reasons = $error_reason
where
hostid = $hostid
and
hostname = $hostname;"
The problem is that this function is supposed to update a table but it doesn't
Don\'t post if you\'ve got nothing constructive to say. Flooding is annoying
-
December 14th, 2006, 04:23 PM
#4
Usually I can figure out where to look by the error it spits out when I run the script...
Could be a misspelled username\passowrd\server\db....could be a permissions error...could be a link problem...
do any other updates work??
Personally I dont use MYSQL....
MLF
How people treat you is their karma- how you react is yours-Wayne Dyer
-
December 14th, 2006, 04:40 PM
#5
Does it need a "commit;" ?
Steve
IT, e-commerce, Retail, Programme & Project Management, EPoS, Supply Chain and Logistic Services. Yorkshire. http://www.bigi.uk.com
-
December 14th, 2006, 04:43 PM
#6
Oooooo could this be it (I'm not familiar with the prog language but this rang a bell:
$update_error_reasons = mysql_query ("
update server_error_reasons set error_reasons = '" || $error_reason ||
'" where
hostid = '" || $hostid ||
"' and
hostname = '" || $hostname || "';");
Where || is the concatenate operator. Note the singe quote ' next to the double quotes " to ensure your SQL read correctly
IT, e-commerce, Retail, Programme & Project Management, EPoS, Supply Chain and Logistic Services. Yorkshire. http://www.bigi.uk.com
-
December 14th, 2006, 04:52 PM
#7
I seem to recall from years ago that the hostname had to be mysqlhost for some reason or other?
-
December 14th, 2006, 05:07 PM
#8
Senior Member
Seems there was another error in another part of the system. Took me half an hour to explain it to my boss as well
Wouldn't have noticed it if it wan't for him though
Don\'t post if you\'ve got nothing constructive to say. Flooding is annoying
-
December 14th, 2006, 05:09 PM
#9
Senior Member
Originally Posted by nihil
I seem to recall from years ago that the hostname had to be mysqlhost for some reason or other?
It's different hosts And theres only a couple of thousands of them
Don\'t post if you\'ve got nothing constructive to say. Flooding is annoying
-
December 14th, 2006, 05:22 PM
#10
One thing I can think of.. Perhaps there's no entry with that particular $hostid and $hostname. Then there would be nothing to update because the where clause fails.
Oliver's Law:
Experience is something you don't get until just after you need it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|