Hi, i have a script that should delete multiple images from a database and it worked fine while it was on a single HTML page, however since i have changed it to being in functions it seems to have stopped working.
The error i'm receiving is as follows:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bluemoon/public_html/NEWCMS/admin/deleteavatar/functions_deleteavatar.php on line 215(167 for code below)
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bluemoon/public_html/NEWCMS/admin/deleteavatar/functions_deleteavatar.php on line 230(182 for code below)
I can't work out why and have tried to get round it but with no luck.
Attached is the code of the two functions. The way it works is that the HTML calls listAvatar and then the user checkboxs the images they want to delete at which point the form calls db_delete_avatar.php and then that calls deleteAvatar.
Only thing is i keep getting the above error.
Thanks Alex
The error i'm receiving is as follows:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bluemoon/public_html/NEWCMS/admin/deleteavatar/functions_deleteavatar.php on line 215(167 for code below)
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bluemoon/public_html/NEWCMS/admin/deleteavatar/functions_deleteavatar.php on line 230(182 for code below)
I can't work out why and have tried to get round it but with no luck.
Attached is the code of the two functions. The way it works is that the HTML calls listAvatar and then the user checkboxs the images they want to delete at which point the form calls db_delete_avatar.php and then that calls deleteAvatar.
Only thing is i keep getting the above error.
Thanks Alex
Code Snippet:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: | // listAvatar code. function listAvatar() { $sql = "SELECT COUNT(*) FROM avatar"; $result = mysql_query($sql) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; // number of rows to show per page $rowsperpage = 20; // find out total pages $totalpages = ceil($numrows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages; } // end if // if current page is less than first page... if ($currentpage"; // while there are rows to be fetched... while ($list = mysql_fetch_assoc($result1)) { // echo data $id=$list["id"]; echo ""; } echo "
|