Simple PHP problem... HELP!!!

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

HeyGeek

Established Member
Impact
8
Hi,
I need some help badly.
I have the following code:
PHP:
  <?php
	while ($row = mysql_fetch_assoc($result))
	    if($row['type'] == 0){
		if($row['client_id'] == $client_id){
		if($row['active'] == 1){
			echo '<tr bgcolor="f0f2ee">';
			echo '<td bgcolor="#CCCCCC"><a href=projectmain.php?id='. $row['contest_id'] . ' target=_self> Custom Website Design for ' . $row['name'] .'</a></td>';
			echo '<td bgcolor="#CCCCCC"><div align="center">' . $row['comments'] .'</div></td>';
			echo "</tr>\n";

		}
		
		}

	}

?>

Now all that I want to do is add a second bunch of commands in there that checks to see if the same variables are met (type, client_id and active) but with the difference being that the "type" variable has a value of "1", the script would then display more html if that variable is met.

To simplify this: I need the script to first check if the first set of conditions is met: type=0 client_id = client_id and active=1
and then display some html if those conditions are met,
and then check and see if further conditions are met type=1 client_id = client_id and active=1
and then display more html if those conditions are met.

I hope I am being clear enough, I am modifiying this script and have NO clue how to do this, I have tried about 234 different things to no avail, if someone could hack together a quick fix and post it I would really appreciate it.

Thanks in advance.
George
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
PHP:
<?php

while ($row = mysql_fetch_assoc($result))
{
	if ($row['type'] == 0 AND $row['client_id'] == $client_id AND $row['active'] == 1)
	{
		echo '
	<tr bgcolor="f0f2ee">
		<td bgcolor="#CCCCCC"><a href="projectmain.php?id=' . $row['contest_id'] . '" target="_self">Custom Website Design for ' . $row['name'] .'</a></td>
		<td bgcolor="#CCCCCC"><div align="center">' . $row['comments'] .'</div></td>
	</tr>
';
	}
	else if ($row['type'] == 1 AND $row['client_id'] == $client_id AND $row['active'] == 1)
	{
		//
	}
}

?>

or even..

PHP:
<?php

while ($row = mysql_fetch_assoc($result))
{
	if ($row['client_id'] == $client_id AND $row['active'] == 1)
	{
		switch ($row['type'])
		{
			case 0:
				echo '
	<tr bgcolor="f0f2ee">
		<td bgcolor="#CCCCCC"><a href="projectmain.php?id=' . $row['contest_id'] . '" target="_self">Custom Website Design for ' . $row['name'] .'</a></td>
		<td bgcolor="#CCCCCC"><div align="center">' . $row['comments'] .'</div></td>
	</tr>
';
				break;
			case 1:
				//
				break;
		}
	}
}

?>
 
1
Close
Thanks a million! +Rep given. I really appreciate it.
George
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back