Jump to content

spaces in field


HDFilmMaker2112

Recommended Posts

If you're only concerned with leading/trailing spaces, you can use MySQL's TRIM() function on the data in the table, and php's trim() function on the data you're comparing.

 

$data = trim($_POST['data']);
$query = "SELECT field1, field2 FROM table WHERE TRIM(field) = '$data'";

Link to comment
https://forums.phpfreaks.com/topic/236392-spaces-in-field/#findComment-1215891
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.