PHP query using WHERE with AND
I have been trying to learn enough PHP and MySQL to use a query with
one of my genealogy data pages, instead of viewers needing to browse
through it all. What little I have learned is from the Library Books
at our local library.
This PHP code works fine until I insert the line beginning with AND,
then it won't execute.
Have I missed some punctuation?
Thanks for any help.
$query = "SELECT pictures.markername, pictures.image,
pictures.field1, places.place
FROM pictures,places
WHERE (pictures.place_id=places.place_id)
AND (pictures.markername LIKE $surname )
ORDER BY pictures.markername ASC";
$result = mysql_query($query)
or die ("Couldn't execute query.");
.
Relevant Pages
- Update statement causes mysql varchar field to be set to empty string
... I am using PHP with MySQL 4.1.14. ... Whenever I execute an update ... get set to the new values, but get set to empty strings instead. ... Printing the query string after executing mysql_query shows the ... (comp.lang.php) - Re: Problem with executing MySQL queries through PHP.
... time in your browser could be the problem rather than just the query. ... I was faced with the choice of whether my problem is indeed a PHP ... experience the same problem when I execute the same query at the CLI. ... (comp.lang.php) - Re: Problem with executing MySQL queries through PHP.
... I was faced with the choice of whether my problem is indeed a PHP ... experience the same problem when I execute the same query at the CLI. ... I am having trouble executing a large query through my PHP script. ... (comp.lang.php) - Re: fatal memory error after executing query on MSSQL server
... >> Is the message I get when I execute a select query on a MSSQL database. ... > an endless loop in a PHP script, ... (alt.php) - Re: speed
... Wouldn't mysql execute it's query in the same amount of time had the query ... submiting the query, so whether you use PHP or ASP or whatever, it would ... PHP front-end would execute faster or slower than whatever you use now? ... (alt.php) |
|