Search Results for |
Results - of |
Page of |
Results per-page:
5
| 10
| 20
| 50
|
|
$set_limit = $page * $rowperpage - ($rowperpage);
$sql_page = $sql. " ORDER BY mol_id ASC LIMIT $page, $limit" ;
//debug("sql=$sql_page, set_limit=$set_limit");
$result = mysql_query($sql_page);
if (!$result) {
$errmsg = 'Invalid query: ' . mysql_error() . "\n";
$errmsg .= 'Whole query: ' . $sql_page;
debug($errmsg);
}
echo "Structure | ID | Product Name | C.A.S. Number |
\n";
while ($data = mysql_fetch_array($result)) {
$viewlink = "$PHP_SELF?action=viewcat&catid=".$data['mol_id'];
echo "";
showmol($data['mol_id'],$thumbwidth,$thumbheight);
echo " | ".$data['mol_id']." | ".$data['structure_name']." | "
."".$data['cas_no']." |
";
}
echo " |
\n\n";
// Don't show 'previous' link if current page is first page.
if ($page != 0) {
$back_page = $page - $limit;
echo " Previous\n";
}
// loop through each page and give link to it.
for ($i=1; $i <= $pages; $i++) {
$ppage = $limit*($i - 1);
if ($ppage == $page){
echo("$i \n");// If current page don't give link, just text.
} else {
echo " $i\n";
}
}
// If last page don't give next link.
if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) {
$next_page = $page + $limit;
echo " Next\n";
}
echo " |
\n";
echo "
\n";
echo $footer;
mysql_free_result($result);
}
//view item
else if($action == "viewcat"){
echo $header;
echo $nav;
$catid = escapeshellcmd($catid);
$catid = mysql_real_escape_string(trim($catid));
$sql = "SELECT * FROM mol WHERE mol_id='$catid'";
$result = mysql_query($sql);
if (!$result) {
$errmsg = 'Invalid query: ' . mysql_error() . "\n";
$errmsg .= 'Whole query: ' . $sql;
debug($errmsg);
}
$data = mysql_fetch_array($result);
mysql_free_result($result);
$funcgroups = array('aminoacids','aminoalcohols','biotin','boronic','glycidols','indoles','isocyanates','pyrrolidines','wittigs');
foreach($funcgroups as $table) {
$sql = "SELECT catno FROM $table WHERE catno=".$catid;
$result = mysql_query($sql);
if($result){
if(mysql_num_rows($result)>0){
$funcgr[]=$table;
}
mysql_free_result($result);
}
}
?>