Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

Help needed

Aloittaja GT, joulukuu 09, 2005, 11:34:51 AP

« edellinen - seuraava »

GT

Hi

I'm working on a site which needs to be up and running by monday but I still have some issues.
I've added a couple of textboxes to registration form by adding a fewlines of code to register.template.php. Just that. Haven't done anything else. Not touched any other file.
Now what I want is that:

1. These 2 fields, that i've added, should be mandatory at the time of registration
2. These fields show up in themes table so that I may be able to access this information through phpMyadmin.

I know these topics have been discussed before but there's so much information that i get
confused.

Any help would be greatly appreciated. Thanks!

GT


GT

Could someone please reply to this message. PLZ

Grudge

You'd need to edit Register2() in Register.php.

Assuming your fields were called setting1 and setting2, at the top you'd put something like:


if (empty($_POST['setting1']) || empty($_POST['setting2']))
  fatal_error('You must fill in the setting!');


Then, after the member is registered and the ID_MEMBER is known, put something like:

db_query("
  INSERT INTO {$db_prefix}themes
    (ID_MEMBER, ID_THEME, variable, value)
  VALUES
    ($ID_MEMBER, 1, 'setting1_name', '$_POST[setting1]')
    ($ID_MEMBER, 1, 'setting2_name', '$_POST[setting2]')", __FILE__, __LINE__);
I'm only a half geek really...

GT

Thanks a lot for your reply but there's still a problem. I'm not sure where to add 'db_query........' part of code.
I tried different places but everytime I get this message.

"Database Error
Please try again. If you come back to this error screen, report the error to an administrator."

Could you please let me know. I'll really appreciate.

Thanks! 

Grudge

GT,

Go to "View Error Log" in your admin centre and it will tell you what the database error message was, it's something wrong with the query.
I'm only a half geek really...

GT

Hi

This is the error I get. What do I need to do differently?

8: Undefined variable: ID_MEMBER
File: /home/content/g/t/l/(my user id here)/html/smf/Sources/Register.php
Line: 359

8: Undefined variable: ID_MEMBER
File: /home/content/g/t/l/(my user id here)/html/smf/Sources/Register.php
Line: 360

Database Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' 1, 'role_name', '1')
(, 1, 'gender_name', '2')
(, 1, '
File: /home/content/g/t/l/(my user id here)/html/smf/Sources/Register.php
Line: 360

Grudge

You have either put the query in the wrong place or the variable is not called ID_MEMBER. It needs to go after the query that has "INSERT INTO {$db_prefix}members

After that query there will be a line saying list ($something) = db_insert_id();

the variable is whatever $something is, it's either gonna be $ID_MEMBER or $memID - can't recall off the top of my head.
I'm only a half geek really...

GT

Hi

I replaced ID_member with memberID and it works now. But there's still one error in error log.

Database Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(30, 1, 'gender', '1')
(30, 1, 'age', '1')' at line 5
File: /home/content/g/t/l/gtlsu/html/smf/Sources/Register.php
Line: 348

Do I need to define these variable somewhere or is there some error with the query?

Thanks!



GT

Grudge

Could you please help?

Thanks

Advertisement: