Skip to content
Advertisement

Tag: pdo

‘Invalid parameter number’ error using bindParam to create an MySQL query

I have written a function that takes four arguments and passes them to my MySQL database using a PDO. I am trying to use bindParam so that I can use the variables to construct the query. I have followed the examples in the PHP documentation, but I am getting the following error: ERROR: SQLSTATE[HY093]: Invalid parameter number: no parameters were

Using PDO to CREATE TABLE

I am very new to php and this forum, so please excuse any errors or misplaced questions. In the code i provided, I am just looking to CREATE a Table in the DB “mydb”. I tested the connection to the DB(It works). It is just the creating the table i am having issues with. Any advice or criticisms would be

Escape raw SQL queries in Laravel 4

How does one go about escaping parameters passed to a raw query in Laravel 4? I expected something like DB::escape() (which rings a bell from Laravel 3) and also attempted DB::quote() (which I thought could be available through the PDO object) We can’t use the select method with placeholders as the above is just a simplified example of what we

converting to PDO, problems

So I am working on converting an old tutorial I did a while back from mySQL to PDO. This way I can better understand the concepts. I seem to of run into a wall however. The following function is …

Search form with PDO

The below code now works but how can I make it so if no results are found it echos a message instead of blank. I think I’ve managed to create a search query for my database. Its only a very basic …

PDO connect to .accdb on network

I have an access database which I would like to CRUD with PDO. When My database is stored on C:\wamp\www\test.accdb I can connect. However, the database I am interested in is stored on our office server, at \server1abc123test.accdb . server1 is mapped to drive z: on my computer. My code looks like this (verbatim) both of these give me error:

PDO fetch / fetchAll

Not new to PHP, but only a day old to PDO. Surely I am doing something wrong here. the only way I can declare those $_SESSIONS properly is if I use $result[0][‘fieldName’]; How can I just access it via $result[‘fieldName’]; ? Answer fetchAll, as the documentation says, retrieves an array of all fetch data simultaneously. Since you are using FETCH_ASSOC,

Advertisement