bubbles19518
06-13-2007, 03:50 PM
So I'm trying to track keywords from My PPC campaign on yahoo. They add $_GET['OVRAW'] and $_GET['OVKEY'], which are the search term and they keyword your actually bidding on. I'm trying to throw these in a database but get:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/creditca/public_html/cashrewardstest.php on line 14
I've gotten this error before, and have usually been able to fix it but I can't figure out whats wrong now. Heres my code:
if(isset($_GET['OVKEY']))
{
$rawkeyword = $_GET['OVRAW'];
$rawkeyword = urldecode($rawkeyword);
$keyword = $_GET['OVKEY'];
$keyword = urldecode($keyword);
$link = mysql_connect('192.168.2.7','creditca_creditc','cred1tcard');
mysql_select_db("creditca_creditcard", $link) or die("An error occured while trying to establish a connection to the specified database");
$sql = "SELECT * FROM keywords WEHRE keyword = '$keyword'";
$result = mysql_query($sql);
if(mysql_num_rows($result) == 0)
{
$sql = "INSERT INTO keywords (`id` , `keyword` , `raw`, `count`) VALUES ('', '$keyword', '$rawkeyword','0')";
$result2 = mysql_query($sql);
}
$subid = $result['id'];
$sql = "UPDATE keywords SET count = count+1 WHERE id = '$subid' LIMIT 1";
$result3 = mysql_query($sql);
mysql_close($link);
}
Any help is greatly appreciated.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/creditca/public_html/cashrewardstest.php on line 14
I've gotten this error before, and have usually been able to fix it but I can't figure out whats wrong now. Heres my code:
if(isset($_GET['OVKEY']))
{
$rawkeyword = $_GET['OVRAW'];
$rawkeyword = urldecode($rawkeyword);
$keyword = $_GET['OVKEY'];
$keyword = urldecode($keyword);
$link = mysql_connect('192.168.2.7','creditca_creditc','cred1tcard');
mysql_select_db("creditca_creditcard", $link) or die("An error occured while trying to establish a connection to the specified database");
$sql = "SELECT * FROM keywords WEHRE keyword = '$keyword'";
$result = mysql_query($sql);
if(mysql_num_rows($result) == 0)
{
$sql = "INSERT INTO keywords (`id` , `keyword` , `raw`, `count`) VALUES ('', '$keyword', '$rawkeyword','0')";
$result2 = mysql_query($sql);
}
$subid = $result['id'];
$sql = "UPDATE keywords SET count = count+1 WHERE id = '$subid' LIMIT 1";
$result3 = mysql_query($sql);
mysql_close($link);
}
Any help is greatly appreciated.