>>
Site Map
>>
Forums
>>
Modules 6x
Forum module - topics in forum:
Modules 6x - Discussions regarding PHP-Nuke Modules.
SQL InsertID
Hey all,
I'm attempting to write a module for PHP Nuke, but I'm having a hard time finding some information I need on working with databases. Basically, my problem right now is that I want to know the id of an insertion I'm making into an auto increment table. In the perl dbi I could go something like this:
db->{mysql_insertid}
after inserting something...But I'm not sure of the way I could do something like this in PHPNuke. Because PHPNuke seems to act as its own DBI, I'm not sure if there is a way...Also, is there an FAQ for working with databases in PHPNuke? Almost everytime I have to do something with a database I have to go nuts trying to find out how it would be done in PHPNuke.
Thanks in advance for all replies
Mark
heya
kinda not clear here what you want to do
are you building a new table aswell
if so will you be pulling info from the users table for the user_id or will this be a seperate table with seperate user_id's ?
what kind of module are you working on
i've build a few now so now your pain
but generally a good knowlegde of php and the mysql db is all you need
some good sites that i use are
http://dev.mysql.com/doc/mysql/en/index.html
http://www.phpfreaks.com/
http://forums.devnetwork.net/
but google always helps too
Thanks for the response
If I'm not mistaken (and I very well could be), you have to do all your database interactions via the databases "module" that PHPNuke creates. My problem lies basically in that I'm not too sure how to mess with Databases in PHPNuke and in PHP in general. I'm somewhat new to PHP, but have a lot of experience in Perl...What I'm trying to do is this:
When I insert an item into a table, say "users", I want to know the number of the user I'm creating. So if the table structure is like this:
ID Username
I have to know the ID after having completed the insert. The ID field increments each time something is inserted into the table. In perl I could find the ID of the item that I just inserted into the database by accessing the mysql_insertid variable inside the database object, thus $db->{mysql_insertid} If I went something like:
$id = $db->{mysql_insertid};
print "You're user number $id";
I'd get the usernumber. So basically what I need to know if there's a different method to doing this in phpnuke. I'm just a little confused by the way that we're supposed to interact with Databases in PHPNuke since we're not using the standard PEAR DB DBI.
Thanks again
Mark
Oh, and the module I'm working on is one that meets the needs of our website. It's simply a module that will process a form, place it in a database, and allow administrators to view the items. It's for
http://www.floridakeyclub.org/ and is meant to help tally community service hours that are completed by members of the organization

So nothing that really aids the PHPNuke community too much, but something that our organization needs nonetheless
Mark
hiya Mark007
will these be allready members of your site ?
if so i would just create a new table in the DB and use the user_id in the new table
if you like email the details of what you would like style functions and ill get it started for you