print

create_where ()

You are here: C97net5.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%')
?>
Posted on: Aug-23-2010 at 07:00am
Last Updated: Jan-01-1970 at 07:00am

There is no comment. Why not be the first?

read more More Comments/Post Your Own

Account

Search

Tags

acp add all also any create default display don download easy echo etc features field file files folder form function includes information init kemana link list may module name need number own page php please qengine read require script set site skin time tpl url use user using version welcome