RoGuE_StreaK
Group: Members
Posts: 418
Joined: Jan. 2004 |
|
Posted: Oct. 27 2004,01:06 |
|
Hi Robert, just tried converting over a mysql thing I've been working on, came across possibly one thing, the use of "%" in mysql as a wildcard, sqlite doesn't seem to like it (unless I've done something wrong):
Code example:
$db = "/home/dsl/db"; $TableName="addressbook"; sqlite_connect($db) or die("Count not connect to database");
$sql="SELECT * FROM $TableName WHERE firstName LIKE \"%$firstName%\" AND lastName LIKE \"%$lastName%\" AND address LIKE \"%$address%\" AND telephone LIKE \"%$telephone%\" AND email LIKE \"%$email%\" AND dob LIKE \"%$day%$month%$year%\" ";
$result = sqlite_query($sql,$db) or die("Query Failed");
sqlite_close($Link);
Result: sqlite_exec: SELECT * FROM addressbook WHERE firstName LIKE "%%%" AND lastName LIKE "%%" AND address LIKE "%%" AND telephone LIKE "%%" AND email LIKE "%%" AND dob LIKE "%%%%" sqlite_query result: SQL error: near "%": syntax error SQL error: near "%": syntax error SQL error: near "%": syntax error Query Failed
MySQL would use the % as a wildcard, so you'd get all results in the table coming up.
-------------- "I find your lack of penguin disturbing" - Darth Tux
|