switch and while

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

 



Hello.

I want do a SWITCH using data base MySQL.
The CASE must be a variable, same the ECHO.
My table (CATEGORY) contain ID and NAME

I do this (with a WHILE):

$sqlCat = "SELECT * FROM categoria";
$resultCat = mysql_query($sqlCat);

switch ($selectCategory)
{				
	while($array=mysql_fetch_array($resultCat))
	{
       case $row[0]:
		$categoy = "$row[1]";
		break;
	}
}

But doesnt works, print an error: Parse error: syntax error, unexpected
T_WHILE, expecting T_CASE or T_DEFAULT or '}' in
C:\AppServ\www\andademiparte\admin\listado.php on line 118... this line is
the WHILE.

How can resolve this?
thanks

+                                                                          _
   // Emiliano Boragina _
   // Diseño & Comunicación //////////////////
+                                                                          _
   // emiliano.boragina@xxxxxxxxx  /
   // 15 40 58 60 02 ///////////////////////////
+                                                                          _



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux