zahidrahim
asked on
Only variable references should be returned by reference in ...........
Helloo
I have an application which developed in php4.4.0 now i am trying to upgrade it to php5.1.4
//Class File
class Database{
function &dbquery($sql){
/*
i have commented all code
*/
}
}
Now another calling file:
$vigappsdb = new Database();
$sql_query = "INSERT INTO VEHICLE (VEHICLE_NAME) VALUES ('$vehicle_name')";
$vresult=$vigappsdb->dbque ry($sql_qu ery);
it is generating notic:
Notice: Only variable references should be returned by reference in..............
Thanx in advance
I have an application which developed in php4.4.0 now i am trying to upgrade it to php5.1.4
//Class File
class Database{
function &dbquery($sql){
/*
i have commented all code
*/
}
}
Now another calling file:
$vigappsdb = new Database();
$sql_query = "INSERT INTO VEHICLE (VEHICLE_NAME) VALUES ('$vehicle_name')";
$vresult=$vigappsdb->dbque
it is generating notic:
Notice: Only variable references should be returned by reference in..............
Thanx in advance
ASKER
well i commente or uncomment code in the function it still raises same error message
so what can be the solution????
so what can be the solution????
Try removing the & from the function
change
=====================
function &dbquery($sql){
=====================
to
=====================
function dbquery($sql){
=====================
change
=====================
function &dbquery($sql){
=====================
to
=====================
function dbquery($sql){
=====================
ASKER
it does not produce the desired results then.
Well it is only a notice so there is no reason why you have to do anything about it but these things have a nasty habit of coming back and biting you later on.
The only thing I can suggest is that you change your error_reporting level to exclude notices or rewrite your class so that it doesent return by reference.
The only thing I can suggest is that you change your error_reporting level to exclude notices or rewrite your class so that it doesent return by reference.
ASKER
yes u r very much right, but still is there no solution to this notice :( i want my code 100% accurate.........
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Quite a lot has been changed in php 5 class wise.
Try
$vigappsdb = new Database;
$sql_query = "INSERT INTO VEHICLE (VEHICLE_NAME) VALUES ('$vehicle_name')";
$vresult=$vigappsdb->dbque
BUT by the notice I would conclude that its having issues with the & in front of the function name.
function &dbquery($sql){
This indicates that the return value is passed by reference.