Forum Moderators: coopster
$test="aa bb";
Send= " /\"\" "; ( to add the /"" that stands for rem white space)
$test2=$test.$end;
echo chop($test2);
Which results in
aa bb /""
Incidentally is it correct/possible to have a table named with space in between two words
I tried on MySQL 5.0.22 on my local test bed and it was accepted!
I did not think it was valid?
(Can't held with the MySQL question, but I've always assumed you shouldn't use spaces.)
thanks again that will do fine.
function makeURLFriendly($input){
$output = strtolower($input);
$output = preg_replace("/[^[:space:]a-z0-9]/e", "", $output);
$output = trim($output);
$output = preg_replace('/\s\s+/', '_', $output);
return $output;
}//function makeURLFriendly($input){
echo $input = ' My Directory & Stuff ';
echo '<br />';
echo makeURLFriendly($input); // my_directory_stuff
My approach is a tad different in that I am filtrating input from the $_POST step
Using!preg_match to guaranty that it will look as required.
Well actually I first use a $clean() to be on the safe side
Then preg()
And using if {} I send the user back to the form if empty, unsafe, unauthorized char etc.. but I create a session that allows to form data persistence
And kill the script next step using exit()
<edit>
New to PHP:
The function clean()
means a home made () not in the manual :)
That tries to keep input clean of attack
</edit>
Incidentally is it correct/possible to have a table named with space in between two words
I tried on MySQL 5.0.22 on my local test bed and it was accepted!
I did not think it was valid?
You can have spaces, but database, table, and column names should not end with space characters. The bigger question is why would you though? It's just so much easier to not have to be concerned with quoting identifiers when they have special characters. An identifier may be quoted or unquoted. If an identifier is a reserved word or contains special characters, you must quote it whenever you refer to it.
Special characters are those outside the set of alphanumeric characters from the current character set, ‘_’, and ‘$’.
[dev.mysql.com...]