cliftonbazaar Posted October 15, 2010 Share Posted October 15, 2010 $query = "SELECT * FROM friends"; $sql_statement = "UPDATE friends SET "; $column = "memberName"; $values = "'$_POST[memberName]'"; if ($result = $mysqli->query($query)) { /* Get field information for all columns */ while ($info = $result->fetch_field()) { if($info->name <> 'memberID') { //If the column isn't memberID if($info->name == 'memberName') { //If the column is the memberName $sql_statement .= $info->name."='".$_POST[$info->name]."'"; } else { //Put the commas in $sql_statement .= ", ".$info->name."='".$_POST[$info->name]."'"; } } } $result->close(); } $sql_statement .= " WHERE memberID='$_REQUEST[member]'"; now if I echo the $sql_statement it all works fine - EXCEPT if the data has a space in it, which the Address column nearly always does - if the Address is 'Box 73' it only saves the 'Box' part, how do I get it to save all of the address? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 15, 2010 Share Posted October 15, 2010 Did you look directly in your database to see what exactly is being saved? If you do, you will find that the data is saved correctly. Your problem is most likely invalid HTML where you output/echo the contents. This problem is usually due to missing quotes around the data value when you output it into form fields. Quote Link to comment Share on other sites More sharing options...
cliftonbazaar Posted October 15, 2010 Author Share Posted October 15, 2010 After checking the database I see that the data is being saved correctly, not to Google and find out how to display it properly Quote Link to comment 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.