31
m0nty
Re: Database tables -- insert codes
  • 2006/2/11 5:29

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


add before the sql query

$uname = trim($newuser->getvar('uname'));
$pass = trim($newuser->getvar('pass'));
$email = trim($newuser->getvar('email'));

then the sql query >

$xoopsDB->query("INSERT INTO pcpin_user (login, email, password) VALUES ('$uname', '$email', '$pass')");

32
wtravel
Re: Database tables -- insert codes

Monty, your code will not work because the values in between the quotes are not translated, the value stored in the database would actually be $uname for the username instead of wtravel.

The reason why it did not work is that there were too many quotes in my last post . Instead of the above solution, try this sql statement. I would like to add Monty's suggestion of using the trim() function which strips off any whitespaces from the values.
$uname "'".trim($newuser->getvar('uname'))."'";
$pass "'".trim($newuser->getvar('pass'))."'";
$email "'".trim($newuser->getvar('email'))."'";

$sql sprintf("INSERT INTO %s (login, email, password) VALUES (%s, %s, %s)"'pcpin_user'$uname$email$pass);

33
RSearcy
Re: Database tables -- insert codes
  • 2006/2/13 14:53

  • RSearcy

  • Just popping in

  • Posts: 45

  • Since: 2004/3/2 2


I can't thank ya'll enough. With a lil' tweak to a default value in the pcpin_user table, IT WORKS!

(FYI, the value was the "activation" field....it was kicking out the chat user because it wasn't activated, so I went into phpMyAdmin and changed the default value from 0 to 1 so they'll all be activated)

This might not be the last lil' thing, though. Now that I know how to do this, it may be a lil' easier, but I don't know for sure. lol I now need to integrate a photo gallery that I also tried as a module for XOOPS which didn't work. I'm gonna try all the solutions and suggestions y'all gave me in this thread and apply them to that (including checking for MD5 encryption).

Thanks again for all the help!

Login

Who's Online

338 user(s) are online (274 user(s) are browsing Support Forums)


Members: 0


Guests: 338


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits