Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24215 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93404 invoked by uid 1010); 26 Jun 2006 07:41:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 93388 invoked from network); 26 Jun 2006 07:41:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2006 07:41:23 -0000 X-PHP-List-Original-Sender: antony@zend.com X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:50971] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 79/50-44237-33A8F944 for ; Mon, 26 Jun 2006 03:18:13 -0400 Received: (qmail 17368 invoked from network); 26 Jun 2006 07:17:27 -0000 Received: from internal.zend.office (HELO ?127.0.0.1?) (10.1.1.1) by internal.zend.office with SMTP; 26 Jun 2006 07:17:27 -0000 Message-ID: <449F8A33.1010006@zend.com> Date: Mon, 26 Jun 2006 11:18:11 +0400 User-Agent: Thunderbird 1.5.0.4 (X11/20060516) MIME-Version: 1.0 To: j.kuehne@sign-tronic.ch CC: internals@lists.php.net References: <00004A56.449FA46A@david.sign-tronic.ch> In-Reply-To: <00004A56.449FA46A@david.sign-tronic.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] mysql-* versus db_* statements From: antony@zend.com (Antony Dovgal) Please user php-general@lists.php.net for such questions. Thank you. On 26.06.2006 11:10, j.kuehne@sign-tronic.ch wrote: > 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 > > -- Wbr, Antony Dovgal