dezkit Posted February 27, 2008 Share Posted February 27, 2008 basicly this is my first time using and I TOTALLY SUCK! =p can somebody please explain to do a simple register and login script. something like this one http://www.phpeasystep.com/workshopview.php?id=6 Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 everytime i put in "john" "1234" in the main_login.php and press submit, it says cannot connect Quote Link to comment Share on other sites More sharing options...
peranha Posted February 27, 2008 Share Posted February 27, 2008 What does your script look like, can you post it in code tags Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 checklogin.php <?php ob_start(); $host="localhost"; $username="dezkit"; $password="******"; $db_name="test"; $tbl_name="members"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ob_end_flush(); ?> Quote Link to comment Share on other sites More sharing options...
peranha Posted February 27, 2008 Share Posted February 27, 2008 It cannot connect to the database at localhost with the specified username and password. make sure that those are correct in the script, and that My sql is running. Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 how do i make mysql run? lol Quote Link to comment Share on other sites More sharing options...
peranha Posted February 27, 2008 Share Posted February 27, 2008 put phpinfo() in a phpinfo.php page and go to it, see if my sql is there. dont forget the php opening and closing tags Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 edit: yea i see all of those words that i dont know Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 btw im using yahoo smallbusiness Quote Link to comment Share on other sites More sharing options...
peranha Posted February 27, 2008 Share Posted February 27, 2008 MySQL is showing up then, what do you use to create tables and databases then. Can you connect to the database that way. Quote Link to comment Share on other sites More sharing options...
peranha Posted February 27, 2008 Share Posted February 27, 2008 I am not familiar with that, but is it installed on your PC Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 its not, where can i dl it? Quote Link to comment Share on other sites More sharing options...
peranha Posted February 27, 2008 Share Posted February 27, 2008 Do you have a mysql database test or do you need to download mysql. http://dev.mysql.com/downloads/ that is the mysql link if that is what you need. the community server is free, and there is a enterprise server which you can pay for. Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 what should i use in my localhost, dezkit@localhost or just localhost? Quote Link to comment Share on other sites More sharing options...
peranha Posted February 27, 2008 Share Posted February 27, 2008 Just localhost Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 this is getting frustrating, should i contact Yahoo! ? Quote Link to comment Share on other sites More sharing options...
peranha Posted February 27, 2008 Share Posted February 27, 2008 installing my sql on local host has nothing to do with yahoo. if the website resides on yahoo, then you will have to get their connection information to the sql database. Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 i never installed mysql, it comes with the yahoo plan. Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted February 27, 2008 Share Posted February 27, 2008 <?php //Connect To Database $hostname="h50mysql13.secureserver.net"; $username="username"; $password="password"; $dbname="database"; mysql_connect($hostname,$username, $password) OR DIE ("Unable to connect to database! Please try again later."); mysql_select_db($dbname); ?> This is my connect code - I use godaddy.com . It should be similar. Notice that localhost does not exist because mysql is on a different server than your website files... Quote Link to comment Share on other sites More sharing options...
peranha Posted February 27, 2008 Share Posted February 27, 2008 you need to get a hold of yahoo, or check in your plan for the connection information. localhost is for your PC Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 guys.... http://help.yahoo.com/l/us/yahoo/smallbusiness/webhosting/mysql/mysql-06.html Quote Link to comment Share on other sites More sharing options...
peranha Posted February 27, 2008 Share Posted February 27, 2008 By the looks $host = "mysql"; you will have to create a database with a user and password. Quote Link to comment Share on other sites More sharing options...
dezkit Posted February 27, 2008 Author Share Posted February 27, 2008 peranha, thank you mate, i love you for all your time. you are the best person on the internet lol Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.