Psycho Posted February 28, 2011 Share Posted February 28, 2011 You need to change this to a while loop ($row = mysql_fetch_assoc($result)) ;{ It was in your original code, so I don't know at what point you changed it. (Also, remove the semicolon) while ($row = mysql_fetch_assoc($result)) { Lastly, I inadvertently left off the column names in the dynamic query, which flolam corrected. But, you can make this line $where_parts[] = str_replace("search", "user", $name)." = '".mysql_real_escape_string(trim($_POST[$name]))."'"; much simpler by naming your input fields the same as your db fields. Doing that makes it much easier on you in the future when you have to make changes to your code. That line would look something like this $where_parts[] = "{$name} = '".mysql_real_escape_string(trim($_POST[$name]))."'"; Link to comment https://forums.phpfreaks.com/topic/228977-help-with-php-and-mysql-query/page/2/#findComment-1180811 Share on other sites More sharing options...
lbh2011 Posted February 28, 2011 Author Share Posted February 28, 2011 Thanks! That sorted it. I must have changed a few bits with all this editing, but all works now! Link to comment https://forums.phpfreaks.com/topic/228977-help-with-php-and-mysql-query/page/2/#findComment-1180894 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.