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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 =]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.