Page 1 of 1

php remote server error!!!!!!!!!!

Posted: Sat Nov 21, 2009 2:43 pm
by binkabir
hello all,
i designed an application that is working on my localhost computer but generals error when i host to on my web hosting server

i actually used a php variable in an sql select statement

an example of my code
<?php
$student_subject = array('mathematics', 'economics','physics','chemistry');

for ($i=0;$<count($student_subject);$i++){

$sql = "select total,exam from $student_subject[$i] " ;
$result = myqli_query($conn,$sql) or die ();

$row = mysqli_fetch_assoc($result);
echo $row['total']. "</br>";
}

?>

this code works perfectly well in my localhost server on my computer system but
generates errors on a remote web host.
(that is cannot query the sql statement ) this seems to me that the php variable in the sql is not working)

please can any one help me ? :?:
this code

Re: php remote server error!!!!!!!!!!

Posted: Sat Nov 21, 2009 3:06 pm
by Jonah Bron
When you receive an error message, it's giving you valid information, that should be paid attention to. It looks like there is a problem with you SQL statement. It should be something like "SELECT total, exam FROM {$student_object[$i]}"

Always wrap your code with the tags when posting on the forum, and code related questions go in the PHP - Code forum

Welcome to PHPDN!

Re: php remote server error!!!!!!!!!!

Posted: Sat Nov 21, 2009 3:18 pm
by binkabir
hello,
yes i have done that (putting the variable in a php tags ) but no result, it did not work

the error the server report's is the error i defined that i input in the php die() function.

Re: php remote server error!!!!!!!!!!

Posted: Sat Nov 21, 2009 5:18 pm
by John Cartwright
Moved to PHP-Code.