> $p = addslashes(strip_tags($_GET['p'])); //same as $s, but will hold the end point for the query e.g., 60 << NOT USED YET! >> $sp_page['body'] = ""; db_login(); //function to login to database if (!$c) { $sql = "SELECT id,description,title,name,count,category FROM sa_page WHERE public = 'yes' ORDER BY id DESC LIMIT " . $cfg['main_max']; //no value for $c, so no category selected, latest 5 $text_latest = "Latest " . $cfg['main_max'] . " Articles
\n"; } else { $sql = "SELECT id,description,title,name,count,category FROM sa_page WHERE category = '$c' && public = 'yes' ORDER BY id DESC"; //fixed a bug that only displayed the last 5 articles when a category was selected; it should display all $page_title = "» " . stripslashes($c); $page_where = "» " . stripslashes($c) . ""; $text_latest = "Showing all Articles in " . stripslashes($c) . "
\n"; } $cat_sql = "SELECT name FROM sa_category"; $cat = @mysql_query($cat_sql) or die("Getting Categories error: " . mysql_error()); $category = mysql_num_rows($cat); if ($category == "0") { // echo "ERROR: No categories in database!"; } else { $sp_page['body'] = $sp_page['body'] . "
\n \n
\n"; } $query = @mysql_query($sql) or die("mySQL error: " . mysql_error()); //executes the query, and if there is an error, die and report the error $r = mysql_num_rows($query); if (!$r) { //none $sp_page['body'] = $sp_page['body'] . "No articles in database, if you selected a category than it is empty."; } else { //some found $sp_page['body'] = $sp_page['body'] . " "; //$sp_page['body'] = $sp_page['body'] . $text_latest . "