Jump to content

[SOLVED] MySQL Code help


antonio12

Recommended Posts

Can someone please tell me what I am doing wrong here:

 

I have a piece of MySQL code:

// Get values from database for defaults

function sajax_update($id, $value)

{

  $id = mysql_escape_string($id);

  $value = mysql_escape_string($value);

  mysql_query("UPDATE `speed` SET `speed` = '$value' WHERE `id` = '$id';");

  return 'true';

}

sajax_export("sajax_update");

sajax_handle_client_request();

 

// Get values from database for defaults

$result = mysql_query("SELECT * FROM speed");

$defaults = array();

while($rw = mysql_fetch_array($result)) {

  $defaults[$rw['id']] = $rw['speed'];

}

 

I get the following error for the code above:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in index.php on line 33

 

I have noted line 33 in red above.

 

Can someone please help me understand what this means and how I can resolve it?

 

Thank you for your help.

 

Antonio

Link to comment
https://forums.phpfreaks.com/topic/134065-solved-mysql-code-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.