Re: write trim into INSERT and SELECT Queries
Posted by:
Rick James
Date: February 18, 2009 09:03PM
I usually approach it this way (when using PHP):
$wheres = array();
if (...) // if need to check the company name
{
$x = mysql_real_escape_string($company);
$wheres[] = "company = '$x';
}
if (...) // if need to check foo
{
$x = mysql_real_escape_string($foo);
$wheres[] = "foo= '$x';
}
...
$where_str = implode(' AND ', $wheres);
$sql = "SELECT ... FROM tbl
WHERE $where_str
ORDER BY ...";
Subject
Written By
Posted
February 14, 2009 11:21AM
February 14, 2009 11:47AM
February 14, 2009 11:55AM
Re: write trim into INSERT and SELECT Queries
February 18, 2009 09:03PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.