Whoops firgured otu where my parse error was. I had my semi-colon inside my first query.
So essentially I am trying to query with three different select statements in the same PHP script. Is this possible? (Last question I promise, after this I think the basics should get me a few weeks without having to ask more)
<?php
include("server_connect.php");
mysql_select_db("rnissen");
$query = "SELECT column_one, column_two, column_four FROM tbltable;"
$results = mysql_query($query) or die(mysql_error());
$querytwo = "SELECT column_one, column_two, column_five FROM tbltable WHERE column_five = 1989";
$results = mysql_query($querytwo) or die(mysql_error());
$querythree = "SELECT COUNT(column_five) FROM tbltable WHERE column_five = 1989";
$results = mysql_query($querythree) or die(mysql_error());
?>
Part Two Ok so I changed the code as suggested and tried to add it into a table. I'm still getting Parse error: syntax error, unexpected '$results1' (T_VARIABLE) in C:\xampp\htdocs\3718\assign5SELECT.php on line 7
I tried it without the table and it is still the same error. Is there something I am missing? Here is the updated code with the new variables.
mysql_select_db("rnissen");
$query = "SELECT column_one, column_two, column_four FROM tbltable;"
$results1 = mysql_query($query) or die(mysql_error());
echo "Column One, Column Two, Column Four : </br>";
echo "<table border=\"1\">
";
while ($row1 = mysql_fetch_assoc($results1)) {
echo "<tr>
";
foreach($row1 as $value1) {
echo "<td>
";
echo $value1;
echo "</td>
";
}
echo "</tr>
";
}
echo "</table>
";
$querytwo = "SELECT column_one, column_two, column_five FROM tbltable WHERE column_five = 1989";
$results2 = mysql_query($querytwo) or die(mysql_error());
echo "Column One, Column Two, Column Five : </br>";
echo "<table border=\"1\">
";
while ($row2 = mysql_fetch_assoc($results2)) {
echo "<tr>
";
foreach($row2 as $value2) {
echo "<td>
";
echo $value2;
echo "</td>
";
}
echo "</tr>
";
}
echo "</table>
";
$querythree = "SELECT COUNT(column_five) FROM tbltable WHERE column_five = 1989";
$results3 = mysql_query($querythree) or die(mysql_error());
echo "Column 4 has this many 1989s : </br>";
echo "<table border=\"1\">
";
while ($row3 = mysql_fetch_assoc($results3)) {
echo "<tr>
";
foreach($row3 as $value3) {
echo "<td>
";
echo $value3;
echo "</td>
";
}
echo "</tr>
";
}
echo "</table>
";
?>