Hi there I have issue with this php file down here. After i try to run it it shows Parse error: syntax error, unexpected $end in /var/www/show.php on line... it points to line with </html> ... I have browsed several topics and found that a } is missing but i dont know where. Thank you for help! <html> <head> <title></title> </head> <body> <?php $username="root"; $password="Mixerstvo"; switch ($value): case "linky": $database="zadanie"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die("Chyba pri pripajani na databazu"); $query="SELECT * FROM linky"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $meno=mysql_result($result,$i,"meno"); $trasa=mysql_result($result,$i,"trasa"); echo "<b>$meno | $trasa</b><br><hr><br>"; $i++; } ?> </body> </html>
witch statement you are using no { } switch ($i) { case "apple": echo "1"; break; case "bar": echo "2"; break; case "cake": echo "3"; break; }
Ok i see where the problem was... i added one more case and transformed it into switch ($x): { case "1": ... break; case "2": ... break; } and now im getting: Parse error: parse error,unexpected '{', expecting `T_ENDSWITCH' or `T_CASE' or `T_DEFAULT' in . ... it points to line 11: 10: switch (...): 11: { What does that mean?
ok probles solved thank you very much... just beginner here... thank you one more time... One more question here: Lets say that I have database - named ALPHA there are 3 tables in it: dogs, cats, pirates every one of these tables has some columns with data in it is it possible to create php script that would find out number of tables and print every one of them? Thank you very much...