new pear user having a problem with insert
| From: | Matthew Hinton | Date: | Thu, 14 Feb 2002 17:09:48 +0000 |
| Subject: | new pear user having a problem with insert | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-858@lists.php.net to get a copy of this message | ||
I just set up pear and I am trying to use it but I have a strange
problem. I can execute select statements using $db->query($sql) but
insert statements result in a parse error. The following code works
fine if I only perform the select query but it bombs if I uncomment the
insert. If anyone has any idea what is going on I would be thankfull
for some help.
<?php
require_once 'DB.php';
$DSN = Array
(
'phptype' => 'mysql',
'hostspec' => 'localhost',
'database' => 'testdb',
'username' => 'root',
'password' => 'fu'
);
$db = DB::connect($DSN);
$sql = "SELECT * from TestTable";
$rs = $db->query( $sql );
$sql = "INSERT INTO TestTable (fname,lname,ptitle) "
."VALUES ('a','b','c')";
//$rs2 = $db->query( $sql );
?>
<html>
<head>
<title></title>
</head>
<body><br><br>
<? print "num rows: ".$rs->numRows(); ?><br><br>
<hr>
<h3>test file</h3>
</body>
</html>