Re: [PHP] need help with foreach



Its not very clear what you want to achieve with that code snippet.

If you are pulling database rows out of your database with mysql_fetch_array(), then you do not need a foreach loop.

I think you may want something like this, but without knowing your database table structure and the query you have used it is only a guess.

while($row = mysql_fetch_array($result2,MYSQL_ASSOC)){

echo "<a href=client.php?art=".$row['pix']." border='0'>{$row['jobType']}</a>\n";
if($row['url']!='')echo "html to use with ".$row['url'];

}


On 31/10/2006 10:09 melinem@xxxxxxxxxxxxx wrote:
I want to tell the server to do 2 things when I click on the "jobType" link.

This is the code that I have now which displays the "art" when I click on "jobType"

foreach($row as $jobType)
{
$row = mysql_fetch_array($result2,MYSQL_ASSOC);
echo "<a href=client.php?art=".$row['pix']." border='0'>{$row['jobType']}</a>\n";
}

I now want to, with the same click, also show the url if I have a url for that "jobType" in my database column called "url".

Thank you for any help.

--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



.



Relevant Pages

  • Pull method for sqlceremotedataaccess
    ... catch (SqlCeException ce) ... private static void CreateDatabase() ... // Pull down the authors table from the pubs database on the remote ... internetUrl in the code snippet without any error ...
    (microsoft.public.sqlserver.ce)
  • pull method
    ... catch (SqlCeException ce) ... private static void CreateDatabase() ... // Pull down the authors table from the pubs database on the remote ... internetUrl in the code snippet without any error ...
    (microsoft.public.sqlserver.replication)
  • Re: Populate dataset with text file
    ... I have found this code snippet on about.com, but it does not work for me ... Connect a TADOCommand to your database using the ConnectionString or the ... >> populate a memo control in less than a second. ...
    (borland.public.delphi.database.ado)
  • Re: import from text file, change rowstate
    ... > means they won't add to the database during dataadapter.update. ... Can someone toss me a code snippet? ... > 1) Change connection on the dataadapter to my Access database ...
    (microsoft.public.dotnet.framework.adonet)
  • import from text file, change rowstate
    ... Can someone toss me a code snippet? ... database is never updated because all rows are ... Change connection on the dataadapter to my Access database ...
    (microsoft.public.dotnet.framework.adonet)