jarvis Posted December 6, 2009 Share Posted December 6, 2009 Hi all, Got the following code: if (mysql_affected_rows() == 1) { echo "<div align=\"center\"><img src=\"images/account_active.gif\"></div>"; $query1 = "SELECT email, pass FROM users WHERE (user_id=$x) LIMIT 1"; $result1 = mysql_query ($query1) or trigger_error("Query: $query1\n<br />MySQL Error: " . mysql_error()); $email = $row[0]; $pw = $row[1]; When it runs, I get Undefined variable: row on line 44 which is $email = $row[0]; Please point out the obvious as to why and what I need to do. I can't think straight anymore Thanks Quote Link to comment https://forums.phpfreaks.com/topic/184184-daft-undefined-variable-issue/ Share on other sites More sharing options...
premiso Posted December 6, 2009 Share Posted December 6, 2009 You are not fetching the data with mysql_fetch_row Quote Link to comment https://forums.phpfreaks.com/topic/184184-daft-undefined-variable-issue/#findComment-972414 Share on other sites More sharing options...
jamesxg1 Posted December 6, 2009 Share Posted December 6, 2009 if (mysql_affected_rows(***NEED A LINK HERE !**) == 1) { echo "<div align=\"center\"><img src=\"images/account_active.gif\"></div>"; $query1 = "SELECT email, pass FROM users WHERE (user_id=$x) LIMIT 1"; $result1 = mysql_query ($query1) or trigger_error("Query: $query1\n<br />MySQL Error: " . mysql_error()); while($row = mysql_fetch_assoc($result1)) { $email = $row[0]; $pw = $row[1]; } Quote Link to comment https://forums.phpfreaks.com/topic/184184-daft-undefined-variable-issue/#findComment-972415 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.