Jump to content
MakeWebGames

Recommended Posts

Posted

I register the account, and when i log into it, well when i TRY to log in, it says "No Database Selected" on a plain white screen, please help lol.

mysql.php is set up:

 

<?

$c=mysql_connect('localhost','USER','PASS') or die(mysql_error());
mysql_select_db('fallen',$c);

?>

the database name is fallen.

Posted

Re: No Database Selected

I normally get that erro when i dont say what db i need.

Or when the fields name is a function.

in the query call it.

ex:

mysql_query("SELECT userid FROM dbname.tablename WHERE blah=$blah"); 
Posted

Re: No Database Selected

in authenticate.php:

$uq=mysql_query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());

changed that to

mysql_query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());

 

it doesnt work

i dont know what you mean and where to put it

Posted

Re: No Database Selected

 

$uq=mysql_query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());

 

to

 

$uq=mysql_query("SELECT userid FROM fallen.users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());
Posted

Re: No Database Selected

Cool ;)

Anyone else using this must ask me :@

Here is mine:

<?php
session_start();
include "mysql.php";
global $c;
?>
<style type='text/css'>
.style1 {
font-family: Tahoma;
font-size: x-small;
}
.style2 {
font-family: Tahoma;
font-size: xx-small;
color: #FFFFFF;
font-weight: bold;
}
.style4 {font-size: xx-small; color: #999999; font-family: Tahoma;}
.style7 {font-family: Tahoma; font-size: xx-small;}
.style8 {font-size: xx-small}
body {
background-image: url([url]http://www.gangsterterritory.com/bgmain.gif[/url]);
background-repeat: repeat;
}
</style>
<title>Login</title>
<center>

<h3>
<div align="center" class="style1">


[img=yourlogo.png]</p>
 <table width="50%" border="0" cellpadding="10" cellspacing="5">
   <tr>
     <td bgcolor="#333333" class="style2">Login >> Authenticateion  </td>
   </tr>
   <tr>
     <td bgcolor="#000000" class="style4"><div align="center">
  <?php

$user = $_POST['username'];
$pass = $_POST['password']; 
$safe_user = mysql_real_escape_string($user);
$safe_pass = mysql_real_escape_string($pass);
if ($safe_user == "" || $safe_pass == "")
{
echo "You did not enter a Username or Password.


<a href=login.php>> [b]Back[/b]</a>";
exit;
}
$uq = mysql_query("SELECT userid FROM users WHERE login_name='$safe_user' AND `userpass`=md5('$safe_pass')",$c) or die(mysql_error());
if (mysql_num_rows($uq)==0)
{
echo "Incorrect Username or Password.


<a href=login.php>> [b]Back[/b]</a>";
exit;
}
else
{
$mem = mysql_fetch_array($uq);
$_SESSION['loggedin']=1;
$_SESSION['userid']=$mem['userid'];
?>
<div align="center">
       <p class="style7">[b]Processing Log in</span>[/b]

       </p>
       </div>
       <p align="center" class="style1"><span class="style8">If you are not redirected within 10 seconds please click [url='loggedin.php']here[/url].

           </span>

       </p>
       <p align="center"><span class="style4">

           </span><span class="style7">[email='[email protected]']Click here to contact an administrator.[/email]</span></p>
<?php 
echo "<meta http-equiv='Refresh' content='5; URL=loggedin.php'>";
}
?>
</td>
   </tr>
 </table>


</p>
</div>
</center>
Posted

Re: No Database Selected

You always need the servername prefix to connect to a db

do what lostone said kraig (same counts for the user, needs the servername prefix)

Posted

Re: No Database Selected

Lost one f**koff.

My authenticate.php has a connection to the database ****!

You are truly the LOST one here

 

I edited a word which would offend, at the very least, most women. -vinyl

Posted

Re: No Database Selected

Guys please stop arguing, you both tried.

but i can sign up and everything but if i try log in it doesnt work :s

I have checked my password is correct

Posted

Re: No Database Selected

One last thing losty..

I gave my whole script ;)

--------Done----------

 

KrAiG, try the one i gave you(authenticate.php).

It cant be the mysql.php as your register works.

Posted

Re: No Database Selected

still says incorrect.

and if i sign up and try log in it still doesnt work, i dont think that the register file is working, because i can sign up with the same username loads of times

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...