Re: Newbie - help with a foreach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jan 18, 2007, at 2:00 AM, Németh Zoltán wrote:

ok, but how could anyone help without seeing your code?

greets
Zoltán Németh

Here is the code:

Here is the entire page:

<!-- nav/box 1 starts here -->



<?php
  include("../include/etc_inc.php");

  $connection = mysql_connect($host,$user,$password)
       			or die ("couldn't connect to server");
	
// connect to database	   	
  $db = mysql_select_db($database,$connection)
       			or die ("Couldn't select database");

// query a from client	
  $query = "SELECT * FROM client
				where status='active' or status='old'
				order by companyName";
				
	$result = mysql_query($query)
	or die ("Couldn't execute query");
		
  while 	($aaa = mysql_fetch_array($result,MYSQL_ASSOC))
  {  			
echo "<span class='navCompany'>{$aaa['companyName']}</span><span class='navArrow'> > </span>\n";

// query b from job
	$query = "SELECT * FROM job
				WHERE companyId='{$aaa['companyId']}'";
  	$result2 = mysql_query($query)
		or die ("Couldn't execute query b");

			foreach($aaa as $jobType)
			{
			$bbb = mysql_fetch_array($result2,MYSQL_ASSOC);
echo "<span class='navText'><a href='single_page_t2.php?art=".$bbb ['pix']."'>{$bbb['jobType']}</a></span>\n";

			}					

	echo "<br>";
	}			
	?>
	


<!-- nav/box 1 ends here -->



</div>	
<div class="navbox2"><img src="images/sq_logo_137.gif" alt="Square Inch logo" width="137" height="137"></div>

<div class="navbox3"><?php $image = $_GET['art']; ?>
<img src="images/<?php print ($image) ?>" alt="Portfolio Item" border="0" width="285" height="285"></div>



<div class="navbox4">




<!-- info/box 4 starts here -->
<?php
/* query 1 from client */
$query = "SELECT * FROM client
			where status='active' or status='old'
			order by companyName";
				
  	$result = mysql_query($query)
	or die ("Couldn't execute query");

while 	($row = mysql_fetch_array($result,MYSQL_ASSOC))
{  			
			
/* query 2 from job */
$query = "SELECT * FROM job
				WHERE companyId='{$row['companyId']}'";
  		$result2 = mysql_query($query)
		or die ("Couldn't execute query2");
		$url = mysql_query($result2);
		
	foreach($row as $url)
		{
		$row = mysql_fetch_array($result2,MYSQL_ASSOC);
		if ("url={$row['url']}")			
echo "<span class='navText'><a href='{$row['url']}'>{$row['web']}</ a></span>";
		}

	echo "<br>";	
	}
	?>


<!-- info/box 4 ends here -->





On cs, 2007-01-18 at 01:54 -0800, pub wrote:
Thank you for your reply.

My problem is that the web addresses on the bottom right show at all
times as is instead of appearing only when active or selected on the
left top navigation!

Does that make sense?

On Jan 18, 2007, at 1:43 AM, Németh Zoltán wrote:

I can't really understand what your problem is, because it seems to me
that the site is working like you want it to work. Or not?

And if there is a problem with the code then please show us the code
somehow, not the resulting webpage

greets
Zoltán Németh

On cs, 2007-01-18 at 01:31 -0800, pub wrote:
Could someone please help me figure out how to hide the info in the
right bottom part of my page unless the corresponding link is
selected in the top left.

The company names and job types at the top left need to show at all
time. But the corresponding picture at the bottom left and the web
address/info at the bottom right should appear only when selected.

I have the same query repeating twice once for the top left part and once for the bottom right part because I can't figure out how else to
do it!

Thank you.

http://www.squareinch.net/single_page_t2.php?art=btw_logo.jpg

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




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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux