PHP script works on browser but not wget
I have bash -sctipt running 5 php scripts via wget. Every php file gets called, but in the last script I get this warning:
mysql_query (): The supplied argument is an invalid MySQL-Link resource in xyz.php, on line ABC
What's really weird is if I run the same script through the browser, the script runs fine, without any warnings.
This is my code next to ABC:
$sqlSTR="INSERT INTO accounts_cstm (id_c, mtk_categoriascompradas_c) VALUES ('". $arr[1] . "', '" . $arr[0] . "')
ON DUPLICATE KEY UPDATE mtk_categoriascompradas_c= concat(mtk_categoriascompradas_c, '^,^$arr[0]')";
$ExecuteSQL = mysql_query ($sqlSTR, $DBConn) or
die ($sqlSTR); //warning on this line - line ABC
My SQL is completely valid (if I run the query that outputs in the die statement it works fine), DBConn is connected to the database, and all other scripts work fine except that.
I really don't know what is causing this warning. Any help would be greatly appreciated.
thanks
0
a source to share
4 answers
Something definitely looks wrong with your last reference to $ arr [0] in the request - I think it should be this:
$sqlSTR="INSERT INTO accounts_cstm (id_c, mtk_categoriascompradas_c) VALUES ('". $arr[1] . "', '" . $arr[0] . "')
ON DUPLICATE KEY UPDATE mtk_categoriascompradas_c= concat(mtk_categoriascompradas_c, '^,^".$arr[0]."')";
0
a source to share