In my oppinion the error is in the Line:

WHERE title LIKE "%$title%")";

because you have a ")" too much and write the search String a follow:

WHERE title LIKE '%$title%';

important is the symbol ' not " .

I hope this helps you.

bye

Hoth

"Brad Lipovsky" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I get the following error:
>
> //error
> Warning: Supplied argument is not a valid MySQL result resource in
> /web/sites/184/syzme/www.syzme.f2s.com/Commerce_System/search.php on line
22
> //error
>
> when I try to use this code:
>
> <?php
> $Link = mysql_connect ($Host, $User, $Password);
>
> //code
> if ($category) {
>  $Query = "SELECT * from $TableName WHERE ((category)=$category)";
> } else { if ($title) {
>  $Query = "SELECT * from $TableName WHERE title LIKE "%$title%")";
>  }
> }
>
> $Result = mysql_db_query ($DBName, $Query, $Link);
>
> print "Your search query of <b> $category </b> returned the following
> results:<br><br>";
>
> while ($Row = mysql_fetch_array ($Result)) {
>   print "<a href=item.php?p=$Row[id]>";
>  echo ( $Row[title] );
>  print "</a><br>";
> }
>
>
> mysql_close ($Link);
> ?>
> //code
>
> on my site.  If i pass in a value for $category, it works fine... the
error
> arises when I try to pass in a value for $title.  I want it to search a
> MySQL DB for anything with the string $title in it, and then print it out
in
> the while structure.  Thanks
>
> Brad
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to