Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24214 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42442 invoked by uid 1010); 26 Jun 2006 07:10:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42426 invoked from network); 26 Jun 2006 07:10:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2006 07:10:08 -0000 X-PHP-List-Original-Sender: j.kuehne@sign-tronic.ch X-Host-Fingerprint: 213.200.222.28 cust.static.213-200-222-28.cybernet.ch Received: from ([213.200.222.28:54036] helo=mail.sign-tronic.ch) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 4D/AD-02438-E488F944 for ; Mon, 26 Jun 2006 03:10:07 -0400 Received: from [192.168.1.50] (helo=david.sign-tronic.ch) by fw-lx-nt-01 with esmtp (Exim 4.43) id 1FulER-0001H7-1j for internals@lists.php.net; Mon, 26 Jun 2006 09:10:03 +0200 To: internals@lists.php.net Date: Mon, 26 Jun 2006 07:10:03 +0000 Priority: normal X-Priority: 3 (Normal) Importance: normal X-Mailer: DvISE by Tobit Software, Germany (0228.434B4A4C454748504D4A), Mime Converter 101.20 X-David-Sym: 0 X-David-Flags: 0 Message-ID: <00004A56.449FA46A@david.sign-tronic.ch> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_000_00004A56.449FA46A" Subject: mysql-* versus db_* statements From: j.kuehne@sign-tronic.ch ------_=_NextPart_000_00004A56.449FA46A Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7Bit require_once "DB.php"; require_once "knowledge.inc"; require_once "template-new.inc"; function setupQuery($search_eb) { // Show the wines stocked at the winestore that match // the search criteria $query = "SELECT * FROM knowledge_db WHERE MATCH (autor,problem) AGAINST ('$search_eb') OR id = ('$search_eb') OR autor = ('$search_eb') OR stichwort = ('$search_eb') OR date_new = ('$search_eb') OR anlage = ('$search_eb')"; // Add region_name restriction if they've selected anything //$query .= "ORDER BY data_new"; return ($query); } error_reporting(E_ALL); // Show the user the knowledge that match their query function showKnowledges($connection, &$template) { // Produce a heading for the top of the page global $dsn; $template->setCurrentBlock(); $template->setVariable("SUCH-KRITERIUM","Such-Kriterium: {$_SESSION["searchFormVars"]["search_eb"]}"); $browseString = "search_eb=" . urlencode($_SESSION["searchFormVars"]["search_eb"]); $search = ($_SESSION["searchFormVars"]["search_eb"]); $link = mysql_connect("localhost", "root", "040573"); $template->parseCurrentBlock(); mysql_select_db("knowledge", $link); // Encode the search parameters for embedding in links to other pages // $connection = DB::connect($dsn, true); $query = setupQuery($_SESSION["searchFormVars"]["search_eb"]); //$result = $connection->query($query); //var_dump ($query); $result=@mysql_query($query); ... why I could not use the DB statement $result = $connection->query($query) instead of the mysql statement $result=@mysql_query($query); Further on, the same situation appears in the code, which looks like: for ( $rowCounter = 0; ($rowCounter < SEARCH_ROWS) && (( $rowCounter + $_SESSION["searchFormVars"]["offset"]) < mysql_num_rows($result)) && ($row = mysql_fetch_array($result)); //($row =mysql_fetch_row($_SESSION["searchFormVars"]["offset"]+$rowCounter)); // ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, $_SESSION["searchFormVars"]["offset"]+$rowCounter)); $rowCounter++) I could not use the DB statement ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, $_SESSION["searchFormVars"]["offset"]+$rowCounter)); instead of the mysql code ($row = mysql_fetch_array($result)). But in that case, there is not the same meaning between the msyql and DB statement. However, I need the DB assignation for faultless work. What can I do? best reagards, Georg ------_=_NextPart_000_00004A56.449FA46A--