On Friday 07 June 2002 14:27, Peter Goggin wrote: > Following my earlier message I had some replies which suggested a way to > solve my problem. Unfortuantelu I cannot seem to get the suggested code to > work. This may well be because I have mistyoed something.
OK we'll work back to front on this one. > Is there any documentation which directly relates to using PHP with MySQL? Yes. Loads. Really. google -> "mysql php tutorial" should turn up bucket loads of the stuff. > The screen displays the icons and the connection message but nothing else It's good to isolate the parts of the log which indicates the error on hand > The error log from apache is: > [Fri Jun 07 16:07:55 2002] [info] Parent: Created child process -1734187 > [Fri Jun 07 16:07:55 2002] [info] Parent: Duplicating socket 104 and > sending it to child process -1734187 > [Fri Jun 07 16:07:56 2002] [info] BytesRead = 372 WSAProtocolInfo = 020 Which is really just this one line: > [Fri Jun 07 16:08:38 2002] [error] PHP Warning: Invalid argument supplied > for foreach() in c:\usr\www\my-domain\cataloguerangeslist.php on line 27 And again because you ran the script again: > [Fri Jun 07 16:09:43 2002] [error] PHP Warning: Invalid argument supplied > for foreach() in c:\usr\www\my-domain\cataloguerangeslist.php on line 27 The error suggests something is wrong on line 27. Which is this part here: > foreach($result as $row){ > echo '<tr><td><a > href="delete.php?id='.$row[catalogue_range_key].'">'.$row[sg_start_number]. >' </a></td></tr>'; > } Please in future if the error messages mention a line number, _do_ indicate on your code which line that is. OK the error says that the argument(s) supplied to foreach is incorrect. Reading the manual entry for foreach() should reveal that the argument in question is $result. Where is $result being set? Here: > $result = mysql_query("SELECT * FROM CATALOGUE_RANGES"); Reading the manual entry for mysql_query() reveals that it returns a "resource identifier". Further it says " mysql_query() returns a new result identifier that you can pass to mysql_fetch_array() and other functions dealing with result tables". > Can anyone please tell me what the problem is. Basically as it stands, $result is a pointer to a set of results returned from the DB. To get at the actual results themselves you need to run mysql_fetch_array() (or similar, see manual). -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* This week only, all our fiber-fill jackets are marked down! */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php