566 CHAPTER 23 INTRODUCING PDO PDO_PARAM_LOB: (Make a web site)

566 CHAPTER 23 INTRODUCING PDO PDO_PARAM_LOB: SQL large object datatype PDO_PARAM_STMT: PDOStatement object type; presently not operational PDO_PARAM_INPUT_OUTPUT: Used when the parameter is passed into a stored procedure and therefore could be changed after the procedure executes The length parameter specifies the datatype s length. It s only required when assigning it the PDO_PARAM_INPUT_OUTPUT datatype. Finally, the driver_options parameter is used to pass along any database driver specific options. Let s revisit the previous example, this time using bindParam()to assign the column values: // Connect to the database server $dbh = new PDO(”pgsql:host=localhost;dbname=corporate”, “websiteuser”, “secret”); // Create and prepare the query $query = “INSERT INTO product SET sku = :sku, name = :name”; $stmt = $dbh->prepare($query); $sku = ‘MN873213′; $name = ‘Minty Mouthwash’; // Bind the parameters $stmt->bindParam(’:sku’, $sku); $stmt->bindParam(’:name’, $name); // Execute the query $stmt->execute(); // Bind the parameters $stmt->bindParam(’:sku’, ‘AB223234′); $stmt->bindParam(’:name’, ‘Lovable Lipstick’); // Execute again $stmt->execute(); If question mark parameters were used, the statement would look like this: $query = “INSERT INTO product SET sku = ?, name = ?”; Therefore, the corresponding bindParam() calls would look like this: $stmt->bindParam(1, ‘MN873213′); $stmt->bindParam(2, ‘Minty Mouthwash’); . . . $stmt->bindParam(1, ‘AB223234′); $stmt->bindParam(2, ‘Lovable Lipstick’);
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply