Jump to content

Archived

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

tomjung09

[SOLVED] require_once() - functions not working

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?

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Thanks for the help, I decided just to put the function inside the original file and it works fine that way.

Share this post


Link to post
Share on other sites

×
×
  • 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.