Hi all,
does anyone know why my seaarch is returning commas as the value
heres my code,
<?php
$db = mysql_connect("localhost", "root"
mysql_select_db("fjc",$db);
$orderby=Lst_name;
$stories_per_page=10;
$limit = $stories_per_page;
if (!$page):
$offset = 0;
else :
$offset = (($stories_per_page * $page)-$stories_per_page);
endif;
$sqlstr = "SELECT barristers.lst_name, barristers.fst_name, barristers.prefered, areas.area FROM barristers, areas WHERE barristers.Lst_name LIKE '%$bar_search%' OR barristers.Fst_name LIKE '%$bar_search%' OR barristers.prefered LIKE '%$bar_search%'ORDER BY '$orderby'";
$sqlstr_wo_limits = $sqlstr;
$sqlstr.= " LIMIT ".$offset.", ".$limit;
$result = mysql_query($sqlstr) or die("FAILED:".mysql_error()."for".$querystring."\n"
$cols = 3;
$counter = 1;
do {
print '<table width=\"100%\" cellspacing=\"4\">
<tr>';
while ($myrow = mysql_fetch_array($result)) {
if (is_int($counter / $cols)) {
print '<td>
<table width=\"100%\">
<tr>
<td>
<span class=\"text\">'. $myrow["barristers.lst_name"] .', '. $myrow["barristers.fst_name"] .', '. $myrow["barristers.qc_bc"] .'</span>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>';
}
else {
print '<tr><td><span class=\"text\">'. $myrow["barristers.lst_name"] .', '. $myrow["barristers.fst_name"] .', '. $myrow["barristers.qc_bc"] .'</span></td>';
}
$counter++;
}
print '</tr></table></center>';
} while ($myrow = mysql_fetch_array($result));
$total_records = mysql_query($sqlstr_wo_limits) or die("FAILED:".mysql_error()."for".$querystring."\n"
$count = mysql_num_rows($total_records);
if(!$page) {$page=1;}
$offset = ($page-1)*$stories_per_page;
$page_count = ($count-($count%$stories_per_page)) / $stories_per_page + 1;
$nextpage=$page+1;
$i = 1;
$output_string.="Page : ";
while ($i <= $page_count) {
if($i != $page)
{
$output_string.="<a href=\"$PHP_SELF?page=$i\">$i</a>\n";
} else {$output_string.="$i<br>";}
$i++;
}
if ($page < $page_count) {
$output_string.="<a href=\"$PHP_SELF?page=$nextpage\">";
$output_string.="Next $stories_per_page record(s)...</a>";
} else {
$output_string.="No more records to display!";
}
?>
thanks,
dunskii
does anyone know why my seaarch is returning commas as the value
heres my code,
<?php
$db = mysql_connect("localhost", "root"
mysql_select_db("fjc",$db);
$orderby=Lst_name;
$stories_per_page=10;
$limit = $stories_per_page;
if (!$page):
$offset = 0;
else :
$offset = (($stories_per_page * $page)-$stories_per_page);
endif;
$sqlstr = "SELECT barristers.lst_name, barristers.fst_name, barristers.prefered, areas.area FROM barristers, areas WHERE barristers.Lst_name LIKE '%$bar_search%' OR barristers.Fst_name LIKE '%$bar_search%' OR barristers.prefered LIKE '%$bar_search%'ORDER BY '$orderby'";
$sqlstr_wo_limits = $sqlstr;
$sqlstr.= " LIMIT ".$offset.", ".$limit;
$result = mysql_query($sqlstr) or die("FAILED:".mysql_error()."for".$querystring."\n"
$cols = 3;
$counter = 1;
do {
print '<table width=\"100%\" cellspacing=\"4\">
<tr>';
while ($myrow = mysql_fetch_array($result)) {
if (is_int($counter / $cols)) {
print '<td>
<table width=\"100%\">
<tr>
<td>
<span class=\"text\">'. $myrow["barristers.lst_name"] .', '. $myrow["barristers.fst_name"] .', '. $myrow["barristers.qc_bc"] .'</span>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>';
}
else {
print '<tr><td><span class=\"text\">'. $myrow["barristers.lst_name"] .', '. $myrow["barristers.fst_name"] .', '. $myrow["barristers.qc_bc"] .'</span></td>';
}
$counter++;
}
print '</tr></table></center>';
} while ($myrow = mysql_fetch_array($result));
$total_records = mysql_query($sqlstr_wo_limits) or die("FAILED:".mysql_error()."for".$querystring."\n"
$count = mysql_num_rows($total_records);
if(!$page) {$page=1;}
$offset = ($page-1)*$stories_per_page;
$page_count = ($count-($count%$stories_per_page)) / $stories_per_page + 1;
$nextpage=$page+1;
$i = 1;
$output_string.="Page : ";
while ($i <= $page_count) {
if($i != $page)
{
$output_string.="<a href=\"$PHP_SELF?page=$i\">$i</a>\n";
} else {$output_string.="$i<br>";}
$i++;
}
if ($page < $page_count) {
$output_string.="<a href=\"$PHP_SELF?page=$nextpage\">";
$output_string.="Next $stories_per_page record(s)...</a>";
} else {
$output_string.="No more records to display!";
}
?>
thanks,
dunskii