Hello all, got my script working, woohoo!!! But im struggling to put it in to a table, in fact im well and truly stuck.
At present my code is as follows
/* Connecting, selecting database */
$link = mysql_connect("localhost", "db", "pass")
or die("Could not connect : " . mysql_error());
echo "<strong>Your Search Results</strong> <br> Age - Home Team - Away Team - Date (YY/MM/DD)";
mysql_select_db("cndjfl_fixtures") or die("Could not select database");
$age=
$team=
$date=
/* Performing SQL query */
$query = "SELECT * FROM fixtures
WHERE age LIKE'$age'
AND ((hometeam LIKE '$team') OR (awayteam LIKE '$team'))
AND date LIKE '$date' ORDER BY date";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
/* Printing results in HTML */
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
/* Free resultset */
mysql_free_result($reult);
/* Closing connection */
mysql_close($link);
?></td>
</tr>
</table>
<br>
And this puts my results out, one results on each line. However there are 4 fields per line (age, hometeam, awayteam, date) and i want them in a table where each one is in its own cell!! I also want the table to be colour:#215908 with a 1pixel border but i am only a beginner and dont know what to do!!
So it should display as follows:
<table width="80%" border="1" cellpadding="1" cellspacing="0" bordercolor="#215908">
<tr>
<td>Age</td>
<td>Home Team </td>
<td>Away Team</td>
<td>Date</td>
</tr>
</table>
I hope someone can help me