chris_2001 Posted September 19, 2008 Share Posted September 19, 2008 I can't seem to get this to work. I have triple checked spelling yet it keeps giving the error. Anyone see anything wrong with my coding? Thanks. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\empty.php on line 23 <?php session_start(); if(!session_is_registered(myusername)){ header("location:index.php"); } include 'mysql_connect.php'; $Username = $_SESSION["myusername"]; $query = "SELECT num, admin FROM accounts WHERE accname = '$Username'"; $result = mysql_query($query); $row = mysql_fetch_array($result, MYSQL_ASSOC); $usernum = $row['num']; $admin = $row['admin']; if ($admin == "1"){ $sql="SELECT status, number FROM tasks WHERE accountid = '$usernum' "; $result=mysql_query($sql); while ($myrow = mysql_fetch_array($result)){ $editnum = $myrow['number']; $status = $myrow['status']; if ($status == "1"){ $query = "UPDATE tasks SET status = '2' WHERE number = '$editnum'"; $result = mysql_query($query); } }} ?> Link to comment https://forums.phpfreaks.com/topic/124895-solved-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/ Share on other sites More sharing options...
chris_2001 Posted September 19, 2008 Author Share Posted September 19, 2008 Nevermind used the same variable in the loop. DOH! Link to comment https://forums.phpfreaks.com/topic/124895-solved-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql/#findComment-645337 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.