code not working properly

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
swapna10
Forum Newbie
Posts: 2
Joined: Tue Mar 20, 2012 5:08 pm

code not working properly

Post by swapna10 »

Hi All
I have been working on one program.. Its giving me output for some echo, not for other echos. I dont know why? Following is the code -


if (is_array(@$_REQUEST['classes']))
{
foreach($_REQUEST['classes'] as $course1) {
$sql=mysql_query("SELECT Ma_CoName FROM MCourse where Ma_CoNo='$course1'");
@$course=mysql_result($sql, 0) or die('wrong query'.mysql_error());

if ($course=='ENGL 1301') echo $course;
elseif ($course=='ABC 33') echo $course;
elseif ($course=="VVV 34") echo $course;
elseif ($course=="CCC 95") echo $course;
elseif ($course=="MMM 12") echo $course;
elseif ($course=="OOO 89") echo $course;
elseif ($course=="CCC 75") echo $course;

}}
Code in bold is not giving me any output, but $course=='ENGL 1301' is giving me output. I dont know why? It is so weird.....
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: code not working properly

Post by califdon »

Remove all but the last semicolon.
Post Reply