Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] PHP functions to create MySQL syntax? (was: Do you whitelist or blacklist utf-8?)



On 23 February 2011 16:54, Dave M G <dave@example.com> wrote:

> After reading this, I've been looking around the PHP manual, and I don't
> see any "mechanisms" for constructing SQL queries.

http://www.petefreitag.com/item/356.cfm

In a nutshell:

$offset = 0
$db_connection = new mysqli("localhost", "user", "pass", "db");
$statement = $db_connection->prepare("SELECT * FROM foo WHERE bar = ?
AND id > ? AND id <= ?");
$statement->bind_param("sii", "baz", $id, $id + 123);
$statement->execute();


> Surely if any language had MySQL syntax constructors it would be PHP....

Surely you were being sarcastic... ;-P

All of the high-level languages wrap the MySQL C API, so you could say
"Surely if any language had MySQL syntax constructors it would be C!"

-- 
Cheers,
Josh


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links