gos1 Posted December 12, 2006 Share Posted December 12, 2006 hi. I need some help on including a function. [code]function echo_rooms_button(){ $get_room_types_qr = "SELECT * FROM rooms"; $get_room_types = mysql_query($get_room_types_qr); for($i =0 ; $i < mysql_num_rows($get_room_types); $i++) { $type = mysql_result($get_room_types,$i,"type"); $fee = mysql_result($get_room_types,$i,"fee"); print '<label>'.$type.'->'. $fee.' <input name="rooms" type="radio" value="'.$type.'" /> </label><br> '; }}[/code]here is the function I like to include but when I echo a text and this function the output of the function appears always on top. ex: [code]echo "a text here".echo_rooms_button();[/code]I got first the echo_rooms_button()'s output and then the a text here. But when I try this with time() function I got firstly the text and then the time() functions output. Can anyone help me what is wrong with my function ?? Quote Link to comment Share on other sites More sharing options...
taith Posted December 12, 2006 Share Posted December 12, 2006 [code]function echo_rooms_button(){ $get_room_types_qr = "SELECT * FROM rooms"; $get_room_types = mysql_query($get_room_types_qr); for($i =0 ; $i < mysql_num_rows($get_room_types); $i++){ $type = mysql_result($get_room_types,$i,"type"); $fee = mysql_result($get_room_types,$i,"fee"); $retun .= '<label>'.$type.'->'.$fee.'<input name="rooms" type="radio" value="'.$type.'" /></label><br>'; } return $return;}[/code] Quote Link to comment Share on other sites More sharing options...
gos1 Posted December 12, 2006 Author Share Posted December 12, 2006 I used that function exactly and returned no result. Nothing echoed. I am using this function in a variablle like [code]$comment = '<br><tr><td>'.echo_rooms_button().'</td></tr>';echo $comment;[/code]but the function did not echoed anything in the file. Quote Link to comment Share on other sites More sharing options...
gos1 Posted December 12, 2006 Author Share Posted December 12, 2006 solved the problem. I pasted the code and $return and $retun are not the same :D. Thanks a lot for solving my problem.[b][/b] Quote Link to comment Share on other sites More sharing options...
taith Posted December 12, 2006 Share Posted December 12, 2006 sorry... typo[code]function echo_rooms_button(){ $get_room_types_qr = "SELECT * FROM rooms"; $get_room_types = mysql_query($get_room_types_qr); for($i =0 ; $i < mysql_num_rows($get_room_types); $i++){ $type = mysql_result($get_room_types,$i,"type"); $fee = mysql_result($get_room_types,$i,"fee"); $return .= '<label>'.$type.'->'.$fee.'<input name="rooms" type="radio" value="'.$type.'" /></label><br>'; } return $return;}[/code] 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.