Current location: Hot Scripts Forums » Programming Languages » Perl » unable to add user with httpd::useradmin


unable to add user with httpd::useradmin

Reply
  #1 (permalink)  
Old 03-08-05, 12:08 AM
abtimoteo abtimoteo is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Question unable to add user with httpd::useradmin

hi, everybody! can somebody please help me find the error in the lines of code below.

-----

use DBI;
use HTTPD::UserAdmin ();

@SQL = (DBType => "SQL",
Host => "localhost",
Port => "80",
DB => "my_database",
User => "my_username",
Auth => "my_password",
Encrypt => "crypt",
Driver => "mysql", # the default, according to docs, is mSQL
Server => "apache",
UserTable => "www-users",
NameField => "user",
PasswordField => "password"
);

$user = new HTTPD::UserAdmin @SQL;

$user->add('user2', 'password2');

-----

when run, the above produces the following error:

DBD::mysql::st execute failed: 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 '-users WHERE user='user'' at line 1 at /usr/lib/perl5/site_perl/5.6.0/HTTPD/UserAdmin/SQL.pm line 96.
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 '-users WHERE user='user'' at line 1 at addMListU2.pl line 82

thanks in advance!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-08-05, 08:10 PM
C-Security.org C-Security.org is offline
Newbie Coder
 
Join Date: Mar 2005
Location: United Kingdom
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
I think -users is being read as a command rather than a value. Remove the - and see what happens.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-08-05, 10:58 PM
Chas Chas is offline
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
I think C-Security nailed it. You either need to enclose your table name in backticks[1] or change the table name:

Code:
 UserTable => '`www-users`',
I'm not too sure how well the backticks will work though.

~Charlie

[1] http://dev.mysql.com/doc/mysql/en/legal-names.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-09-05, 05:10 AM
abtimoteo abtimoteo is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
the back ticks worked

c-security.org is right. the problem is the "-" in the string. remedied the problem with back ticks, as suggested by charlie. thanks, guys!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 flash websites for sale metamorph General Advertisements 5 01-09-05 11:03 PM
Vote / Poll - need User able to add new entries jsabarese Script Requests 2 11-30-04 01:33 AM
Filling a textbox on a parent web user control from a child web form neilault ASP.NET 1 11-14-04 11:32 PM
Looking for a PHP user management system waffffffle2 Script Requests 2 06-19-04 05:32 AM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 07:02 AM


All times are GMT -5. The time now is 07:25 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.