Can see rows, and insert rows but cannot get or fetch.

From: Date: Thu, 07 Jul 2005 23:51:00 +0000
Subject: Can see rows, and insert rows but cannot get or fetch.
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-6483@lists.php.net to get a copy of this message
My class will tell me how many characters are in the table but it will not get or fetch any of them. I can make it do inserts but using whereAdd does nothing. I'm very green to php and DB_dataobjects. All the code is in the same script. /* start code */ $person = new DataObjects_chr_characters; $number_of_rows = $person->find(); echo "<br>Number of row: " . $number_of_rows . "<br>"; /*end code*/ This will return 32 as the count. That is the total number of characters in the system. /*start code */ $people = array(); echo "Starting loop <br>"; while ($person->fetch()) { /* store the results in an array */ echo "Going through all my records"; echo "GOT {$person->chr_name}<BR>"; } echo "ending loop <br> "; /* end code*/ All that shows up on the web page is starting loop and ending loop. I thought maybe it could read the classes but not correctly connect to the database so after I do the above I do this piece of code. /*start code */ $person3 = new DataObjects_chr_characters; $person3->chr_name='Miky'; $person3->chr_page='www.deleteme.com'; $id = $person3->insert(); /* end code*/ This puts a row in the table that I have to delete. So I try to delete the member. /*start code */ $person3 = new DataObjects_chr_characters; $person3->whereAdd("chr_name = '%Miky%' "); $person3->delete(DB_DATAOBJECT_WHEREADD_ONLY); /* end code*/ Every time I run the script I get another Miky row and nothing gets deleted. Like wise the $person->fetch never returns any objects. Any help would be greatly appreciated as I'm sure this is some dumb rookie mistake.

« previous php.pear.doc (#6483) next »