No Database Selected

A

Anonymous

Guest
hi guys... here am i again..
hope you could help me on this..

i have a database named jd, and it contains 3 tables.. Member, Topics and Postings... now in my registration.php page, as soon as i click the "register me" button it will direct to saveregistration.php page.. the problem is it returns an error saying "No Database Selected".. to really understand what am i talking heres a snippet...
Code:
<?
  include('config.php');
?>

<form action="saveregistration.php" method="post">
          <td width="450" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="mainborder">
              
              <tr>
                <td width="8" height="14"> </td>
                <td colspan="8" valign="top" bgcolor="#9999FF"><div align="center">Please Fill the registration form below.. </div></td>
              </tr>
              <tr>
                <td height="14"></td>
                <td width="5"></td>
                <td width="80"></td>
                <td colspan="5" valign="top"> </td>
                <td width="15"></td>
              </tr>
              <tr>
                <td height="22"></td>
                <td> </td>
                <td valign="middle"><div align="center">Last Name</div></td>
                <td colspan="5" valign="top"><input type="text" name="lname" id="lname" size="50"></td>
              <td> </td>
              </tr>
              <tr>
                <td height="2"></td>
                <td></td>
                <td></td>
                <td width="29"></td>
                <td width="57"></td>
                <td width="122"></td>
                <td width="29"></td>
                <td width="91"></td>
                <td></td>
              </tr>
              <tr>
                <td height="23"></td>
                <td></td>
                <td valign="middle"><div align="center">First Name </div></td>
                <td colspan="5" valign="top"><input type="text" name="fname" id="fname" size="50"></td>
                <td></td>
              </tr>
              <tr>
                <td height="1"></td>
              </tr>
              <tr>
                <td height="22"></td>
                <td></td>
                <td valign="middle"><div align="center">E-mail Address </div></td>
                <td colspan="5" valign="top"><input type="text" name="email" id="email" size="50"></td>
                <td></td>
              </tr>
              <tr>
                <td height="2"></td>
              </tr>
              <tr>
                <td height="22" colspan="3" valign="middle"><div align="center">Password </div></td>
                <td colspan="3" valign="top"><input type="password" name="pass" id="pass" size="30"></td>
                <td> </td>
                <td> </td>
                <td></td>
              </tr>
              <tr>
                <td colspan="3" rowspan="3" valign="middle"><div align="center">Re-type Password </div></td>
                <td height="1"></td>
              </tr>
              <tr>
                <td height="24" colspan="3" valign="top"><input type="password" name="rpass" id="rpass" size="30"></td>
                <td></td>
                <td></td>
                <td></td>
              </tr>
              <tr>
                <td height="1"></td>
              </tr>
              <tr>
                <td height="17"></td>
              </tr>
              <tr>
                <td height="14"></td>
                <td></td>
                <td></td>
                <td valign="top"><input type="checkbox" name="checkbox" value="checkbox"></td>
                <td colspan="3" valign="top">I agree to the Policies of this Site. </td>
              <td></td>
                <td></td>
              </tr>
              <tr>
                <td height="14"></td>
              </tr>
              <tr>
                <td height="26"></td>
                <td></td>
                <td></td>
                <td colspan="2" valign="top" class="buttonFormat"><input type="submit" name="Submit" value="Register Me"></td>
                <td> </td>
                <td></td>
                <td></td>
                <td></td>
              </tr>
			   <?
		 	 $result=mysql_query("Select * from Topics")or die (mysql_error());
		 	 while($row=mysql_fetch_array($result))
		 	 {
		 	 ?>
		 	 <? } ?>
		    </form>

Here's the code for saveregistration.php
Code:
<?
include('config.php');
 $lname=$_POST[lname];
 $fname=$_POST[fname];
 $email=$_POST[email];
 $pass=$_POST[pass];
 $rpass=$_POST[rpass];
 mysql_query("Insert into Member(lname,fname,email,password,rpass)values('$lname','$fname','$email','$pass','$rpass')") or die(mysql_error());
header("location:index.php");
 ?>


heres for config.php
Code:
<?
   $con=mysql_connect('127.0.0.1'.'','');
   $db=mysql_select_db("jd");
?>
hep me get this.. please...
 
Code:
<?php
   $con=@mysql_connect('127.0.0.1','','') or die(mysqlerror());
   $db=@mysql_select_db("jd") or die(mysqlerror());
?>

use that code so we can better see where it's failing, need to know if it's failing to connect or failing to select the db.

also you had mysql_connect('127.0.0.1'.'','') not mysql_connect('127.0.0.1','','')
 
hello...

i did try it out... and yes the prob is on config.php....

it returns error saying: "Access denied for user: '@%' to database 'jd'"..

why is dat so? any idea?..
 
ice_blizzard said:
hello...

i did try it out... and yes the prob is on config.php....

it returns error saying: "Access denied for user: '@%' to database 'jd'"..

why is dat so? any idea?..
You not have a permission for this table. if you are use it locale set permission for it if not ask about it at the administrator
 
must i set it in the control panel... or its something to be set in mysql.ini file?...
 
ice_blizzard said:
must i set it in the control panel... or its something to be set in mysql.ini file?...
All permission collected in mysql database. The table where is permissions sets mysql
 
you may want to allow access from other host then localhost..
as you are trying to connect from another host then localhost.. there is a problem.. login from the same machine that runs mysql server and create a new user..
 
thanks guys... i already figure it out now... thanks a lot for the hand..
 
Back
Top