I am trying to fix this query where the first entry to the table is given a page number of 12 (the first 10 pages is the cover and adverts). Once the first page has been entered, then the pages increase by 2 every time. The original query was:
$get_max_page=mysql_query("SELECT MAX(page_no) as Page FROM `lots`");
if(mysql_num_rows($get_max_page)>0)
{
$page_row=mysql_fetch_array($get_max_page);
$page_no=$page_row['Page']+2;
}else{
$page_no=12;
}
After considerable reviewing and changing, my latest version is, but still not working, is:
$get_max_page=mysql_query("SELECT MAX(page_no) AS get_max_page FROM lots");
if(mysql_fetch_array($get_max_page)!=NULL)
{
$page_row=mysql_fetch_array($get_max_page);
$page_no=$page_row['Page']+2;
}else{
$page_no=12;
}
Can anyone give suggestion on how this could work please as the first entry continually gives a page number of 2.