Re: [PHP] need help with foreach
- From: dgh@xxxxxxxxxxxxx (Dave Hamber)
- Date: Tue, 31 Oct 2006 10:29:21 +0000
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
- References:
- need help with foreach
- From: melinem
- need help with foreach
- Prev by Date: Re: [PHP] only one at atime
- Next by Date: Re: [PHP] counting records in db
- Previous by thread: need help with foreach
- Next by thread: channels attribute value returns wrong
- Index(es):
Relevant Pages
|