Problem in using Prepare in PHP adodb

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
lemwell
Forum Newbie
Posts: 1
Joined: Wed Nov 02, 2011 8:33 pm

Problem in using Prepare in PHP adodb

Post by lemwell »

Good day Guys,

I encountered problem when I used PREPARE function.

This is my sample code:

Code: Select all

<?php

$myServer = "NMDSU_00";
$myUser = "sa";
$myPass = "123456Aa";
$myDB = "examples";

//create an instance of the  ADO connection object
$conn = new COM ("ADODB.Connection")
  or die("Cannot start ADO");

//define connection string, specify database driver
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
  $conn->open($connStr); //Open the connection to the database
  

	$sqlInsert = $conn->Prepare('Insert into Cars values(?,?,?)');
	
	$conn->Execute($sqlinsert(5,'Nissan','2000'));
	
?>
Error Message:

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> ADODB.Connection<br/><b>Description:</b> Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another

I have already check the number of ??? in the Insert function and also the adodb library.

Your advice is very much welcome.

Thanks
Post Reply