PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old May 11th, 2008, 08:09 AM
Breana Breana is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 2 Breana User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m 13 sec
Reputation Power: 0
Exclamation SQL Help! Insert after new user?

Ok i am trying to help my friend add a SQL insert command to his form but so far it just wont insert the value like i want it to so i wanted to post the original insert code and mine to see if anyone can see an error or a way to get it working!

Original code:
PHP Code:
// PROFILE FIELD INPUTS PROCESSED AND CHECKED FOR ERRORS ABOVE
  // IF THERE IS NO ERROR, ADD USER AND USER PROFILE AND CONTINUE TO STEP 3
  
if($is_error == 0) {

    
$new_user->user_create($signup_email$signup_username$signup_password$signup_timezone$signup_lang);

    
// INSERT ACTION
    
$actions->actions_add($new_user"signup", Array('[username]'), Array($new_user->user_info[user_username])); 


My code, i created a table in se_users called user_points int(20) not null default 0, and i am trying to inset a valu of 1000 into it when a user signs up!

PHP Code:
 $puid$new_user->user_info['user_username'];   $signup_points=$new_user->user_info['user_username']+1000;
$sql="UPDATE se_users SET user_points='$signup_points' WHERE user_info='$puid'"


Am i doing it wrong? i am no master of sql lol
It don't seem to give an error and after it saves the new user is there but the points is 0...

Last edited by Breana : May 11th, 2008 at 08:13 AM. Reason: error in text...

Reply With Quote
  #2  
Old May 11th, 2008, 10:54 AM
lnxgeek lnxgeek is offline
I AM A GOLDEN GOD
Dev Shed God (5000 - 5499 posts)
 
Join Date: Apr 2003
Location: cannot find symbol: method showLocation()
Posts: 5,391 lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level)lnxgeek User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 9 h 46 m 50 sec
Reputation Power: 685
Welcome to DevShed.

This is clearly a PHP question as you've posted about 95% PHP code and a very small (PHP dependent) SQL statement. Even if it were more SQL based this is still the wrong forum.

Without more insight as to how the class works and what the SQL statement is supposed to look like, I'm afraid we can't help you. Your class should have some sort of error handling built in or pass to an error handling object; if you would show the output of any errors from the SQL statement it would be helpful. Also helpful would be to verify what RDBMS is being used (MySQL?), the table structure, etc.

Requesting this be moved to the appropriate forum.
__________________
BookMooch.com : Give books away. Get books you want.

Reply With Quote
  #3  
Old May 11th, 2008, 11:00 AM
Breana Breana is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 2 Breana User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m 13 sec
Reputation Power: 0
Thanks for the reply i did get it i was going in the wrong direction because his script uses Smarty so i re-did the code added the tag in the smarty/scripts section and now it works...

But i do have a question u might be able to answer, how can you affect the value of to colloums at once in one call code?

Like, $database->database_query("UPDATE se_users SET user_points='$status_points' WHERE user_id='".$user->user_info[user_id]."' LIMIT 1");

and have it load the next half of the code it keeps skipping over the send part witch is flagging the users to 0

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > SQL Help! Insert after new user?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway