Guest 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, Link to comment https://forums.phpfreaks.com/topic/183133-resource-id-12-issue/ 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 Link to comment https://forums.phpfreaks.com/topic/183133-resource-id-12-issue/#findComment-966489 Share on other sites More sharing options...
Guest Posted November 27, 2009 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! Link to comment https://forums.phpfreaks.com/topic/183133-resource-id-12-issue/#findComment-966493 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.