Jump to content

Recommended Posts

so ive created a database and ive created users however whenever I get the users to log in by using username and passwords it takes me to a blank page?

 

HTML CODING

 

<HTML>
<HEAD>
<TITLE> Track Add </TITLE>
</HEAD>
<BODY BGCOLOR=lemonchiffon>

<form NAME="GetCode" ACTION="customerpage.php" METHOD="POST">

  <div align="center"><b><font size="4"> Customer log-in page</font><b><font size="3"> </font></b></b></div>
  <div align="center">
    <p> Username 
      <INPUT Name ="Customer_Username" maxlength = 30 > </p>
    <div align= "centre">
<p></p>
      <p> Password 
        <INPUT Name ="Password_Search" type="password" maxlength = 30 ></p>
      <div align= "centre"> </div>
      <p>
        <input type="submit" value="Enter" name="SUBMIT" >
      </p>
    </div>
  </div>
                      
  </form>
</BODY>
</HTML>

 

PHP CODING

 

<HTML>
<HEAD>
<TITLE>Check Customer ID</TITLE>
</HEAD>
<body BGCOLOR=lemonchiffon>

<font size="4">Customer Page<hr>
<a href="http://puma.marjon.ac.uk/~ajdref" target="_self">Click here</a> to return to the home page<p></p>

<?php 

$Customer Username = $_POST['ID_Search'];

$Password = $_POST['ID_Search'];

# connect to MySQL
$conn = @mysql_connect("localhost","ajdref","ref2")
or die ("sorry - could not wont connect to MySQL"); 

# select the specified database
$rs = @mysql_select_db("ajdref", $conn)
or die ("sorry - could not connect to the ajdref");

#execute the query - uses the mysql_query() function to issue the $sql query to the $conn connection
#$rs contains the result set in the form of an array
$rs = mysql_query($sql,$conn);

while ($row=mysql_fetch_array($rs))

Select * from CUSTOMER USERNAME where CUSTOMER USERNAME= '$CUSTOMER USERNAME' and PASSWORD = '$Password'

mysql_query($sql,$conn)or die(mysql_error());
?>

<hr>
<p>Make a booking... </p>
<p>Search for a booking...</p>
</font>
</BODY>
</HTML>

 

 

Link to comment
https://forums.phpfreaks.com/topic/66249-logging-into-a-database/
Share on other sites

That would tell me that it is not a php error.

 

One thing you might want to make certain of is that the file that contains the code that you posted as "PHP CODING" is, infact, named "customerpage.php" (The page your action is pointing to.)

I'm seconding this, since the source of your "blank page" doesn't come close to either of the scripts you posted. Neither have DOCTYPE or Content-Types.

ok i have had a good look over the pages and it still wont work - so im starting again on the pages - these are default codes that we are instructed to copy and paste (except ive changed it from Login.html and customerpage.php - to login2.hmtl and customerpage2.php because this is the second time of trying).

Login2.html - Coding

<HTML>
<HEAD>
<TITLE> Track Add </TITLE>
</HEAD>
<BODY BGCOLOR=lemonchiffon>

<form NAME="GetCode" ACTION="customerpage2.php" METHOD=post>

  <div align="center"><b><font size="4"> Customer log-in page</font><b><font size="3"> </font></b></b></div>
  <div align="center">
    <p> Username 
      <INPUT Name ="ID_Search" maxlength = 30 > </p>
    <div align= "centre">
<p></p>
      <p> Password 
        <INPUT Name ="Pwd_Search" type="password" maxlength = 30 ></p>
      <div align= "centre"> </div>
      <p>
        <input type="submit" value="Enter" name="SUBMIT" >
      </p>
    </div>
  </div>
                      
  </form>
</BODY>
</HTML>

 

Customerpage2.php Coding

<HTML>
<HEAD>
<TITLE>Check Customer ID</TITLE>
</HEAD>
<body BGCOLOR=lemonchiffon>

<font size="4">Customer Page<hr>
<a href="http://puma.marjon.ac.uk/~your_user_name/path&filename" target="_self">Click here</a> to return to the home page<p></p>

<?php 

$User_ID = $_POST['ID_Search'];

?>

<hr>
<p>Make a booking... </p>
<p>Search for a booking...</p>
</font>
</BODY>
</HTML>

You can't have spaces in your variable names. Your connection is working if you aren't getting the error, "sorry - could not wont connect to MySQL," it just isn't returning any results because of the bad variables.

 

Well, he has errors supressed, so there is no way to tell if the connection is working.

 

I think the @ should be banned :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.