Skip to main content
Participant
November 5, 2011
Question

Database Issue

  • November 5, 2011
  • 1 reply
  • 1218 views

Hello all,

I created a database with two tables, working well on local server, but when placed on remote server, the database refused to be populated from the same form I used it with on my local server, all the form work same way on the pages but I couldn't see any data in my database.

Can somebody please help me out.

thanks all

Treasure

This topic has been closed for replies.

1 reply

Participant
November 5, 2011

Below are my php code for the whole stuff

myconfig. php

<?php

$con=mysql_connect("localhost","leomconn_leom","leom123");

if(!$con)

{

die("Database connection failed: ".mysql_error());

}

//selecting the database and inserting into the database

mysql_select_db("leomconn_leomdatabase",$con);

?>

signup.php (this is to do two things, to populate my table members and send mail to the registrant)

<?php

if (isset($_POST['Submit']))

{

include("myconfig.php");

$username = $_POST["username"];

$firstname = $_POST["firstname"];

$lastname = $_POST["lastname"];

$password = $_POST["password"];

$email = $_POST["email"];

$phone = $_POST["phone"];

$bankname = $_POST["bankname"];

$accountname = $_POST["accountname"];

$accountnumber = $_POST["accountnumber"];

$follow = $_POST["follow"];

$sponsor = $_POST["sponsor"];

$check = mysql_query("SELECT * FROM members WHERE username = '$username'");

if(mysql_num_rows($check)==0)

{

$ins = mysql_query("INSERT INTO members(username, firstname, lastname, password, email, phone, bankname, accountname, accountnumber, follow, sponsor) VALUES('$username', '$firstname', '$lastname', '$password', '$email', '$phone', '$bankname', '$accountname', '$accountnumber', '$follow', '$sponsor')");

echo "<font color=#000000  size=+2> Registration Succefull</font>"; echo "<br/>";

echo "<br/>";

echo "<font color=#000000 size=+2> To activate your account send ur payment detail to payment@leomconnect.com</a></font>";

}

else

{

echo "<font color=#000000 size=+2> Username already exist</font><br/>";

}

}

?>

<?php

if(isset($_POST['Submit']))

{

$username = $_POST["username"];

$firstname = $_POST["firstname"];

$lastname = $_POST["lastname"];

$password = $_POST["password"];

$email = $_POST["email"];

$phone = $_POST["phone"];

$bankname = $_POST["bankname"];

$accountname = $_POST["accountname"];

$accountnumber = $_POST["accountnumber"];

$follow = $_POST["follow"];

$sponsor = $_POST["sponsor"];

$message="Username:$username\n\n Firstname:$firstname\n\n Lastname:$lastname\n\n Password:$password\n\n Email:$email\n\n Phone Number:$phone\n\n Bank Name:$bankname\n\n Account Name:$accountname\n\n Account Number:$accountnumber\n\n Follow:$follow\n\n Sponsor:$sponsor ";

mail("reg@leomconnect.com","Registration form",$message,"From:$email");

//creating an auto reply message for the user that fills the form

$message2="Dear $firstname,\n\n Thank you for filling our registration form\n\n Admin\n LeomConnnect";

//declaring the mail function for the user that fills inputs should recieve

mail("$email","thank you",$message2,"From:admin@leomconnect.com");

}

?>

registered.php (to populate table registered)

<?php

if (isset($_POST['Submit']))

{

include("myconfig.php");

$username = $_POST["username"];

$password = $_POST["password"];

$check = mysql_query("SELECT * FROM registered WHERE username = '$username'");

if(mysql_num_rows($check)==0)

{

$ins = mysql_query("INSERT INTO registered(username, password) VALUES('$username', '$password')");

echo "<br/>";

echo "<font color=#000000  size=+2> Entered Succefully</font>"; echo "<br/>";

echo "<br/>";

}

else

{

echo "<font color=#000000 size=+2> Username already exist</font><br/>";

}

}

?>

send_password_ac.php (to send password to member who forgot password)

<?php

$host="localhost"; // Host name

$username="leomconn_leom"; // Mysql username

$password="leom123"; // Mysql password

$db_name="leomconn_leomdatabase"; // Database name

//Connect to server and select databse.

$con=mysql_connect("localhost","leomconn_leom","leom123");

if(!$con)

{

die("Database connection failed: ".mysql_error());

}

//selecting the database and inserting into the database

mysql_select_db("leomconn_leomdatabase",$con);

// value sent from form

$email_to=$_POST['email_to'];

// table name

$tbl_name=members;

// retrieve password from table where e-mail = $email_to(mark@phpeasystep.com)

$sql="SELECT password FROM members WHERE email='$email_to'";

$result=mysql_query($sql);

// if found this e-mail address, row must be 1 row

// keep value in variable name "$count"

$count=mysql_num_rows($result);

// compare if $count =1 row

if($count==1){

$rows=mysql_fetch_array($result);

// keep password in $your_password

$your_password=$rows['password'];

// ---------------- SEND MAIL FORM ----------------

// send e-mail to ...

$to=$email_to;

// Your subject

$subject="Your password is here";

// From

$header="from: admin <admin@leomconnect.com>";

// Your message

$messages= "Your password for login to our website \r\n";

$messages.="Your password is $your_password \r\n";

$messages.="Thanks... \r\n";

// send email

$sentmail = mail($to,$subject,$messages,$header);

}

// else if $count not equal 1

else {

echo "Not found your email in our database <br />";

}

// if your email succesfully sent

if($sentmail){

echo "Your Password Has Been Sent To Your Email Address.";

}

else {

echo "Cannot send password to your e-mail address";

}

?>

I will be happy if anybody can help me fix this.

Owainnorth
Inspiring
November 7, 2011

You're aware this is a ColdFusion forum not a PHP one? I suspect the help you'll get from here will be limited for that reason.

Inspiring
November 7, 2011

You're aware this is a ColdFusion forum not a PHP one? I suspect the help you'll get from here will be limited for that reason.

Where's your sense of (a different ~) community, mate?

So much for "Awesome Owain".

--

Adam