returns assoc array //c -> just returns num of rows $ary = array(); $dbconnect = new mysqli('localhost', 'ecoszzqh_webadm', '3xFu5naX-[3.', 'ecoszzqh_webadm'); $res = $dbconnect->query($sql); if (!$res){ echo '

Error with following sql: $sql

'; return $ary; } while ($row = $res->fetch_assoc()) { if ($f == "a"){ $ary[] = $row; } else { $ary[] = array_values($row); } } if ($f == "c"){ return count($ary); } else { return $ary; } } $dnum = date(Ymd)*4; $error_report="off";//on or off turn on to get error reports at bottom of page $from = $_GET['fr']; if($from == ""){ $from = $_POST['fr']; } if($from != $dnum){ echo("

<<<<Restricted Area>>>>" . "
Sorry, you must Log In to view this Page

"); exit(); } $usrn = $_GET['usrn']; if($usrn == ""){ $usrn = $_POST['usrn']; } if($usrn == ""){ echo("

<<<<Restricted Area>>>>" . "
Problem with your username. Please Log In again.

"); exit(); } $catselected=$_POST['catselect']; $searchit=$_POST['searchy']; /* $dbcnx = @mysql_connect('mysql.plainhost.com', 'ecosmar_ecosmart', 'ecoman1'); mysql_select_db('ecosmar_website', $dbcnx); $getcats=mysql_query("SELECT category FROM repdocs ORDER BY category"); if(!$getcats){ $airs[]="Could not retrieve Category List. ".mysql_error(); }else{ while($cats=mysql_fetch_array($getcats)){ $allcats[]=$cats[0]; }//while getting $catsonly = array_unique($allcats); }//gotcats */ $allcats = array(); $getcats=dbq("SELECT category FROM repdocs ORDER BY category"); foreach($getcats as $row){ $allcats[]=$row[0]; } $catsonly = array_unique($allcats); ?>
Return to your page Eco-$mart On-line Administration

My Page

Eco-$mart Downloads     Click to Open or Right Click and Click "Save Target As...".
" . "
" . "" . "" . "" . "" . "
"); }//not selected else{ if($searchit==""){ echo("" . "
$value
"); }else{//searchitisnotblank echo("" . "
" . "" . "" . "" . "" . "
"); }//searchitisnotblank }//selected }//4each echo("" . "
" . "" . "" . "" . "" . "
"); ?>
" . "
Search for: " . "" . "" . "" . "" . "
"); if($searchit!=""){ $serge=dbq("SELECT ID,category,title,link,description,type FROM repdocs WHERE title LIKE '%$searchit%' ORDER BY title ASC", "a"); if(count($serge) == 0){ echo("" . "
" . "No Search Results for : $searchit" . "
"); }else{ echo("" . "
" . count($serge) . " Search Results for: "$searchit"" . "
"); $a=1; foreach($serge as $row){ $bakko= $a/2; if(is_int($bakko)){ $tdbg="#eeeeee"; }else{ $tdbg="#FFFFFF"; }//cellalternate color $ID=$row['ID']; $category=$row['category']; $title=$row['title']; $link=$row['link']; $description=$row['description']; $type=$row['type']; echo("" . "
" . "$title" . " -- Category: $category -- $type -- $description" . "
"); $a=$a+1; }//whilegettingserges }//there are rows }//searchison else{//searchyisblank if($catselected!=""){//there is a category selected echo("" . "
" . "$catselected
"); $getit=dbq("SELECT ID,category,title,link,description,type FROM repdocs WHERE category='$catselected' ORDER BY title ASC", "a"); if (count($getit) == 0){ echo("" . "
" . "No Titles in Category $catselected" . "
"); }else{ $a=1; foreach($getit as $row){ $bakko=$a/2; if(is_int($bakko)){ $tdbg="#eeeeee"; }else{ $tdbg="#FFFFFF"; }//cellalternate color $ID=$row['ID']; $category=$row['category']; $title=$row['title']; $link=$row['link']; $description=$row['description']; $type=$row['type']; echo("" . "
" . "$title" . " -- $type -- $description" . "
"); $a=$a+1; }//whilegettingit }//there are rows }//there is a category selected else{//no category selected-- getallbycategory echo("" . "
" . "All Files
"); foreach($catsonly as $value){ echo("" . "
" . "$value
"); $whatsit=dbq("SELECT ID,category,title,link,description,type FROM repdocs WHERE category='$value' ORDER BY title ASC", "a"); if(count($whatsit) == 0){ echo("" . "
" . "No $value Files in Data Base" . "
"); }else{ $a=1; foreach($whatsit as $row){ $bakko=$a/2; if(is_int($bakko)){ $tdbg="#eeeeee"; }else{ $tdbg="#FFFFFF"; }//cellalternate color $ID=$row['ID']; $category=$row['category']; $title=$row['title']; $link=$row['link']; $description=$row['description']; $type=$row['type']; echo("" . "
" . "$title" . " -- $type -- $description" . "
"); $a=$a+1; }//whilegettingwhatsit }//there are rows }//4each }//no category selected }//searchyisblank ?>
" . "
" . "" . "" . "" . "" . "
"); }//not selected else{ if($searchit==""){ echo("" . "
$value
"); }else{//searchitisnotblank echo("" . "
" . "" . "" . "" . "" . "
"); }//searchitisnotblank }//selected }//4each echo("" . "
" . "" . "" . "" . "" . "
"); ?>

 

Eco-$mart Downloads
©2010 - Data Base Interface - Custom Built at: kwgrubbs.com
"); } }//airs not empty }//error_report is on ?>