It's currently a little bit late in the US and you only waited 2 hours since your last post. While this is an international list the majority of the posters are US based. Not getting a response within two hours at this time is not unusual and you should probably be more patient. As for your problem, what is DB.php? Is it the pear DB class? You can't mix mysql functions and pear DB functions like you are doing. You should choose one or the other and stick with it, mixing them is just trouble. As for your final statement, you can do everything with the built in mysql functions that you can using DB.php. DB.php simply wraps the mysql calls. If you choose to go the DB route, you should probably try the pear list, and try waiting more than two hours before complaining. David j.kuehne@xxxxxxxxxxxxxx wrote: > Could someone explain the behaviour of the following code fragments. I have a serious problem with db-statements. > > ############################################################################################## > ############################################################################################## > > >>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 >> >> > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php