cvs: pearweb /sql addcategories.php

From: Date: Sat, 01 Sep 2001 17:11:52 +0000
Subject: cvs: pearweb /sql addcategories.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-732@lists.php.net to get a copy of this message
cox Sat Sep 1 13:11:52 2001 EDT Added files: /pearweb/sql addcategories.php Log: Script to add sample categories to pear database (testing purpouses) Index: pearweb/sql/addcategories.php +++ pearweb/sql/addcategories.php <?php // Drops all categories and adds sample categories error_reporting(E_ALL); require_once 'DB.php'; require_once 'DB/storage.php'; require_once '../include/pear-database.php'; PEAR::setErrorHandling(PEAR_ERROR_DIE); $dbh = DB::connect('mysql://pear:pear@localhost/pear'); $dbh->query('DELETE FROM categories'); $categories = array( 'Benchmark' => '', 'Cache' => '', 'Console' => '', 'Crypt' => '', 'DB' => '', 'Date' => '', 'File' => '', 'HTML' => '', 'HTTP' => '', 'Image' => '', 'Log' => '', 'Mail' => '', 'Math' => '', 'Net' => '', 'Numbers' => '', 'Payment' => '', 'Schedule' => '', 'XML' => '' ); foreach($categories as $name => $desc) { add_category(array('name' => $name, 'desc' => $desc)); } /*$sql = 'select * from categories order by id'; $res = $dbh->query($sql); echo "-------------------\n"; while($res->fetchInto($row, DB_FETCHMODE_ASSOC)) { foreach($row as $field => $value) { echo "$field => $value\n"; } echo "-------------------\n"; }*/ ?>

« previous php.pear.cvs (#732) next »