Hi all,
I have written a script that reads in information from a database: name, email, password and username.
<snip nice description of problem>
Also: the only reason I am having to pull all this data from the mySql database is because for some very strange reason mySql doent like the '@' and the '.' characters in a sql statement: I actually started with a SQL query like:
SELECT name, email, password, username FROM members WHERE email='[EMAIL PROTECTED]';
BUT - it really doesnt like this, any ideas why ???
OK, I had my second cup of coffee now. Maybe you are just going about it the wrong way. Try this, or a variation of it, for MySQL server or any SQL server for that matter:
#!/usr/bin/perl -w
use strict; use DBI; my $driver_handle = DBI->install_driver("mysql"); # No sense doing anything if we don't have mysql drivers installed if ($driver_handle) { my $dbh = $driver_handle->connect("database=test","root",""); # change test, root and "" to your DB name, user and password
# use single quote here not " or you'll have grief my $srcEmail = '[EMAIL PROTECTED]';
# always use a quoter to build your queries... # I like to use qq[] with single quotes around variables for dynamic SQL my $SQL = qq[SELECT name, email, password, username FROM mytest WHERE email='$srcEmail' ];
my $sth = $dbh->prepare($SQL);
# print "$SQL\n"; # Use this line for debugging query.
$sth->execute;
# a nice way to prename variables instead of using an array while ( my ($dbname, $dbemail, $dbpwd, $dbusrname) = $sth->fetchrow_array ) { print "$dbname, $dbemail, $dbpwd, $dbusrname\n"; # or whatever you want to do with these vars. }
$dbh->disconnect( ); } else { print "Need Drivers for MySQL!\n"; }
--------- Hope this helps you get to where you want to be.
Scott.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]