Jump to content

mysql_fetch_assoc NOT WORKING! URGENT HELP!


aarontbarksdale

Recommended Posts

Okay, so, it was working...now it doesn't. PLEASE HELP! NEED IT WORKING TODAY!!!

require ('connect.php');$myusername = $_SESSION['myusername'];//Data from Clients table and variables associate$client_table = mysql_query("SELECT * FROM `clients` WHERE client_id = ". $_SESSION['clientid'] ." ") or die(mysql_error());$row = mysql_fetch_assoc($client_table);//Data from Payments table and variables associated$pmt_table = mysql_query("SELECT * FROM `payments` WHERE client_id = ". $_SESSION['clientid'] ." ORDER BY YEAR(pmt_date) ASC") or die(mysql_error());$row2 = mysql_fetch_assoc($pmt_table);$userstate = $row2['userstate'];

The ENTIRE report.php file is dependent upon information from the database that carried over via Session from the client's information page with a unique ID number that corresponds to the client_id in the database. I can access all the information in the client info.php, but it's like it doesn't carry over.

 

Please help ASAP!

 

 

Link to comment
Share on other sites

Make sure you have session_start() in the required pages and also make sure $_SESSION['clientid'] have values. Also for SQL query, you don't need single quotes for selecting the table. Example: "SELECT * FROM clients ...."

Link to comment
Share on other sites

Make sure you have session_start() in the required pages and also make sure $_SESSION['clientid'] have values. Also for SQL query, you don't need single quotes for selecting the table. Example: "SELECT * FROM clients ...."

session_start(); is at the top of every page, first line of code. I'll try removing the ` ` around clients in the table lines to see if that works.

Link to comment
Share on other sites

Does $_SESSION['clientid'] contain a value? Also try removing the space at the end of the query, like:

 

$client_table = mysql_query("SELECT * FROM clients WHERE client_id = ". $_SESSION['clientid']);

Edited by Don E
Link to comment
Share on other sites

What exactly happens when you run the code?

Nothing. The code starts the date at 12/31/1969. No information from the customer's page gets carried over to the report.

 

No payments or anything.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...