krystof78 Posted November 27, 2009 Share Posted November 27, 2009 Hi there, I have a problem with a query: <?php $sql = "SELECT SUM(room_fee) FROM function_room WHERE event_id = '$sel_event[id]'"; $result = mysql_query($sql); echo "$result"; ?> When I perform this query in phpMyAdmin, I get the number I want but when I put that in one of the pages of my website, I get a "Resource id #12" instead. Any idea what I did wrong? Thanks for your answers. Cheers, Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 27, 2009 Share Posted November 27, 2009 You have to fetch data from $result. See examples here mysql_query Quote Link to comment Share on other sites More sharing options...
krystof78 Posted November 27, 2009 Author Share Posted November 27, 2009 Actually, I found the solution right after posting here. Here is what I did if it can help some people: <?php $sql = "SELECT SUM(bedroom_total) FROM bedrooms WHERE event_id='$sel_event[id]'"; $result = mysql_query($sql); $r = mysql_fetch_row($result); echo "$r[0]"; ?> Thanks anyway! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.