-
-
-
-
Error connecting to database
NO need now I've found the mistake -.- been through the code few times and didn't realise that: ''".$username."', 2 upside down commas -.- (stupid dreamweaver always places ' ', and I always forget ) Thank you both anyway (: it's adding it to the database now
-
Error connecting to database
sorry my bad. the form shows up however when I try to register this: Fatal error: Call to undefined function shal() in C:\xampp\htdocs\register.php on line 7 and line 7 is: $password = mysql_escape_string(shal($_POST['password'])); got rid of the shal() and it works perfectly (: THANKS (: --edit/again/ -.- Well I do get the message however PHPmyAdmin doesn't show any users. I'll create a log in form now and see if the login work even though it doesn't show up if not.. :/
-
Error connecting to database
:/ it's not the passwords problem. I did what you suggested but still get the same results. Besides when I used the non-localhost the pass was required and Im sure it is correct so sadly that's not is :/ But thanks anyway (: //this is what you mean right?// <?php $host = 'localhost'; // mysql server domain $user = 'root'; // mysql username $pass = ''; // mysql password $db = 'tutorial'; // mysql database name $connect = @mysql_connect ($host,$user,$pass) or die('Error connecting to database!'); $select = @mysql_select_db($db,$connect) or die('Error selecting database!'); ?>
-
Error connecting to database
Hello Im using a local, MyPhpAdmin. And whenever I try loading the 'register' page I keep getting this: 'Error connecting to database!' My Code: //mysql.php// <?php $host = 'localhost'; // mysql server domain $user = 'root'; // mysql username $pass = 'root'; // mysql password $db = 'tutorial'; // mysql database name $connect = @mysql_connect ($host,$user,$pass) or die('Error connecting to database!'); $select = @mysql_select_db($db,$connect) or die('Error selecting database!'); ?> //register.php// <?php include ('mysql.php'); if (isset ($_POST["submit"])) { $username = mysql_escape_string($_POST['username']); $password = mysql_escape_string(shal($_POST['password'])); if (!empty ($username) && ($password)) { $sql = mysql_query ("INSERT INTO users ( user_id,username,user_password,user_regdate) VALUES ( '0',''".$username."','".$password."','".time()."') "); echo 'You are now registered!'; } else { echo 'You must enter a username and a password!'; } } else { echo '<form action="register.php" method="post"> Username: <input type="text" name="username" /><br /> Password: <input type="password" name="password" /><br /> <input type="submit" name="submit" value="Register" /> </form>'; } ?> I've tried using a database created on 000-webhost <?php $host = 'mysql2.######.com'; // mysql server domain $user = '***'; // mysql username $pass = '***'; // mysql password $db = 'a8124620_login'; // mysql database name $connect = @mysql_connect ($host,$user,$pass) or die('Error connecting to database!'); $select = @mysql_select_db($db,$connect) or die('Error selecting database!'); ?> (sorry with the 000-webhost the forum automatically '#' part of the host. But I am certain that it is correct) Thanks (:
-
Hi all :)
Hi all Im a newbie at web design etc. Although I have some knowledge of: html/css/c++ I am great (according to other people) at graphic design and I always had a great interest in making websites and I did create a few but nothing too advanced so hopefully I can learn a lot on this forum and be better at it