Re: Problem in the returnvalue of a function

From: Date: Wed, 22 Jan 2003 00:55:24 +0000
Subject: Re: Problem in the returnvalue of a function
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-25043@lists.php.net to get a copy of this message
that means the result is not right, it happen when your query is failed,check your query, mysql_error() can help Ruprecht Helms writes:
Hi Bayu Susiloadhy, thanks for your answer.
function select_price($product_id,$quantity) {
--cut--
    return True;
}
--cut--
in the meentime I change the code that not a boolevalue was returned by the function. $q is my querystring and $db is the selected database. I insert the following: $db->query($q);
    $result=mysql_db_query($db,$q); 
    while ($row = mysql_fetch_object($result))
    {
        $price = $row->product_price;
    }
    mysql_free_result($result);
    echo "\n";
    echo $q;              // to show the sql-statement in runtime - diagnostics
    echo "\n";
    return $price; 
By executing it I get two warnings both "this is not a valid Mysql-result resort". The disliked lines are the begin of the while-loop and an the mysql_free_result($result)-command. How have I to change up the script to get the product_price related to the price_group. Regards, Ruprecht ---------------------------------- Ruprecht Helms IT-Service und Softwareentwicklung
Tel/Fax.:      +49[0]7621 16 99 16
Homepage: http://www.rheyn.de
email:          info@rheyn.de
---------------------------------- 
-- PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 
-- STOP doing things that the computer can does! -- &$BS

« previous php.db (#25043) next »