php - Error with postgres/pdo query binding values -



php - Error with postgres/pdo query binding values -

i'm running next query in postgres:

select (sum(g.grade_days_late) - sum(s.ex_late_days)) used_late_days grades g left bring together ( select * late_day_exceptions ) s on s.ex_rubric_id = g.rubric_id , s.ex_student_rcs=g.student_rcs g.student_rcs='?' , g.status=1 , g.rubric_id < ?

with next commands:

$statement = database::$link->prepare($query); $statement->execute($parameters);

$parameters equal to:

array (size=2) 0 => string 'test' (length=7) 1 => int 6

and next error:

pdoexception: sqlstate[42p18]: indeterminate datatype: 7 error: not determine info type of parameter $2

i run query straight against database replacing 2 ? stuff in $parameters , works fine. if add together ' around sec parameter, query returns nil (yet still returns proper reply if run straight against values inserted).

i have no thought what's going on here or why i'm getting error. (database open pdo connection, no issues there).

should where g.student_rcs= ? in query:

select (sum(g.grade_days_late) - sum(s.ex_late_days)) used_late_days grades g left bring together ( select * late_day_exceptions ) s on s.ex_rubric_id = g.rubric_id , s.ex_student_rcs=g.student_rcs g.student_rcs= ? , g.status=1 , g.rubric_id < ?

and bind values this:

$statement = database::$link->prepare($query); $statement->bindvalue(1, $parameters[0], pdo::param_str); $statement->bindvalue(2, $parameters[1], pdo::param_int); $statement->execute();

php sql database postgresql pdo

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -