ryy705 Posted June 4, 2008 Share Posted June 4, 2008 Hello, Hello, mysq_query($query) returns a valid result set. However, calling my custom function query() returns a 1. For example: <?php include('connection.php'); $query = "select field from table where field='f1'"; echo mysql_query($query); echo query($query); function query($sql) { return mysql_query($sql); } ?> mysql_query() will echo resouce id #7 and query() will echo 1. I can't Figure out why. Does any know how to pass a mysql result set? Many thanks in advance . Link to comment https://forums.phpfreaks.com/topic/108713-solved-how-to-return-a-mysql-result-set/ Share on other sites More sharing options...
GingerRobot Posted June 4, 2008 Share Posted June 4, 2008 Is that the exact code you are using? Both return a result resource for me. Link to comment https://forums.phpfreaks.com/topic/108713-solved-how-to-return-a-mysql-result-set/#findComment-557493 Share on other sites More sharing options...
ryy705 Posted June 4, 2008 Author Share Posted June 4, 2008 Thanks for your reply, I just changed the name of the field and the name of the table. Do you suppose it has something to do with the php installation settings? Link to comment https://forums.phpfreaks.com/topic/108713-solved-how-to-return-a-mysql-result-set/#findComment-557530 Share on other sites More sharing options...
ryy705 Posted June 4, 2008 Author Share Posted June 4, 2008 Found the problem. I had or die('Query failed. ' . mysql_error()) tacked on the function thats why it wasn't working. Thanks. Link to comment https://forums.phpfreaks.com/topic/108713-solved-how-to-return-a-mysql-result-set/#findComment-557534 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.