Hi,
I am very new to PHP and trying to write a small bit of code to insert a record to the database. The code gives me a No database Selected error. I have tried to check the connection to the database and it does get connected.
Thanks for your help in advance
[php]
<?php require_once('../Connections/connect.php'); ?> <?php $today = date("Y-m-d H:i:s"); if ($_POST['form_submitted'] == '1') { ##User is registering, insert data until we can activate it $activationkey = mt_rand().mt_rand(); $user_name = mysql_real_escape_string($_POST[user_name]); $user_last = mysql_real_escape_string($_POST[user_last]); $user_pass = mysql_real_escape_string (md5($_POST[user_pass])); $user_email = mysql_real_escape_string($_POST[user_email]); $telephone = mysql_real_escape_string($_POST[telephone]); $sql="INSERT INTO local_advertisers (user_name, user_last, user_pass, user_email, telephone, registerdate, activationkey, registrationstatus) VALUES ('$user_name', '$user_last', '$user_pass', '$user_email', '$telephone', '$today', '$activationkey', 'verify')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } ?>[/php]