Hi,
I'm somewhat new to PHP/MySQL interaction and have a database of menus for my school's cafaterias. It may not be the slickest and even yet most efficient way to have it setup but it works for my first database/query web project. Due to our school's policy on accessability I need to validate all my pages and the only problems I have now are in my querys. Here is an example of my non-validataing code.
Line 89, character 6:
<br /><b>Now Serving @ the Wildcat Den:</b /><br /><b>Soup/ ...
^
Warning: net-enabling start-tag; possibly missing required quotes around an attribute value
Line 89, character 45:
... erving @ the Wildcat Den:</b /><br /><b>Soup/Salad Bar</b><b ...
^
Error: delimiter / invalid: only s and tagc allowed here
Line 89, character 51:
... @ the Wildcat Den:</b /><br /><b>Soup/Salad Bar</b><br>Chil ...
^
Warning: net-enabling start-tag; possibly missing required quotes around an attribute value
Line 89, character 364:
... ow Serving @ Marketplace:</b /><br /><b>Soup/Salad Bar</b><b ...
^
Error: delimiter / invalid: only s and tagc allowed here
Line 89, character 370:
... ving @ Marketplace:</b /><br /><b>Soup/Salad Bar</b><br>Mine ...
^
Warning: net-enabling start-tag; possibly missing required quotes around an attribute value
To me it looks liek a stripslashes issue. Here is my code for this query.
if ($meal != NULL)
{
$query = "select menu from den where ((day = '" . $day . "') and (meal = '" . $meal . "'))";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo '<b>Now Serving @ the Wildcat Den:</b />';
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo '<br />';
echo (stripslashes($row['menu']));
}
echo '<hr align="center" width="75%">';
$querymp = "select menu from mp where ((day = '" . $day . "') and (meal = '" . $meal . "'))";
$resultmp = mysql_query($querymp);
$num_resultsmp = mysql_num_rows($resultmp);
echo '<b>Now Serving @ Marketplace:</b />';
for ($i=0; $i <$num_resultsmp; $i++)
{
$rowmp = mysql_fetch_array($resultmp);
echo '<br />';
echo (stripslashes($rowmp['menu']));
}
mysql_close();
}
Now the information in the database is formatted with html in the data itself. Much like this.
<b>Soup/Salad Bar</b><br>Chicken Gumbo<br>Some Crap We served last week<br><b>Home Cookin'</b><br>Green Eggs and Ham<br>Steaming piles of crap<br>
Any help would be appreciated. Sorry for all the code posting but I just thought it might help with any suggestions.