Warning: SQL Statement is Missing SQL

Ξ March 26th, 2008 | → | ∇ code |

I found some great code at work today I’d like to share. I’ve omitted anything that might qualify as a trade secret or proprietary information. I’ve also changed the names of the innocent variables to make it more readable. Also, this won’t be funny if code makes your brain hurt.

Here’s the error I kept finding:
Warning: pg_query_params(): Query failed: ERROR: bind message supplies 3 parameters, but prepared statement "" requires 0 on line 9175

Upon investigation, I determined that the reason our postgres query was failing was because we forgot to actually give it any SQL statement (pay attention to the second parameter here.. it should contain the SQL query that you want to apply the third parameter for):
$ret = pg_query_params($this-connection, "", array($shipping_type, $customer_id, $payment));

Well, fine.. but I thought it was funny.

Original post by Maker


Leave a reply

  • Rumours and Lies