PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
MDB2 help, its not working

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Database
View previous topic :: View next topic  
Author Message
ticebain



Joined: 08 May 2008
Posts: 1

PostPosted: Thu May 08, 2008 3:52 am    Post subject: MDB2 help, its not working Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Thu May 08, 2008 10:42 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Database All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software