Jump to content

Recommended Posts

hi,

i have pdo with select statement and trying to put 3 where clauses, why it is not working?

code:

$conn = new PDO("mysql:host=$servername;dbname=timeclock", $username, $password);
			// set the PDO error mode to exception
			$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

					$res = $conn->query("SELECT oracleid
                         , name 
                         , des 
                         , clockingindate   as clockin
                         , clockingoutdate  as clockout
                         , timediff(clockingoutdate, clockingindate) as duration
                         , total
                    FROM attendance_records
                         JOIN (
                                SELECT oracleid
                                     , sec_to_time(sum(timestampdiff(SECOND, clockingindate, clockingoutdate))) as total
                                FROM attendance_records
								where isdone =-1
                                GROUP BY oracleid
                              ) tots USING (oracleid)
							  where isdone =-1, DATE(ClockingOutDate) >= $sdate1, DATE(ClockingOutDate) <= $edate1
                    ORDER BY oracleid, clockingindate
                    ");

3rd line from last i have 3 clauses, please advise

Link to comment
https://forums.phpfreaks.com/topic/310301-multiple-where-clauses-in-pdo/
Share on other sites

25 minutes ago, requinix said:

WHERE

And please ask your database questions in the appropriate database forum.

Sure sorry about that but question is, apart of where being in caps, the rest is ok with comma or I need for each to include where in caps?

2 minutes ago, ramiwahdan said:

apart of where being in caps, the rest is ok with comma or I need for each to include where in caps?

Uppercase or lowercase does not matter.

Read the rest of the page. It tells you how to use a WHERE clause. Correctly.

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.