the_oliver Posted June 9, 2007 Share Posted June 9, 2007 Hello, Can someone tell me what im doing wrong with the code bellow please? I get print_ticket called lots of times, with 1 as the hash,name,ticket_no responce. (i have chequed that the query is returning the right results). $return = pg_query($pg_connection, $query); $data = pg_fetch_array($return); foreach ( $data as $temp ) { echo print_ticket ($temp['hash'],$temp['name'],$temp['ticket_no']); } Quote Link to comment https://forums.phpfreaks.com/topic/54902-solved-multiple-items-in-foreach/ Share on other sites More sharing options...
wildteen88 Posted June 9, 2007 Share Posted June 9, 2007 Try a while loop $return = pg_query($pg_connection, $query); while ( $data = pg_fetch_array($return)) { echo print_ticket ($data['hash'], $data['name'], $data['ticket_no']); } Quote Link to comment https://forums.phpfreaks.com/topic/54902-solved-multiple-items-in-foreach/#findComment-271530 Share on other sites More sharing options...
the_oliver Posted June 9, 2007 Author Share Posted June 9, 2007 Perfect. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/54902-solved-multiple-items-in-foreach/#findComment-271532 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.