ronnie88 Posted May 15, 2008 Share Posted May 15, 2008 <? include ("header.php"); global $database_tbl_prefix; $ferry = new Ferry(); $ferries = $ferry->getAll(); echo "<script language=\"javascript\">\n"; echo "function openpopup(\$id){\n"; for ($i = 1; $i <= sizeof($ferries); $i++) { echo "if (\$id == $i) {"; echo "var popurl=\"ferrydetail.php?id=$i\";\n"; echo "}\n"; } echo "winpops=window.open(popurl,\"\",\"width=400,height=338,scrollbars,\")\n"; echo "}\n"; echo "</script>\n"; ?> <div class="content2"> <div class="content2-pagetitle">Ferry Activity</div> <div class="content-txtbox-noshade"> <div class="content-title-noshade-size2">List Ferry</div> <table> <tr> <th>Dep. Code</th> <th>Arr. Code</th> <th>Aircraft</th> <th>Type</th> <th>Deadline</th> <th>Pilot</th> <th></th> <th></th> <? if ($isadminuser == '1') { ?> <th></th> <th></th> <th></th> <? } echo "</tr>\n"; foreach ($ferries as $g) { $this_pilotname = get_pilotnamefromid($g['bookedby']); $t = get_datefromutc($g['deadline']); $deadline = $t; ?> <tr> <td><? echo $g['depart_code'] ?></td> <td><? echo $g['arrive_code'] ?></td> <td><? echo $g['aircraft'] ?></td> <td><? echo $g['ferry_type'] ?></td> <td><? echo $deadline ?></td> <td><? echo $this_pilotname ?></td> <td><a href="javascript:openpopup(<? echo $g['id'] ?>)">Details</a></td> <? if ($f['complete'] == '0') { if ($g['bookedby'] == '0') { // if this ferry is not taken by another echo "<td><a href =\"do_add.php?type=takeferry&id=".$g['id']."\">take</a></td>"; } else { echo "<td></td>"; } } else { ?> <td></td> <? } if ($isadminuser == '1') { if ($complete == '1') { echo "<td>DONE</td>"; } else { echo "<td></td>"; } ?> <td><a href="do_delete.php?id=<? echo $g['id'] ?>&table=ferry&form=listferry" onClick="return confirm('Confirm Delete of this item');"><img border="0" src="/vadminicons/item_delete.png" alt="delete"/></a></td> <? } echo "</tr>"; } ?> </table> </div> </div> <? include ("footer.php"); ?> Im getting an invalid argument on line 61 which is: foreach ($ferries as $g) { any ideas thanks very much Link to comment https://forums.phpfreaks.com/topic/105803-invalid-argument-on-line-61/ Share on other sites More sharing options...
947740 Posted May 15, 2008 Share Posted May 15, 2008 You need to set $g => to something, usually a variable. Link to comment https://forums.phpfreaks.com/topic/105803-invalid-argument-on-line-61/#findComment-542221 Share on other sites More sharing options...
kenrbnsn Posted May 15, 2008 Share Posted May 15, 2008 No you don't. You only need the construct "$k=>$v" if you want to used the index values of the array. Does $ferries contain an array? Ken Link to comment https://forums.phpfreaks.com/topic/105803-invalid-argument-on-line-61/#findComment-542229 Share on other sites More sharing options...
ronnie88 Posted May 15, 2008 Author Share Posted May 15, 2008 well $ferries is at the top its refering to $ferry. $ferries = $ferry->getAll(); Link to comment https://forums.phpfreaks.com/topic/105803-invalid-argument-on-line-61/#findComment-542248 Share on other sites More sharing options...
ronnie88 Posted May 15, 2008 Author Share Posted May 15, 2008 [move]sorry for the double post, but any ideas?[/move] Link to comment https://forums.phpfreaks.com/topic/105803-invalid-argument-on-line-61/#findComment-542286 Share on other sites More sharing options...
DarkWater Posted May 15, 2008 Share Posted May 15, 2008 Using an annoying marquee doesn't make us want to help any more than we would if you DIDN'T use an annoying marquee. Try this: print_r($ferries); After the line where you call getAll() to make sure it's being set as an array properly. Link to comment https://forums.phpfreaks.com/topic/105803-invalid-argument-on-line-61/#findComment-542297 Share on other sites More sharing options...
jt Posted May 15, 2008 Share Posted May 15, 2008 do a print_r($ferries); after you call the getAll() function and make sure an array is being returned Edit: DarkWater beat me to it... Link to comment https://forums.phpfreaks.com/topic/105803-invalid-argument-on-line-61/#findComment-542299 Share on other sites More sharing options...
ronnie88 Posted May 15, 2008 Author Share Posted May 15, 2008 $ferries = $ferry->getAll(); print_r($ferries); i tried this. still doesn't work Link to comment https://forums.phpfreaks.com/topic/105803-invalid-argument-on-line-61/#findComment-542341 Share on other sites More sharing options...
jt Posted May 15, 2008 Share Posted May 15, 2008 Quote $ferries = $ferry->getAll(); print_r($ferries); i tried this. still doesn't work what is the output of the print_r Link to comment https://forums.phpfreaks.com/topic/105803-invalid-argument-on-line-61/#findComment-542346 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.