ryeman98 Posted June 26, 2007 Share Posted June 26, 2007 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 https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/ Share on other sites More sharing options...
teng84 Posted June 26, 2007 Share Posted June 26, 2007 "SELECT id FROM CustomisationBackgrounds WHERE id='".$id."'" Link to comment https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-282668 Share on other sites More sharing options...
pocobueno1388 Posted June 26, 2007 Share Posted June 26, 2007 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 https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-282669 Share on other sites More sharing options...
ryeman98 Posted June 26, 2007 Author Share Posted June 26, 2007 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 https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-282671 Share on other sites More sharing options...
teng84 Posted June 26, 2007 Share Posted June 26, 2007 "SELECT id FROM CustomisationBackgrounds WHERE id='".$id."'" Link to comment https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-282674 Share on other sites More sharing options...
pocobueno1388 Posted June 26, 2007 Share Posted June 26, 2007 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()); ?> Link to comment https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-282675 Share on other sites More sharing options...
ryeman98 Posted June 26, 2007 Author Share Posted June 26, 2007 "SELECT id FROM CustomisationBackgrounds WHERE id='".$id."'" Maybe you should learn more. That doesn't matter. Link to comment https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-282676 Share on other sites More sharing options...
ryeman98 Posted June 26, 2007 Author Share Posted June 26, 2007 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 Link to comment https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-282678 Share on other sites More sharing options...
pocobueno1388 Posted June 26, 2007 Share Posted June 26, 2007 Haha, yeah...I hear you Link to comment https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-282679 Share on other sites More sharing options...
teng84 Posted June 26, 2007 Share Posted June 26, 2007 echo this and give me the result then tell me f i have to learn more "SELECT id FROM CustomisationBackgrounds WHERE id='".$id."'" Link to comment https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-282680 Share on other sites More sharing options...
pocobueno1388 Posted June 26, 2007 Share Posted June 26, 2007 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 https://forums.phpfreaks.com/topic/57197-solved-error-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-282681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.