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?

 

Link to comment
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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