ZibingsCoder wrote:Simplest way would be to just grab the text for each row and just do a little call to substr() to show the first X number of characters...
while ( $row = mysql_fetch_assoc($result) )
{
$row['snippet'] = substr($row['text'], 0, 25)."...";
}
Then whenever they click on the arrow, just have the next page display the whole text normally. Make sense?
To those who possess sense, i'm sure it would. So....that just leaves me 'floundering'.
If the field that contains the text, is the one in the script below referred to as 'Report Link' and 'rep'. Where do i place the code you've kindly supplied?. Also, i'm struggling with your references to 'snippet' and 'text'. What do i substitute them with?. By that i mean, i don''t have a field called 'snippet' and i can't figure out the substitution for 'text'.
Once you have been able to stop guffawing at my lack of knowledge/stupidity, i would be glad if you could direct me on the right path (not the one to the loony farm).
<html><head><title>TESTmatches.php</title></head><body bgcolor="#ffffff"><b>
<a href="testmatch.php">Return To TESTMATCH</a>
<?php $conn=mysql_connect("localhost", "server", "password") or die("could not connect");
$rs=mysql_select_db("database", $conn) or die("could not connect to database");
$sql=stripslashes
("SELECT `round`,`venue`,`date`,`home`,`away`,`result`,`rep`,`id` FROM `worldcup` WHERE (`home` LIKE '$team%') OR (`away` LIKE '$team%') ORDER BY 'id' ASC");
$rs=mysql_query($sql, $conn) or die("could not execute query because ".mysql_error());$list="<table border=\"1\" cellpadding=\"2\">";
$list.="<tr><th>Round</th>";
$list.="<th>Venue</th>";
$list.="<th>Date</th>";
$list.="<th>Home Team</th>";
$list.="<th>Away Team</th>";
$list.="<th>Result</th>";
$list.="<th>Report Link</th>";
$list.="<th>ID</th>";
$list.="</tr>";while($row=mysql_fetch_array($rs))
{
$list.="<tr bgcolor=\"#ffcc99\">";
$list.="<td><b>".$row["round"]."</b></td>";
$list.="<td><b>".$row["venue"]."</b></td>";
$list.="<td><b>".$row["date"]."</b></td>";
$list.="<td><b>".$row["home"]."</b></td>";
$list.="<td><b>".$row["away"]."</b></td>";
$list.="<td><center><b>".$row["result"]."</b></center></td>";
$list.="<td><b>".$row["rep"]."</b></td>";
$list.="<td><b>".$row["id"]."</b></td>";
$list.="</tr>";
}
$list.="</table>";echo($list);?>
<a href="testmatch.php">Return To TESTMATCH</a> </b></body></html>
Incidentally, my original plans were for, what i thought, would be a very simple and quick plan.
That is, one would enter a search term on a web page, eg. England. This then would bring up a table of all the matches they had played. Each row would contain the fields round, venue, date, home, away, result, report, id.
The report field would be a link containing just the word 'REPORT'. Upon being clicked, it would open up in a new window with the match report containing the full text. The link would either be a separate table in the database, or the field on the same row containing the text.
But, unfortunately, i just couldn't get the correct script or syntax to refer to the selected row's own id. If i could have fathomed it out, i would have the initial query, (select * from table), pulling up the rows in the format mentioned above (report just as a link), and then it would issue a second statement on the lines of 'select report where id = (the id of the row it is presently referring to/dealing with )'.