PHP Databases

  • tommya
  • Graduate
  • Graduate
  • tommya
  • Posts: 221
  • Loc: United Kingdom

Post 3+ Months Ago

All, I'm trying to get my head round writing databases with PHP and am getting an error with the following bit of code

Code: [ Select ]
<html>
<head>
    <title> Listing 11.1 Adding Items to a DMB Database</title>
</head>

<body>

Adding Products Now.... <p>

<?php

$dbh = dbmopen( "./data/products", "c" ) or die( "Couldn't open Database" );

dbminsert ( $dbh, "Sonic Screwdriver", "23.20" );
dbminsert ( $dbh, "Tricroder", "55.50" );
dbminsert ( $dbh, "ORAC AI", "2200.50" );
dbminsert ( $dbh, "HAL 2000", "4500.50" );

dbmclose( $dbh );

?>

</body>
</html>
  1. <html>
  2. <head>
  3.     <title> Listing 11.1 Adding Items to a DMB Database</title>
  4. </head>
  5. <body>
  6. Adding Products Now.... <p>
  7. <?php
  8. $dbh = dbmopen( "./data/products", "c" ) or die( "Couldn't open Database" );
  9. dbminsert ( $dbh, "Sonic Screwdriver", "23.20" );
  10. dbminsert ( $dbh, "Tricroder", "55.50" );
  11. dbminsert ( $dbh, "ORAC AI", "2200.50" );
  12. dbminsert ( $dbh, "HAL 2000", "4500.50" );
  13. dbmclose( $dbh );
  14. ?>
  15. </body>
  16. </html>


It is returning the error

Fatal error: Call to undefined function: dbmopen() in C:\intranet\testing\php\hour11\11.1.php on line 12

Does anyone know why this is?

Tommy
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • gsv2com
  • Professor
  • Professor
  • User avatar
  • Posts: 776
  • Loc: Nippon

Post 3+ Months Ago

From http://www.php.net/dbmopen

Quote:
If you are running php >4.0.2 and you have suddenly problems with dbmopen (i.e. it complains that the function does not exist), recompile php with --with-ndb *and* --with-db

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 66 guests
  • 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 post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.