From: Don S. <do...@se...> - 2002-10-21 13:29:44
|
Here is my example test.php. I created a mysql db 'test' with user/pass of 'test'. Each time I reload the page the id is incremented one. If I change the sequence name it starts over, and then when I change it back it picks up where it left off, as expected. Basically you just need to have a standard naming for your sequences, since the names are really only mentioned in php as you don't create the sequences until they are first needed. Don. <? require_once "DB.php"; ?> <html><body> <? $user = "test"; $pass = "test"; $host = "localhost"; $db_name = "test"; $db_type = "mysql"; $dsn = "$db_type://$user:$pass@$host/$db_name"; echo "dsn = $dsn<br />"; $db = DB::connect($dsn, true); if (DB::isError($db)) { die ("error: " . $db->getMessage()); } else { echo "Connected successfully.<br />"; } $id = $db->nextId("testSeq"); echo "id = $id<br />"; $db->disconnect(); ?> </body></html> On Mon, 21 Oct 2002, Matthew McNaney wrote: > > I still don't understand why you aren't just getting the new ID value > > via the $db->nextId() function via PEAR sequences. > > I couldn't get it to work. I will try again today and implement it if > successful. > > Post an example if you get a chance. > > Thanks, > Matt > > Matthew McNaney > Internet Systems Architect > Electronic Student Services > Email: ma...@tu... > URL: http://phpwebsite.appstate.edu > Phone: 828-262-6493 > ICQ: 141057403 > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > |