Re: HELP with something really simple.
| From: | Joe Stump | Date: | Thu, 21 Dec 2000 23:16:24 +0000 |
| Subject: | Re: HELP with something really simple. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31489@lists.php.net to get a copy of this message | ||
first off I would break out your $sql - so like this:
$sql = "SELECT * FROM cars ".$search;
echo $sql;
See if your SQL works in the regular SQL shell (ie connect to your db via a
shell and run the query that way). If your query runs fine then you can rule it
out and look at something else in your code. If it doesn't then you should have
a pretty good idea as to what is wrong with it.
--Joe
On Fri, Dec 22, 2000 at 11:56:15AM +1300, Sefton wrote:
> Hello everybody,
>
> What I have is a website for our car yard. I have just completed the
> database with a field for everything ie Make, Model, Year, Price + more.
>
> I have a php page that after much pissing about actually works and using
> select * from cars shows me everything in a nice format with the picture.
>
> What I want to do however is create a new page that can change the select
> line in my other page using some sort of a variable.
>
> But HOW?
> This is the line I have at the moment in my page
>
> $result = mysql_query("SELECT * FROM cars",$db);
>
> I have tried ("SELECT * FROM cars $search",$db);
>
> The variable $search includes a combination of text from a textbox and some
> added words.
>
> ie $search = where make = 'honda' and model = 'civic'
>
> But it doesn't work.
>
> Please help
> The page that I want to create is one that lets the user search the vehicles
> by many different parameters.
> Like list by Make only
> or Make & Model & Transmission
> or Make & Colour
> or Year
> or Kms under 50000 etc
>
> Any help on this will very appreciated.
>
> Thanks
>
> Chris
> Alias Dr nick
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
---
Joe Stump
PHP Programmer
www.Care2.com