Jump to content

[SOLVED] Error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL...


ryeman98

Recommended Posts

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/4617/domains/somesite.com/html/admin/customisation/index.php on line 515

 

Lines 512-531:

// BACKGROUND=EDIT
$id = $_POST['id'];
$getback = ("SELECT id FROM CustomisationBackgrounds WHERE id='$id'");
$row5 = mysql_fetch_array ($getback);
?>

<form name="editBackground" action="editBackground.php" method="post">
<input type="hidden" name="id" value="<?php echo $row5['id']; ?>" />
<table width="100%" border="0" cellpadding="0" cellspacing="5">
<tr>
	<td><b>Name:</b></td> <td><input type="text" name="name" value="<?php echo $row5['name']; ?>" /></td>
</tr>
<tr>
	<td><b>IMG URL:</b></td> <td><input type="text" name="img_url" value="<?php echo $row5['img_url']; ?>" size="60" /></td>
</tr>
<tr>
	<td> </td> <td><input type="submit" name="submit" value="Edit Background" /></td>
</tr>
</table>
</form>

I'm assuming this is line 515:

$getback = ("SELECT id FROM CustomisationBackgrounds WHERE id='$id'");

 

If it is, change it to this:

<?php
  $getback = ("SELECT id FROM CustomisationBackgrounds WHERE id='$id'")or die(mysql_error());
?>

 

That will tell you what the problem is.

I'm assuming this is line 515:

$getback = ("SELECT id FROM CustomisationBackgrounds WHERE id='$id'");

 

If it is, change it to this:

<?php
  $getback = ("SELECT id FROM CustomisationBackgrounds WHERE id='$id'")or die(mysql_error());
?>

 

That will tell you what the problem is.

 

I still get the same error :-\

 

I checked the table name and it's right so I just don't get it...

Just realized something, You don't ever use mysql_query()

 

 

<?php

$getback = mysql_query("SELECT id FROM CustomisationBackgrounds WHERE id='$id'")or die(mysql_error());

?>

 

 

Just realized something, You don't ever use mysql_query()

 

 

<?php

$getback = mysql_query("SELECT id FROM CustomisationBackgrounds WHERE id='$id'")or die(mysql_error());

?>

 

 

 

Thanks! After a full day of coding, that sort of thing can happen :P

echo this and give me the result then tell me f i have to learn more

"SELECT id FROM CustomisationBackgrounds WHERE id='".$id."'"

 

Conocation doesn't matter when the variable is in between double quotes. Your way and ryeman98's way would both work. ryeman98 was just stating that it doesn't matter, so it was pointless to suggest it =]

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.