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.borag...@gmail.com  /
   // 15 40 58 60 02 ///////////////////////////
+                                                                          _

Reply via email to