Switch Statements[solved,read solution!]
Posted: Sun Nov 06, 2005 12:16 pm
Okay..Here's the deal.. I want to dynamically generate a switch statement;) Reason why is because I'm trying to think of a way to completely automate my webpage creation and all;)
here's what I got...
and in my database...
needless to say once I run the script I get an error.. to be exact..
any one care to speculate?
here's what I got...
Code: Select all
$sql="SELECT * FROM case WHERE switch='content'";
$query=mysql_query($sql);
switch ($content)
{
while ($test=mysql_fetch_object($query))
{
case "".$test->cases."":
include("".$test->includes."");
break;
}
default:
include ("main.php");
break;
}Code: Select all
switch cases includes
content ct ct.php
content c c.php
content phpt phpt.php
content php php.php
content me me.php
content site site.php
content resume resume.php
content resume2 resume2.phpCode: Select all
Parse error: parse error, unexpected T_WHILE, expecting T_CASE or T_DEFAULT or '}' in /home/esitemai/public_html/index.php on line 65