Re: DB first time use

From: Date: Tue, 27 Apr 2004 03:11:59 +0000
Subject: Re: DB first time use
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12143@lists.php.net to get a copy of this message
According to mysql docs http://dev.mysql.com/doc/mysql/en/Reserved_words.html 'name' is NOT a reserved word. I just created 'name' field in my MySql test db and it worked fine. But as to the problem at hand...I have no clue, Sorry:) > I think 'name' is a reserved word in mySQL. > >> Hi All, >> >> I'm doing a project, and am trying to use DB for the first time. >> >> I've got as far as the following: >> <?php >> require_once("DB.php"); >> $dsn = array( >> 'phptype' => 'mysql', >> 'username' => 'root', >> 'password' => 'password', >> 'hostspec' => 'localhost', >> 'database' => 'portal', >> ); >> >> $options = array( >> 'debug' => 2, >> 'portability' => DB_PORTABILITY_ALL, >> ); >> >> $db =& DB::connect($dsn, $options); >> >> if (DB::isError($db)) { >> die($db->getMessage()); >> } >> $sql = 'select * from agents'; >> >> $res =& $db->query($sql); >> >> if (DB::isError($res)) { >> die($res->getMessage()); >> } >> echo $res->numRows(); // returns 1 >> >> while ($res->fetchInto($agent)) { >> echo $agent['name'] . "\n"; //returns Undefined index: Name >> } >> ?> >> >> As you can see from my comments, it correctly returns the number of >> rows, >> however doesn't recognize any indexes. I've installed the latest version >> 1.6.2.... >> >> Am I doing something really silly? >> >> Cheers >> James >> >> -- >> PEAR General Mailing List (http://pear.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.pear.general (#12143) next »