hello
ive got a page that pulls out a defined amount of results dependant upon a variable named $display and the amount of returned results.
What id like to do is assign a text label to each generated hyperlink number, that onmousover gives the name of the first result in that target page.
heres the code, note the line
echo'<a href="testpage.php?start='.(($display * ($i-1))).'&num_pages='.$num_pages.' " TITLE='.$talt.'>'.$i.'</a>';
also note the variable $talt which holds the customer names from the db.
The existing page gives me the same title tag for each hyperlink, wheras i want a different one, corresponfding to the first result for each page.
eg
seperate hyperlinks of 1,2,3,4,5,6 etc
In the example of 1. a mouseover should show results starting with the letter a, so assuming that the first customers name in the result set was albert this would show albert
In the example of 2 a mousever might show results starting with the letter d so assumming that the first customer in this result set was danny then thios would show danny.
ive played with it for a while now and am at a loss as to how to sort it.
<?
$display = 10;
include("os_conn.inc");
require("fns.php");
$date=date("Y-m-d");
if(!isset($num_pages)){
$q="select distinct * from customers order by c_name ";
$rst=mysql_query($q);
@ $num_results = mysql_num_rows($rst);
echo"$num_results customers in the database";
// for ($i=0; $i <$num_results; $i++) {
if($num_results > $display){
$num_pages = ceil ($num_results/$display);
}elseif($num_results > 0){
$num_pages =1;
}else {
echo'No results';
}
$start=0;
}
$q2="select distinct * from customers order by c_name LIMIT $start, $display";
$rsat=mysql_query($q2);
$brsat=mysql_query($q2);
$talt=mysql_fetch_array($brsat);
$talt=$talt['c_name'];
if($num_pages > 1){
if($start == 0){
$current_page= 1;
}else{
$current_page =($start/$display) + 1;
}
if($start != 0){
echo'<a href="testpage.php?start='.($start-$display).'&num_pages='.$num_pages.'">Previous</a>';
}
for($i = 1; $i <= $num_pages; $i++){
$next_start = $start + $display;
if($i != $current_page){
echo'<a href="testpage.php?start='.(($display * ($i-1))).'&num_pages='.$num_pages.' " TITLE='.$talt.'>'.$i.'</a>';
}else{
echo $i.'';
}
}
}
while($barow=mysql_fetch_array($rsat)){
$talt=($barow['c_name']);
$barow['c_address1']= ucwords ($barow['c_address1']);
$barow['c_address2']= ucwords ($barow['c_address2']);
$barow['c_pcode']= strtoupper ($barow['c_pcode']);
echo"<table width=\"50%\" border=\"0\">
<tr>
<td valign=top>
<P> <b>$barow[c_name]</b><br>
$barow[c_address1]<br>
$barow[c_address2]<br>
$barow[c_pcode]<br>
Tel:$barow[c_phone]<br>
Fax:$barow[c_fax]</p>
</td>
<td valign=top align=right><p><b>Company ID:</b> $barow[c_id] <br>
<br><b>Date: </b> $date</p> </td></tr></table><br><br>";
}
if($num_pages > 1){
if($start == 0){
$current_page= 1;
}else{
$current_page =($start/$display) + 1;
}
if($start != 0){
echo'<a href="testpage.php?start='.($start-$display).'&num_pages='.$num_pages.'">Previous</a>';
}
for($i = 1; $i <= $num_pages; $i++){
$next_start = $start + $display;
if($i != $current_page){
echo'<a href="testpage.php?start='.(($display * ($i-1))).'&num_pages='.$num_pages.' " TITLE='.$talt.'>'.$i.'</a>';
}else{
echo $i.'';
}
}
}
?>
tia for any suggestions
$me=strrev('ku.oc.bewenoz@trebor');