For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > February 2008 > MDB2 prepare/execute "Unknown Error"









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author MDB2 prepare/execute "Unknown Error"
Mark Steudel

2008-02-12, 4:09 am

Hi All,

I was hoping someone could take a loop at what I'm doing and see if they can
see where I'm going wrong:

// print_r of $field_values
Array
(
[game_id] => 1
[character_name] => Chunky
[server_id] => 1
[class_id] => 2
[race_id] => 3
[guild_id] => 0
[level] => 60
[user_id] => 1
[profession1_id] => 0
[profession2_id] => 0
[alignment] => test
)

$types = array( 'text',
'integer',
'integer',
'integer',
'integer',
'integer',
'text',
'integer',
'integer',
'integer',
'integer' );

$sql = "INSERT IGNORE INTO characters
( character_name,
game_id,
server_id,
class_id,
race_id,
guild_id,
alignment,
level,
user_id,
profession1_id,
profession2_id )

VALUES

( :character_name,
:game_id,
:server_id,
:class_id,
:race_id,
:guild_id,
:alignment,
:level,
:user_id,
:profession1_id,
:profesion2_id )";

// tried this with and without MDB2_PREPARE_MANIP
$sth = $this->db->prepare( $sql, $types, MDB2_PREPARE_MANIP );

// this checks for pear errors: essentially $sth->getMessage(),
$sth->getDebugInfo()
mysqlErrorCheck( $sth, __LINE__, __FILE__ );

$aRows = $sth->execute( $field_values );

// print of $aRows
MDB2 Error: unknown error

Thanks, Mark
Lorenzo Alberton

2008-02-12, 4:09 am

Mark Steudel wrote:
> // this checks for pear errors: essentially $sth->getMessage(),
> $sth->getDebugInfo()
> mysqlErrorCheck( $sth, __LINE__, __FILE__ );
>
> $aRows = $sth->execute( $field_values );
>
> // print of $aRows
> MDB2 Error: unknown error


try printing $sth->getUserInfo() as well, it
might give you more error details.

--
Lorenzo Alberton
http://pear.php.net/user/quipo
________________________________________
________________________________
Quipo Free Internet: sicuro e veloce senza costi di attivazione e senza
canone, 2 e-mail da 25 Mb, 150 Mb di spazio web e molto di pił!
Registrati gratis: http://www.quipo.it
Mark Steudel

2008-02-12, 7:11 pm

If I run it right after I do prepare, I get

Fatal error: Call to undefined method =
MDB2_Statement_mysql::getUserInfo() in

If I do print_r( $this->db ) before I run getUserInfo() I get a print =
out of
the mdb2 object. Also even though I'm using the :fieldname notation, in =
the
db object last query run has ?, I'm guessing that's normal ...

Also to verify that I have a good mdb2 object if I do:

$res =3D& $this->db->autoExecute( 'characters', $field_values );
mysqlErrorCheck( $res, __LINE__, __FILE__ );

That works.

Thanks, Mark
-----Original Message-----
From: Lorenzo Alberton [mailto:l.alberton@quipo.it]=20
Sent: Monday, February 11, 2008 11:40 PM
To: Mark Steudel
Cc: pear-general@lists.php.net
Subject: Re: MDB2 prepare/execute "Unknown Error"

Mark Steudel wrote:
> // this checks for pear errors: essentially $sth->getMessage(),
> $sth->getDebugInfo()
> mysqlErrorCheck( $sth, __LINE__, __FILE__ );
> =09
> $aRows =3D $sth->execute( $field_values );
>=20
> // print of $aRows
> MDB2 Error: unknown error


try printing $sth->getUserInfo() as well, it
might give you more error details.

--=20
Lorenzo Alberton
http://pear.php.net/user/quipo
________________________________________
________________________________
Quipo Free Internet: sicuro e veloce senza costi di attivazione e senza
canone, 2 e-mail da 25 Mb, 150 Mb di spazio web e molto di pi=F9!
Registrati gratis: http://www.quipo.it
Lorenzo Alberton

2008-02-12, 7:11 pm

Mark Steudel wrote:
> If I run it right after I do prepare, I get
>
> Fatal error: Call to undefined method MDB2_Statement_mysql::getUserInfo() in


of course I meant $aRows->getUserInfo(),
not $sth->getUserInfo()

--
Lorenzo Alberton
http://pear.php.net/user/quipo
________________________________________
________________________________
Quipo Free Internet: sicuro e veloce senza costi di attivazione e senza
canone, 2 e-mail da 25 Mb, 150 Mb di spazio web e molto di pił!
Registrati gratis: http://www.quipo.it
Mark Steudel

2008-02-12, 10:17 pm

Ahhh ok, so I'm getting the following:

execute: [Error message: Binding Values failed with message: MDB2 Error: =
not
found]
[Last executed query: PREPARE
MDB2_STATEMENT_mysql_8286077d1ae1964d64e
a216aa17dc812 FROM 'INSERT =
IGNORE
INTO characters\n ( character_name,\n
game_id,\n server_id,\n
class_id,\n race_id,\n
guild_id,\n alignment,\n
level,\n user_id,\n
profession1_id,\n profession2_id ) \n
\n VALUES \n\n (
'George',\n '1',\n
'10',\n '7',\n
'1',\n '3',\n
'test',\n '70',\n
'1',\n '1',\n
'')']
[Native code: 0]

Binding values must mean that I either have a mismatch or the value =
types
are incorrect?

Thanks, Mark

-----Original Message-----
From: Lorenzo Alberton [mailto:l.alberton@quipo.it]=20
Sent: Tuesday, February 12, 2008 10:07 AM
To: Mark Steudel
Cc: pear-general@lists.php.net
Subject: Re: MDB2 prepare/execute "Unknown Error"

Mark Steudel wrote:
> If I run it right after I do prepare, I get
>=20
> Fatal error: Call to undefined method =

MDB2_Statement_mysql::getUserInfo()
in

of course I meant $aRows->getUserInfo(),
not $sth->getUserInfo()

--=20
Lorenzo Alberton
http://pear.php.net/user/quipo
________________________________________
________________________________
Quipo Free Internet: sicuro e veloce senza costi di attivazione e senza
canone, 2 e-mail da 25 Mb, 150 Mb di spazio web e molto di pi=F9!
Registrati gratis: http://www.quipo.it
Mark Steudel

2008-02-12, 10:17 pm

Ug found it ... typo ... that's both frustrating and relieving at the =
same
time ...

-----Original Message-----
From: Lorenzo Alberton [mailto:l.alberton@quipo.it]=20
Sent: Tuesday, February 12, 2008 10:07 AM
To: Mark Steudel
Cc: pear-general@lists.php.net
Subject: Re: MDB2 prepare/execute "Unknown Error"

Mark Steudel wrote:
> If I run it right after I do prepare, I get
>=20
> Fatal error: Call to undefined method =

MDB2_Statement_mysql::getUserInfo()
in

of course I meant $aRows->getUserInfo(),
not $sth->getUserInfo()

--=20
Lorenzo Alberton
http://pear.php.net/user/quipo
________________________________________
________________________________
Quipo Free Internet: sicuro e veloce senza costi di attivazione e senza
canone, 2 e-mail da 25 Mb, 150 Mb di spazio web e molto di pi=F9!
Registrati gratis: http://www.quipo.it
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com