I am trying to make my entire site in php with functions and the like. I have run into a problem with some of the code. I am trying to do a while loop to access the content from a data base, but it is not working. I am kinda stumped as to what to do. Here is the code.
$db = connect();
$url = "index.php?body=editworkorder.php&page=Edit Work Order";
$info1=''.
'<center>'.
'<table width=97%>'.
'<tr bgcolor='#345487' align='center'><td width=20%><font color='white'>Apartment</font></td><td width=20%><font color='white'>Name</font></td><td width=20%><font color='white'>Phone</font></td><td width=20%><font color='white'>Assigned To</font></td><td width=20%><font color='white'>Status</font></td></tr>'.
'$result = mysql_query("SELECT * FROM workorder",$db);'.
''.
'while ($myrow = mysql_fetch_array($result)) {'.
''.
'printf("<tr bgcolor=#D2E5FF>");'.
'printf("<td><a href=\"%s&id=%s\">%s</a></td>", $url, $myrow["id"], $myrow["apt"]);'.
'printf("<td>%s</td>", $myrow["name"]);'.
'printf("<td>%s</td>", $myrow["phone"]);'.
'printf("<td>%s</td>", $myrow["assigned"]);'.
'if ($myrow["status"]=="Open")'.
'{'.
'printf("<td><font color=red>%s</font></td>", $myrow["status"]);'.
'}else{'.
'printf("<td>%s</td>", $myrow["status"]);'.
''.
'}'.
'printf("</tr>");'.
''.
'}'.
''.
'</table>'.
'</center>';
tab();
open_column();
news_block("View Contents",$info1);
close_column();
tab();
when I run this page it just gives me the code for the while loop. I understand why it does this, but I need a away to do this that works. Any help is appreciated.
Thanks,
Luckybob