php - For Each loop not echoing data (mysql_fetch_assoc problem?) -
Hello and good morning,
I'm still learning PHP and for some reason my script Will not post any thoughts in my foreach loop why any thoughts? Email the e-mail properly, but I want to remove my code:
& lt ;? Php include 'include / header.php'; $ AccountUser = array (); $ UpgradeEmail = $ _GET ['currEmail']; $ EmailQuery = "Select FBIID, first name, user by last name, where email is a = ''. $ $ UpgradeEmail. '' And authLevel = 0"; & Lt ;? Php echo $ emailRow ['fbID']; ? & Gt; & Lt ;? Php echo $ emailRow ['firstname']; ? & Gt; & Lt ;? Php echo $ email rou ['last name']; ? & Gt; While ($ emailRow = mysql_fetch_assoc ($ e-mail, $ conn)) {$ accountUser [] = $ emailRow; }? & Gt; & Lt; Table & gt; & Lt ;? Php foreach ($ accountUser $ as email data) {? & Gt; & Lt; TR & gt; & Lt; TD & gt; & Lt ;? Php Emailadata ['FBID']; ? & Gt; & Lt; / Td> & Lt; Td> & Lt ;? Php email data ['first name']; ? & Gt; & Lt; / Td> & Lt; TD & gt; & Lt ;? Php emailadata ['last name']; ? & Gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt ;? Php}? & Gt; & Lt; / Table & gt; $ emailQuery You have created your SQL query in $ emailQuery ,
mysql_query () , and its result is passed to mysql_fetch_assoc () . $ emailQuery = "Select fbID, firstName, lastName FROM users where email is a = ''. $ $ UpgradeEmail. '' And authLevel = 0"; $ Result = mysql_query ($ email query); If ($ result) {while ($ emailRow = mysql_fetch_assoc ($ result, $ conn)) {$ accountUser [] = $ emailRow; }} Else // Your query has failed {// handles failure} Please make sure to call your database by SQL injection by calling mysql_real_escape_string () From the $ upgradeEmail , you will get it from $ _ GET. Are getting from $ upgradeEmail = mysql_real_escape_string ($ _GET ['currEmail']);
Comments
Post a Comment