We help IT Professionals succeed at work.
Get Started

PHP/MySQL query producing errors - problems with multiple query parameters

Sandy Sailer
Sandy Sailer asked
Last Modified: 2012-08-13
Can anybody tell me what is wrong with this query?  
$con = mysql_connect("localhost","username","password");
if (!$con)
  die('Could not connect: ' . mysql_error());
$startDate_getData = "-1";
if (isset($_POST['startDate'])) {
  $startDate_getData = date("Y-m-d", strtotime($_POST["startDate"]));
if (isset($_POST['endDate'])) {
  $endDate_getData = date("Y-m-d", strtotime($_POST["endDate"]));
mysql_select_db("timesheets", $con);
mysql_query("UPDATE employeesxjobsxlaborcodes SET employeesxjobsxlaborcodes.committed = 1
WHERE dateWorked >= $startDate_getData AND dateWorked <= $endDate_getData", GetSQLValueString($startDate_getData, "date"),GetSQLValueString($endDate_getData, "date"));

When I load the page with the query on it, I get the following error:
Warning: mysql_query() expects at most 2 parameters, 3 given in /home/citstime/domains/citstime.com/public_html/qryCommit.php on line 77.

Line 77 is this line:  WHERE dateWorked >= $startDate_getData AND dateWorked <= $endDate_getData", GetSQLValueString($startDate_getData, "date"),GetSQLValueString($endDate_getData, "date"));
Watch Question
Top Expert 2012
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE