Click to See Complete Forum and Search --> : spaces in entry names


ripken204
03-17-2007, 11:43 AM
mysql wont retrieve an entry in a table with a space in the name. is there a way around this? and if not, then how would i go about taking out the underscore i am using in place of a space? i only want to take this out when displaying an entry to the user. im using php.

NightShift58
03-17-2007, 04:02 PM
mysql WILL retrieve values with spaces in them. If it didn't, this forum wouldn't exist, as spaces are the most prevalent characters used.

The problem you're having probably has to do with the way you are trying to display the results. Are you properly quoting the results when echo'ing? Are you stripslashes()'ing? etc.

EDIT: "in the name"... It just sunk in... Sorry... Use backticks/backquotes to delimit field names with spaces in them (`), such as `Last Name`. But, not a good idea to have field names with spaces in them..

ripken204
03-17-2007, 08:57 PM
well this is what happens for me.
say the name is "bob smith" and i take it out of the table and echo it, it will only print out "bob". even if i do echo "$name" or echo $name

edit: nvm. i had names in a drop down list and i had to do value=\"$name\" instead of just value=$name

NightShift58
03-18-2007, 01:02 AM
That's what I meant with "Are you properly quoting the results when echo'ing?"