create_where ()

function create_where ($row, $query, $mode = 'AND')

This function will create a MySQL where by tokenize the $query, and merge them by $mode for $row field.

$row = table field name.

$query = the string to be searched for.

$mode = can be AND or OR.

Example 1 (not a complete code)

require './includes/user_init.php';

$where = create_where ('user_id', 'abc def ghi');
$res = sql_query ("SELECT * FROM ".$db_prefix."user WHERE $where", 1);

// output:
// SELECT * FROM qe_user WHERE (user_id LIKE '%abc%' AND user_id
// LIKE '%def%' AND user_id LIKE '%ghi%')

Posted On: Aug-23-2010 @ 07:00am
Last Updated: Jan-01-1970 @ 07:00am

There is no comment. Why not be the first?

More Comments/Post Your Own

Online Users
There are 139 users online.

Connect with us on Facebook


Subscribe to our newsletter for the latest updates and exciting promotions!