 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
ticebain
Joined: 08 May 2008 Posts: 1
|
Posted: Thu May 08, 2008 3:52 am Post subject: MDB2 help, its not working |
|
|
so I am adapting this from PearDB so the coding might not be right as far as where to put the MDB2's instead of DB's but it should have worked in DB with all the DB's in there, Problem is it prints nothing, no error, no success, no fail, no nothing. I cant figure it out and it is such a simple thing, just a table creation script. If i am way off can somebody post a table creation scrip so i can see what i am doing wrong.
Thanks
| Code: |
<?php
reqire_once('../pear/PEAR/MDB2.php');
$db =& MDB2::connect('mysql://username:password@localhost/databasename');
if (MDB2::isError($db)) { die("connection error: " . $db->getMessage());}
$db->setErrorHandling(PEAR_ERROR_DIE);
$sql = "CREATE TABLE dishes (
dish_id int(11),
dish_name varchar(255),
price decimal(4,2),
is_spicy int(11)
)"
$q = $db->query($sql);
if (MDB2::iserror($q)){
die($q->getMessage());
}
?>
|
|
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Thu May 08, 2008 10:42 am Post subject: |
|
|
By inserting the following block at the beginning of your script, you should get one or more error messages:
| Code: |
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'PEAR.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
|
I guess that your problem is that the require_once call is wrong (should be just 'MDB2.php') and that you haven't adjusted your include_path setting, causing MDB2 not to find its own files. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|