You are here: C97net • 5.02 Database Functions
A shortcut to create WHERE conditions for MySQL.
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)
<?php
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%')
?>
There is no comment. Why not be the first?