speedy33417 Posted May 3, 2008 Share Posted May 3, 2008 I'm trying to normalize my database the best I can which means I end up with more complex queries. It's getting a bit too much for me and am totally lost at this point... Basically I'm working on an appointment page for all employees. I'm having an issue with this specific query. $sql = "SELECT job.job_id, job_employee.assign_id, job.job_status, job.job_date, job.address_id, customer_address.cust_id, customer_address.google_address, customer.cust_firstname, customer.cust_lastname, customer.special FROM job INNER JOIN job_employee ON (job.job_id = job_employee.job_id AND job_employee.job_id = '$prEmployeeId[$i]') INNER JOIN customer_address ON (job.address_id = customer_address.address_id) INNER JOIN customer ON (customer_address.customer_id = customer.cust_id) WHERE (job.job_date >= '$weekDateLow[$d]' && job.job_date <= '$weekDateHigh[$d]') AND (job.job_status = 'D' || job.job_status = 'S') ORDER BY job.job_date"; I'm trying to pull information from four different tables for one specific job. Here's my table structure: job job_employee customer customer_address ----------- ------------ ------------- ---------------- job_id assign_id cust_id address_id customer_id job_id cust_firstname customer_id address_id employee_id cust_lastname google_address job_date special job_status The query should pull all required information for the job from all four tables between a specific date range ($weekDateLow[$d] and $weekDateHigh[$d]) if the job_status is either 'D' or 'S' and the assigned employee is $prEmployeeId[$i]. The variables that I use in the query are all good. I used them in a more simple version. I get this error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource Quote Link to comment Share on other sites More sharing options...
Barand Posted May 4, 2008 Share Posted May 4, 2008 First step is always $result = mysql_query($sql) or die (mysql_error()); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.