I cant seem to get this to return a number, just resource id #3.
this is my code that detects the users search and displays the appropriate.
It all works great except that the new count line doesn’t show a number.
[code=php]
$con = mysql_connect($mysql_host, $mysql_user, $mysql_password);
mysql_select_db($mysql_database, $con);
if ( isset ( $_SESSION[‘order’] )) $order = $_SESSION[‘order’]; else $order = ‘price’;
if ( isset ( $_SESSION[‘type’] ) && $_SESSION[‘type’] != ‘all’) $type = $_SESSION[‘type’]; else $type = null;
if ( isset ( $_SESSION[‘subtype’] )) $subtype = $_SESSION[‘subtype’]; else $subtype = null;
if ( isset ( $_SESSION[‘subsubtype’] )) $subsubtype = $_SESSION[‘subsubtype’]; else $subsubtype = null;
if ( isset ( $_SESSION[‘colour’] )) $colour = $_SESSION[‘colour’]; else $colour = null;
if ( isset ( $_SESSION[‘thickness’] )) $thickness = $_SESSION[‘thickness’]; else $thickness = null;
if ( isset ( $_SESSION[‘shape’] )) $shape = $_SESSION[‘shape’]; else $shape = null;
if (isset ($type)) $search = $search . ” WHERE type = ‘” . $type . “‘”;
if (isset ($subtype)) $search = $search . ” AND subtype = ‘” . $subtype . “‘”;
if (isset ($subsubtype)) $search = $search . “AND subsubtype = ‘” . $subsubtype . “‘”;
if (isset ($colour)) $search = $search . ” AND colour = ‘” . $colour . “‘”;
if (isset ($shape)) $search = $search . ” AND shape = ‘” . $shape . “‘”;
if (isset ($thickness)) $search = $search . ” AND thickness = ‘” . $thickness . “‘”;
$finalsearch = “SELECT * FROM Items ” . $search . ” ORDER BY ” . $order . ” DESC”;
$count = “SELECT COUNT(*) FROM Items ” . $search;
$itemcount = mysql_query($count);
$data = mysql_query($finalsearch);
echo “<br />” . $count . “–>” . $itemcount . “<br/>”;
return $data;}
the line “echo “<br />” . $count . “–>” . $itemcount . “<br/>”;”
returns :
SELECT COUNT(*) FROM Items WHERE type = ‘plecs’ AND subtype = ‘celluloid’ AND colour = ‘blue’–>Resource id #3
I think i’m just underslept again