0

I can't seem to get past this error.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /windsor.php on line 47

if ($insertdb == NULL)
  mysql_query("INSERT INTO `asd` (`id`, `1`, `2`,`3`, `4`, `5`, `pubdate`) VALUES (296, maddeal', 'Windsor', 'ON', '', '', '') ON DUPLICATE KEY UPDATE `1`=VALUES(`1`),`2`=VALUES(`2`),`3`=VALUES(`3`),`4`=VALUES(`4`),`5`=VALUES(`5`)") or die(mysql_error());
 else
//Check and see if value has changed...

$checksql = mysql_query("SELECT `1` FROM deal WHERE `id`= 296") or die(mysql_error());
while($row = mysql_fetch_array($checksql))
  {
  $checksqlver = $row['deal'];
  }

$checksqlver = mysql_real_escape_string($checksqlver);
//$checksqlver = stripslashes($checksqlver);
echo "$checksqlver<br>";

if ($checksqlver == $insertdb)
  exit();
 else
  echo "No Match<br>";

//percent

2 Answers 2

1

Did you connect to the database using mysql_connect?

That would cause the error you are describing.

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, I have that specified at the top, just didn't post. Other scripts work, just this one is giving me grief...
You also have an else statement there where you don't have any code until the $checksql = ... try removing that else.
replaced else //Check and see if value has changed... with else echo "Moving On"; Not that best fix, but it works.
Excellent. PHP could really stand to make their errors a little more specific as to what the problem actually is... In your case it is because you passed a null value to mysql_fetch_array because $checksql was declared in a different scope.
0

In your select query should 1 have apostrophes around it?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.