You are missing our premiere tool bar navigation system! Register and use it for FREE!

Author: DommagePostPosted: Tue Dec 20, 2005 8:27 pm    Post subject:

Thanks Prophet, worked like a charm!

And with that, the last of my "high priority - must complete before going live" tasks is scratched off the list Very Happy

Nuke Cops -> Core Chargers

All times are GMT - 8 Hours

Page 1 of 1

Powered by phpBB © 2001,2002 phpBB Group
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 

Author: ProphetLocation: Florida, USA, Earth, SpacePostPosted: Tue Dec 20, 2005 10:43 am    Post subject:

Try this after the user has been inserted ...
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
· Home
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 163 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Some SQL troubles Some SQL troubles

Nuke Cops -> Core Chargers

Author: Dommage PostPosted: Tue Dec 20, 2005 7:42 am    Post subject: Some SQL troubles

Hey guys... I'm sure I'm making some noob mistake with this, it's been years since I've done much coding, but any help I could get would be greatly appreciated Wink

I'd trying to fill in a few extras tables when a user verifies their account. I hunted down
$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_avatar_type, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', 3, '$row[user_regdate]', '$language')");

$db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'");

in the modules/Your_Account/index.php file, and afterwards added
$db->sql_query("INSERT INTO eqdkp_users (user_id, username, user_password, user_email, user_alimit, user_elimit, user_ilimit, user_nlimit, user_rlimit, user_lang, user_style, user_key, user_lastvisit, user_lastpage, user_active, user_newpassword) VALUES (NULL, '$row[username]', '$row[user_password]', '$row[user_email]', 100, 100, 100, 10, 100, 11, 'english', NULL, 0, NULL, '1', NULL)");

This part works fine. What I want to do next is giving me some problems. I want to pull the user_id out of the eqdkp_users table for the record I just created, and then create an entry in the eqdkp_auth_users table that includes it.

First, I tried
$dkpid = $db->insert_id();
$db->sql_query("INSERT INTO eqdkp_auth_users (user_id, auth_id, auth_setting) VALUES ('$dkpid', 25, 'Y')");

No luck. It still inserted values into the table, but always used a user_id of 0. I then tried replacing the insert_id with
$dkpid = $db->sql_query("SELECT user_id FROM eqdkp_users WHERE username = '$username'");

and still get the same issue - it inserts a record, but always uses 0 as the user_id.

Any idea what I'm missing here?
$result = $db->sql_query("SELECT user_id FROM eqdkp_users ORDER BY user_id DESC");
$row = $db->sql_fetchrow($result);
$last_id = $row[user_id];

Then use $last_id wherever it's needed.
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.124 Seconds - 69 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
added by Evaders - DO NOT REMOVE
:: FI Theme :: PHP-Nuke theme by coldblooded ( ::