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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
binkabir
Forum Newbie
Posts: 3
Joined: Sat Nov 21, 2009 2:20 pm

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

Post 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
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

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

Post 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!
binkabir
Forum Newbie
Posts: 3
Joined: Sat Nov 21, 2009 2:20 pm

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

Post 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.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

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

Post by John Cartwright »

Moved to PHP-Code.
Post Reply