Reply to Else If

Your name:

Reply:


Posted by sales on 11/30/07 16:07

Am trying Else-If but encounter a problem (newbie question, sorry)

Step 1 - Create selection of companies ordered by a priority number.

$query = "SELECT company, priority FROM foo1 WHERE foo2 AND priority
IN
('0', '1', '2') ORDER BY priority";

$result = mysql_query($query) or die ('Error in query: $query . ' .
mysql_error());
while($row = mysql_fetch_object($result))

Step 2 - I want to output the data in differing table formats
depending upon each of the priority numbers - hence Else If. Am just
displaying the variable values below for simplicity.

{
$priority = $row['priority'];
$company = $row['company'];

if ($priority == '0')
{
echo $company;
echo $priority;
}

elseif ($priority == '1')
{
echo $company;
echo $priority;
}

elseif ($priority == '2')
{
echo $company;
echo $priority;
}

}

The ElseIf however does not recognise if $priority equals either 1 or
2, even though it does, and it outputs only the condition for if
($priority == '0')

What am I doing wrong?????

Thanks

Alec

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация