Jump to content

[SOLVED] require_once() - functions not working


tomjung09

Recommended Posts

I cannot get the following code to work

$query_r0 = "SELECT zipcode FROM sr_users WHERE username = '$id'";
$result0 = mysql_query($query_r0) or die('Could not connect to mysql server.' );
$num = mysql_num_rows($result0);	
$zip = mysql_result($result0,0,'zipcode');	

 

I am calling it from another file, the $id variable is correct, the database selection is correct, the $num = 0 and therefore $zip = Null.

 

When I run this code on the main page, it runs just fine and it finds the zip.  Why does it not work when I include it in the require_once() function?

 

It can be the server which is configurated wrong maybe?

 

I use a free server, where I have to delete the file you want to include, and upload it again several times, before it actually works xD, it's free so you wan't blame them.

 

Maybe their is another reason as well

You would need to post the version of the code that is using the require_once() statement. Also post the whole contents, even the opening and closing php tags, of the file being required.

 

Without seeing all the code that is relevant to the problem, no one can answer why it does not work.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.