atmoth Posted March 21, 2007 Share Posted March 21, 2007 I am trying to write a simple content management system for my schools website. I have all of the sql functions working, but when I combine my xhtml and put it with my php the style gets all messed up. I have tried taking it out of the head and linking it to a .css file, but I have had no luck.here is my code, any help would be appreciated.thanks<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /><title>Events Query</title><style type="text/css">td {font-size:10px; }table {font-family: tahoma; color: #a8a8a8; }p {font-family: tahoma; color: #a8a8a8; }A {text-decoration: underline; color:d59a33; }body {scrollbar-3dlight-color:#a8a8a8; scrollbar-arrow-color:#ffffff; scrollbar-base-color:#FFFFFF; scrollbar-darkshadow-color:#FFFFFF; scrollbar-face-color:#ffd79c; scrollbar-highlight-color:#FFFFFF; scrollbar-shadow-color:#ffffff};</style></head><body leftmargin=\"25\"><h2>Events</h2> <table style="width:375px;"> <tr> <td style="text-align:right;"> <a href="betaevents.html">Events List</a> | <a href="calendar.html">Calendar</a> </td> </tr> </table> <? $db_name = "ifhs"; $table_name = "events"; $connection = @mysql_connect('localhost', 'root', 'password') or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "SELECT * FROM $table_name"; $result = @mysql_query($sql, $connection) or die(mysql_error()); while ($row = @mysql_fetch_array($result)) { $title = $row['title']; $place = $row['place']; $edate = $row['edate']; $notes = $row['notes']; $img = $row['img']; $events_list .= "<table style=\"border:thin; width:375px;\"> <tr> <td colspan=\"2\" style=\"background-color:f7f7f7;\"><h5>$title</h5></td> </tr> <tr> <td colspan=\"2\"><font color=\"000000\"><b>Date: $edate at $time</b></font></td> </tr> <tr> <td colspan=\"2\"><font color=\"000000\"><b>Place: $place</b></font></td> </tr> <tr> <td colspan=\"2\" style=\"height:1px; background-color:C0C0C0;\"></td> </tr> <tr> <td width=\"274\" height=\"100\" valign=\"top\"><br /> $notes </td> <td width=\"89\"><img src=\"$img\" alt=\"\" width=\"89\" height=\"90\" /></td> </tr> </table>"; } echo "$events_list"; ?></body></html> Link to comment Share on other sites More sharing options...
boen_robot Posted March 21, 2007 Share Posted March 21, 2007 Remove all "\" before the quotes. You only need them when you echo quotes, not in the whole PHP file. Example: <a href="file.html"><?php echo "I'm really \"modest\"";?></a> Notice there are no "\" in the href attribute, as it's not part of PHP. Link to comment Share on other sites More sharing options...
aspnetguy Posted March 21, 2007 Share Posted March 21, 2007 he does need them because he is adding that html code to a php variable. You could remove the \'s and declare the variable like this tho $events_list .= 'html code'; Link to comment Share on other sites More sharing options...
boen_robot Posted March 21, 2007 Share Posted March 21, 2007 I don't see this part being assigned to a variable: <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /><title>Events Query</title><style type="text/css">td {font-size:10px; }table {font-family: tahoma; color: #a8a8a8; }p {font-family: tahoma; color: #a8a8a8; }A {text-decoration: underline; color:d59a33; }body {scrollbar-3dlight-color:#a8a8a8; scrollbar-arrow-color:#ffffff; scrollbar-base-color:#FFFFFF; scrollbar-darkshadow-color:#FFFFFF; scrollbar-face-color:#ffd79c; scrollbar-highlight-color:#FFFFFF; scrollbar-shadow-color:#ffffff};</style></head><body leftmargin=\"25\"><h2>Events</h2><table style="width:375px;"><tr><td style="text-align:right;"><a href="betaevents.html">Events List</a> | <a href="calendar.html">Calendar</a></td></tr></table> The one after it- yes. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now