Search not working
Search not working
tcash21
Posts: 13Questions: 0Answers: 0
I'm using MSSQL and therefore had to remove the mysql_real_escape_string() function from the searching.
I tried replacing it with this alternative:
http://stackoverflow.com/questions/574805/how-to-escape-strings-in-mssql-using-php
[code]
function mssql_escape($data) {
if(is_numeric($data))
return $data;
$unpacked = unpack('H*hex', $data);
return '0x' . $unpacked['hex'];
}
[/code]
But that gave me errors. I also tried addslashes(). I've now resorted to not having any escape function so my code looks like this:
[code]
$sWhere = "";
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
{
$sWhere = "WHERE (";
for ( $i=0 ; $i
I tried replacing it with this alternative:
http://stackoverflow.com/questions/574805/how-to-escape-strings-in-mssql-using-php
[code]
function mssql_escape($data) {
if(is_numeric($data))
return $data;
$unpacked = unpack('H*hex', $data);
return '0x' . $unpacked['hex'];
}
[/code]
But that gave me errors. I also tried addslashes(). I've now resorted to not having any escape function so my code looks like this:
[code]
$sWhere = "";
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
{
$sWhere = "WHERE (";
for ( $i=0 ; $i
This discussion has been closed.
Replies
Is there a way to fire off an alert that will output the SQL query each time I search?