Jump to content

jgrauer

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jgrauer's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Finally after many days of banging my head on the desk, I have figured out the problem. I had copied over the PEAR and MDB2 libraries over into my include folder, and was referencing them there. However, it seems somewhere in the PEAR library, it already referenced MDB2 and was creating some sort of loop when trying to do a prepared statement. All the code I wrote was completely accurate, however the library was dying due to redeclaration of the same variables. I simply stopped referencing the PEAR and MDB2 libraries in my include folder, and simply included the ones form the php directory itself. Everything is working fine now. Thanks for the help.
  2. On the page : http://pear.php.net/manual/en/package.database.mdb2.intro-execute.php Passing an array to execute() <?php // Once you have a valid MDB2 object named $mdb2... $types = array('integer', 'text', 'text'); $sth = $mdb2->prepare('INSERT INTO numbers VALUES (?, ?, ?)', $types, MDB2_PREPARE_MANIP); $data = array(1, 'one', 'en'); $affectedRows = $sth->execute($data); ?> It seems, that there are both options.. I have tried both options, and both don't work. As you can see, my code is nearly identical to this one (except, I am running only 2 fields instead of 3). This is blowing my mind away.. and I've posted in my more then one place for help
  3. this is only in the case that I use namespaces such as :name or something. However, if I simply use ? , it should just read from the array , in the same order I provide it? Does no one on this forum have experience with this? This isn't that new?
  4. You're joking right? Obviously I read the manual.. my example is built from the manual itself... Still looking for some help on this matter please.
  5. hey... found this website when googling for a php help forum... hopefully this is the right place. I am about to start a major project for a new high profile company contract my company is presently bidding on. One of the requirements is a web interface to communicate between the 2 companies. I recently read (and have been reading more into it) that MDB2 is (one of) the best methods to communicate with a database (using prepared statements). It seems to be extremely popular, and not to difficult to use... however, for some reason, it just wont work for me. <?php require_once '/include/MDB2.php'; function connect(){ $SQL = array( 'driver' => 'mysql', 'user' => '***', 'pass' => '***', 'host' => '127.0.0.1', 'dbname' => '***', ); $SQL['sql'] = $SQL['driver']."://".$SQL['user'].":".$SQL['pass']."@".$SQL['host']."/".$SQL['dbname']; $mdb2 = MDB2::connect($SQL['sql']); $mdb2->setOption('emulate_prepared',true); if(PEAR::isError($mdb2))die("Error while connecting : " . $mdb2->getMessage()); return $mdb2; } $mdb2 = connect(); $statement = $mdb2->prepare("INSERT INTO `test` (id,name) VALUES (?, ?)", array('integer','text'), MDB2_PREPARE_MANIP); $statement->execute(array(1,'someuser')); $statement->free(); ?> For some reason, this is not working? However if I just execute a normal query, it works no problem: <?php $mdb2 = connect(); $statement = $mdb2->query("INSERT INTO `test` (id,name) VALUES (1,'someuser')"); ?> So, I am connecting properly, everything is good... but this prepared statement just hates me Any help please?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.