Support Forums

Full Version: Create Newsletter subscription
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Thanks Ninja for the share..
thaxn for sharing it
keep getting this error on the send.php file..I copied/pasted your code 2X and it's still giving the same error:
Parse error: syntax error, unexpected ')' in /home/uglycars/public_html/test/php/send.php on line 4

also getting this error on the subscribe.php
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'uglycars_test'@'localhost' (using password: YES) in /home/uglycars/public_html/test/php/subscribe.php on line 24
Connection failed!
(10-09-2009, 10:16 PM)andrewjs18 Wrote: [ -> ]keep getting this error on the send.php file..I copied/pasted your code 2X and it's still giving the same error:
Parse error: syntax error, unexpected ')' in /home/uglycars/public_html/test/php/send.php on line 4

also getting this error on the subscribe.php
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'uglycars_test'@'localhost' (using password: YES) in /home/uglycars/public_html/test/php/subscribe.php on line 24
Connection failed!

Ohhh... man I've posted a wrong syntax, sorry for that.
The first error is here
PHP Code:
if(!isset($_POST['send'])) {
    die(
"Failed to submit your E-Mail!");); 
remove the ); on the end of the die() function

The second error occurs because you didn't define right mysql access variables
PHP Code:
$db = array(
    
'host' => 'localhost',
    
'user' => 'root'// input your mysql database username here
    
'pass' => ''// if you are using a password to access the database the input it here
    
'base' => 'newsletter' // you should create a new database named newsletter 
); 

I guess you are having problems with the database, change the "base" to the name of your database and create needed table in it.
Wow, very nice share.

Hoping to use this somewere across the line.
(10-09-2009, 10:30 PM)NinjaGeek Wrote: [ -> ]Ohhh... man I've posted a wrong syntax, sorry for that.
The first error is here
PHP Code:
if(!isset($_POST['send'])) {
    die(
"Failed to submit your E-Mail!");); 
remove the ); on the end of the die() function

The second error occurs because you didn't define right mysql access variables
PHP Code:
$db = array(
    
'host' => 'localhost',
    
'user' => 'root'// input your mysql database username here
    
'pass' => ''// if you are using a password to access the database the input it here
    
'base' => 'newsletter' // you should create a new database named newsletter 
); 

I guess you are having problems with the database, change the "base" to the name of your database and create needed table in it.

first problem is fixed, but the subscripe.php is still having issues with the db...I changed the base to 'mails' which is the name of the db & table and I know the username/password is correct.

base= name of database or name of table? either way, I tried both and it's not working...

sorry, I'm new to php/mysql so bare with me.
(10-10-2009, 07:33 AM)andrewjs18 Wrote: [ -> ]first problem is fixed, but the subscripe.php is still having issues with the db...I changed the base to 'mails' which is the name of the db & table and I know the username/password is correct.

base= name of database or name of table? either way, I tried both and it's not working...

sorry, I'm new to php/mysql so bare with me.

Ok, wait I've just woke up, so I need to think bit longer.
Do you use this on your local server wamp/xamp/lamp?
If are you sure you have a password for a mysql database?
(10-10-2009, 01:30 AM)Bartdevil Wrote: [ -> ]Wow, very nice share.

Hoping to use this somewere across the line.

Thank you very much!
(10-10-2009, 09:08 AM)NinjaGeek Wrote: [ -> ]Ok, wait I've just woke up, so I need to think bit longer.
Do you use this on your local server wamp/xamp/lamp?
If are you sure you have a password for a mysql database?
(10-10-2009, 01:30 AM)Bartdevil Wrote: [ -> ]Wow, very nice share.

Hoping to use this somewere across the line.

Thank you very much!

I'm testing this on a web host- hostmonster

and yes, there's a password. I've checked all of my other files that connect to a db and they all use localhost as the host.
(10-10-2009, 10:44 AM)andrewjs18 Wrote: [ -> ]I'm testing this on a web host- hostmonster

and yes, there's a password. I've checked all of my other files that connect to a db and they all use localhost as the host.

Ok if they all use localhost as host that isn't the problem.
But if you have a script that already connects to your database without errors you can always include it in this script.

The script I've posted does connect to the database without errors, so I can only guess that there is a error within the $db array.

Try one of your settings from other files that connect to the database and create the table mails in the database that the script uses.
(10-13-2009, 02:12 AM)immi Wrote: [ -> ]welldone ninja ;)

Thank you! Blackhat
Pages: 1 2 3