Jump to content
MakeWebGames

No Database Selected


CraigF

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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());
Link to comment
Share on other sites

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>
Link to comment
Share on other sites

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...