-------- Original Message -------- Subject: Re: [PHP-DEV] mysql-* versus db_* statements (26-Jun-2006 9:21) From: antony@xxxxxxxx To: j.kuehne@xxxxxxxxxxxxxx Please user php-general@xxxxxxxxxxxxx for such questions. Thank you. On 26.06.2006 11:10, j.kuehne@xxxxxxxxxxxxxx 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php