Jump to content

svital

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

svital's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That works great. Thanks very much for sharing!!! Best Regards, Sondra
  2. I am using Dreamweaver CS3 to connect to a MySQL database and do a search. Dreamweaver created the code for me, but I need to enhance the function to include an error check which handles a "no results found". Everything I have tried has caused the page to not display at all? I have no idea how to change my little script to include this? Can anyone help? This is the code from the searchresults.php ****************CODE**************************** <?php require_once('../Connections/MySQL2.php'); ?> <?php $currentPage = $_SERVER["PHP_SELF"]; $colname_search = "-1"; if (isset($_GET['title'])) { $colname_search = (get_magic_quotes_gpc()) ? $_GET['title'] : addslashes($_GET['title']); } mysql_select_db($database_MySQL2, $MySQL2); $query_search = sprintf("SELECT * FROM items WHERE description LIKE '%%%s%%' ORDER BY items.Description", $colname_search); $search = mysql_query($query_search, $MySQL2) or die(mysql_error()); $row_search = mysql_fetch_assoc($search); $totalRows_search = mysql_num_rows($search); $queryString_Desription = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Desription") == false && stristr($param, "totalRows_Desription") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Desription = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Desription = sprintf("&totalRows_Desription=%d%s", $totalRows_Desription, $queryString_Desription); ?> <?php require_once('../Connections/MySQL2.php'); ?> .... <?php do { ?> <table width="50%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="style5"><?php echo $row_search['Description']; ?></td> </tr> </table> <?php } while ($row_search = mysql_fetch_assoc($search)); ?> *****************END CODE****************************************
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.