Carlton Posted December 24, 2010 Share Posted December 24, 2010 Google has failed me once again :'(. I'm getting this error, which I can't find out how to fix: Here's the code: $Database_Factions = "factions"; $Database_Factions_1 = "Name"; $Database_FName_Num = 1; $searchmemberdata = mysql_query("SELECT " . $Database_Factions_1 . " FROM " . $Database_Factions . " WHERE " . $Database_Factions_1 . " LIKE '" . mysql_real_escape_string($_GET['name']) . "%' LIMIT 1"); $searchdata = mysql_fetch_row($searchmemberdata); echo($searchdata[$Database_FName_Num]); echo("<meta http-equiv='refresh' content='55;url=member.php?action=ViewFaction&name=" . $searchdata[$Database_FName_Num] . "' />"); I know my code is not optimized, I'm fixing it after i'm done with what i'm doing. Everytime $searchdata[$Database_FName_Num] is called, the error: Notice: Undefined offset: 1 comes out. Any help? Quote Link to comment https://forums.phpfreaks.com/topic/222553-notice-undefined-offset-1/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 24, 2010 Share Posted December 24, 2010 You are only selecting one column in your query and that value would be accessed using the zero'th element of what mysql_fetch_row() returns. Is there some reason you are not using mysql_fetch_assoc() so that the column name you are fetching in $Database_Factions_1 would be the same associative element name you access in the fetched data? Quote Link to comment https://forums.phpfreaks.com/topic/222553-notice-undefined-offset-1/#findComment-1150995 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.