Another newbie question

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

 



The following code results in the error message "Couldn't execute query."

-----------
<?php
  /* Program: ShowDir.php
   * Desc:    Displays results of the search.
   */
?>
<html>
<head><title>Search Results</title></head>
<body topmargin="0" marginheight="0">
<?php
  include("login.inc");

  $connection = mysql_connect($host,$user,$password)
       or die ("Couldn't connect to server");

  $db = mysql_select_db($database,$connection)
       or die ("Couldn't select database");

$sql = "SELECT * FROM $table ";
$sql .= "WHERE `LastName` LIKE $search_string ";
$sql .= "OR `FirstName` LIKE $search_string ";
$sql .= "OR `Spouse` LIKE $search_string ";
$sql .= "OR `Street` LIKE $search_string ";
$sql .= "OR `Email` LIKE $search_string LIMIT 0, 30 ";
$sql .= "ORDER BY Street, HouseNum, LastName";

  $result = mysql_query($sql)
       or die ("Couldn't execute query.");
 ...

-------------

Why is that?

Also, how do I make LIKE insensitive to case?

And finally, how do I use the % wildcard with a variable?

Thanks.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux