Forum Moderators: open

Message Too Old, No Replies

mysql w3c validation help

mysql w3c validation help

         

nofia

7:30 pm on Oct 13, 2008 (gmt 0)

10+ Year Member



i've been working on validating this page for 2 days and i finally decided to ask for help here.
i'm down to 5 errors and i think if i can fix the one below all will be good.

can anyone tell me why i'm getting the validation error message below ---

Line 29, Column 0: character data is not allowed here .
You have an error in your SQL syntax; check the manual that corresponds to your ✉
You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include:

putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>), or
forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes), or
using XHTML-style self-closing tags (such as <meta ... />) in HTML 4.01 or earlier. To fix, remove the extra slash ('/') character. For more information about the reasons for this, see Empty elements in SGML, HTML, XML, and XHTML.

Line 30, Column 47: end tag for "body" omitted, but OMITTAG NO was specified .
and `j`.`event_id` = `e`.`event_id` ' at line 4&#9993;
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

for the code ref below ---

$icontact_id = $_POST[icontact_id];
$item =$icontact_id;

$fran = mysql_query("select `j`.`job_id`, concat(`c`.`icfname`,' ',`c`.`iclname`) as `flname`, `e`.`ename`, `e`.`etapedate`, `t`.`jtname`, `j`.`jnotes`, `j`.`icontact_id`, `c`.`icontact_id`, `j`.`event_id`, `e`.`event_id`, `j`.`jobtitle_id`, `t`.`jobtitle_id`
from jobs j, icontacts c, events e, jobtitles t
where `c`.`icontact_id` = $icontact_id
and `j`.`icontact_id` = `c`.`icontact_id`
and `j`.`event_id` = `e`.`event_id`
and `j`.`jobtitle_id` = `t`.`jobtitle_id`
order by `e`.`etapedate` desc") or die(mysql_error());

i have this at the top of my page

<!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=utf-8" />
<title>site name here</title>

<link rel = "stylesheet"
type = "text/css"
href = "mainstyle.css" />

<link rel = "stylesheet"
type = "text/css"
href = "grids.css" />

</head>

thanks
jd

coopster

5:19 pm on Oct 14, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



or die(mysql_error())

It starts right there. You are attempting to validate a page that should be rendering your HTML but since your query syntax is invalid, the logic is hitting the OR condition and dumping the MySQL query error to the browser. When the validator sees the dumped error in your HTML syntax, it is finding your HTML structure invalid. You need to fix your query.

I would start by dumping out the value of your $icontact_id variable to see what it contains. It is likely the cause of your issue.

nofia

6:22 pm on Oct 14, 2008 (gmt 0)

10+ Year Member



thanks for the reply,
what do you mean by dumping out the value

i sort of figured it was the $icontact_id causing me problems

$icontact_id is the main number assigned to each individual, so what i do is print all the other info based on the $icontact_id

do i need some type of quote like ' ' or " " or ` ` around $icontact_id

this is causing me issues in more than one place,
thanks again for your help
jd

coopster

12:14 pm on Oct 15, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what do you mean by dumping out the value

I mean develop the sql statement and then print it to the browser upon failure, along with your MySQL error, and then exit the script immediately. No sense continuing until you have fixed your issue. Don't forget to remove all that error dumping stuff before you go live with your program though.

If the variable $icontact_id is numeric, like an integer, you won't need to place quotation marks around it. You can dump just that variable to the browser too. Dump it right before you develop your sql statement so you can see what value it contains.

print '<pre>'; 
var_dump($icontact_id);
print '<pre>';
exit;

nofia

2:56 am on Oct 16, 2008 (gmt 0)

10+ Year Member



thanks for the reply, busy at my real job, will check it out this weekend when i have some free time, thanks again jd