darkangel2001lv;10998690 wrote:
The error i am getting is confusing the heck out of me due to how is the SAME Script valid one page but on other it give the following error.
there could be any number of causes for this, and most of them would be quite common.
my first thought would be that the query simply isn't finding any matching results.
darkangel2001lv;10998690 wrote:I don't get it. And please if you are just going to say this topic has been covered on this forum, yes it has but have found nothing related to this exact issue. don't bother.
If you really don't want me to bother trying to help you, I won't. But then, why would you post?
darkangel2001lv;10998690 wrote:I need some one to help me have a deadline in less two weeks and i keep getting stupid errors like this that make no sense. I have searched Google this forum for the last 6hrs and can not find anything that can explain this to me nor how to fix it.
Posting on a forum is a good idea if you want someone to help you figure out how to do something yourself. If you want someone to fix your problem for you, you'll probably have better luck hiring someone (especially if you're on a deadline).
Incidentially, your "revised" code is going to have (additional) problems:
$query = "SELECT survey_id, question1, question2, question3, question4, question5, question6, question7, question8, question9, question10, question11, question12, question13, question14,question15, comments, company, address, name, title, email, time " .
"FROM Customer_Satisfaction " .
"WHERE survey_id = '0008388609' ";
$result = mysql_query($query) or die(mysql_error());
while($result = mysql_fetch_array($query)){
// $query is the query, not the query result.
// $result is the result (or _was_, until you overwrote it in the while() loop)
// also, you don't seem to be trying to do anything with the results anyway...?
}
// here, $data will be FALSE, since $result is now the return value of mysql_fetch_array()
// (which returned FALSE because you tried to use it on something that wasn't a mysql result)
$data = $result
// and, you forgot your closing semicolon
?>
Working from your original code, I would suggest trying this to help troubleshoot:
<?php
require_once('includes/mysql_connect.php');
include('includes/config.inc.php');
$query= "SELECT survey_id, question1, question2, question3, question4, question5, question6, question7, question8, question9, question10, question11, question12, question13, question14,question15, comments, company_name, address, name, title, email, time
FROM Customer_Satisfaction
WHERE survey_id = '0008388609' ";
$result= mysql_query($query);
// check if there is a result
if( $result !== FALSE ){
$data= mysql_fetch_array($result);
print 'it worked';
}else{ print 'mysql_query() returned FALSE<br>'.mysql_error(); }
?>