adamdyer Posted August 22, 2007 Share Posted August 22, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/ Share on other sites More sharing options...
lemmin Posted August 22, 2007 Share Posted August 22, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331349 Share on other sites More sharing options...
adamdyer Posted August 22, 2007 Author Share Posted August 22, 2007 yeh tried that but still getting a blank page :s Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331355 Share on other sites More sharing options...
lemmin Posted August 22, 2007 Share Posted August 22, 2007 Does mysql let you have spaces in field names? Do you even see the horizontal rule and "Make a booking..." etc. text at the bottom? Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331357 Share on other sites More sharing options...
adamdyer Posted August 22, 2007 Author Share Posted August 22, 2007 nope, nothing at all. could it have anything to do with this: <a href="http://puma.marjon.ac.uk/~ajdref" target="_self">Click here</a> to return to the home page<p></p> am I missing something from there? Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331360 Share on other sites More sharing options...
lemmin Posted August 22, 2007 Share Posted August 22, 2007 No, that shouldn't matter. The blank page occurs when you submit the form in your "HTML CODING," right? If you view source on that blank page, is there anything in there? Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331364 Share on other sites More sharing options...
adamdyer Posted August 22, 2007 Author Share Posted August 22, 2007 source from the blank page <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD> <BODY></BODY></HTML> and yes, i submit the form from the HTML Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331366 Share on other sites More sharing options...
lemmin Posted August 22, 2007 Share Posted August 22, 2007 Does this work if you take the php code out? If it does, start commenting out lines of php until you can get it to display something. I don't see anything too obvious, yet. Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331369 Share on other sites More sharing options...
adamdyer Posted August 22, 2007 Author Share Posted August 22, 2007 done that, but even when i take out the entire php code i still dont get the make a booking, search for a booking thing Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331373 Share on other sites More sharing options...
lemmin Posted August 22, 2007 Share Posted August 22, 2007 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.) Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331376 Share on other sites More sharing options...
Hypnos Posted August 22, 2007 Share Posted August 22, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331391 Share on other sites More sharing options...
adamdyer Posted August 23, 2007 Author Share Posted August 23, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-331715 Share on other sites More sharing options...
lemmin Posted August 23, 2007 Share Posted August 23, 2007 Have you ever gotten any php to work in the same place you are trying it now? Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-332074 Share on other sites More sharing options...
Jessica Posted August 23, 2007 Share Posted August 23, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/66249-logging-into-a-database/#findComment-332080 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.