Thanks Joel. That puts me on the right track... Now to debug some SQL errors!
The following is my PHP/SQL query....
PHP Code:
<?php
$query = "SELECT * from RtList where [Artist] LIKE \'' . $_GET['p'] . '%\'';";
// Original test query 'C%' or [Artist] LIKE 'c%' ORDER BY Artist
$conn = odbc_connect("RingToneDB", "", "" );
if (!$conn) {
print "Connection failed\n</html>";
exit;
}
if ($p = odbc_Exec($conn, $query))
{
print "Query returned : " . odbc_num_rows($p) . " rows";
odbc_result_all($p, "border = 0");
}
odbc_close($conn);
?>
Now I'm getting the following errors -
Notice: Undefined index: 'p' in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 5
Warning: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '\'., SQL state 37000 in SQLExecDirect in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 15
(Line 1 being the $query line, and line 15 being if ($result = odbc_Exec))
Any SQL gurus here?
Bookmarks