Being new to programming of any sort I have been having problems getting my head around the WHERE part of a SELECT function.
I have over the last few weeks been able to get a database up on my server & also make & receive simple SELECT queries.
The following is my first & flawed attempt at including a WHERE statement – Could anyone please point out where I have gone wrong?
#!/usr/local/bin/php4
<html>
<body>
<?php
$link = mysql_pconnect ("h*****", "j", "28")
or die ("Could not connect");
mysql_select_db ("***8_pn")
or die ("Could not select database");
$query = "SELECT first_name"
."FROM president"
."WHERE state = va";
$result = mysql_query ($query)
or die ("Query failed");
while ($row = mysql_fetch_array ($result))
{
printf ("%s", $row["first_name"]);
}
?>
</body>
</html>
I would apologise if this is old or well covered ground, I did check out the “Search” function for the topic but could not find quite what I required.
Thanks again.
JD
(LONDON)