March 15, 200917 yr Can someone help me in making a PHP script so that when i login it displays whatevers in another column... in my DB i have 1 table and 4 columns •Username = acct ID •Ammnt. = info to be displayed •Exp. Date = displayed below the ammnt. it is the date that the said ammount has to be paid •location = location to be redirected to ( TAKE NO NOTICE OF THIS ) right now the script i have is when i login it redirects me to another another webpage that what that location column is for but instead i want it to display the ammount and the Exp. date any help would be appreciated. . . This is the code for my login.html <html> <body> <form method="post" action="checklogin.php"> <fieldset> <legend>Create User</legend> <p><label for="Username">Acct. ID: </label><input type="text" name="username" id="username" /></p> <input type="submit" name="submit" id="submit" value="Go" class="btn" /> </fieldset> </form> </body> </html> The form action will look for checklogin.php <?php $host="localhost"; $username="root"; $password=""; $db_name="test"; $tbl_name="members"; mysql_connect("$host", "$username")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $username=$_POST['username']; $username = stripslashes($username); $username = mysql_real_escape_string($username); $sql="SELECT location FROM $tbl_name WHERE username='$username' "; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ session_register("username"); session_register("id"); $get_url = "SELECT location FROM $tbl_name WHERE username='$username' "; $url=mysql_query($get_url); $row = mysql_fetch_assoc($url); $max_id=$row['location']; header('Location: '.$max_id); exit; } else { echo "Wrong Acct. ID!"; } ?>
March 15, 200917 yr Can someone help me in making a PHP script so that when i login it displays whatevers in another column... in my DB i have 1 table and 4 columns •Username = acct ID •Ammnt. = info to be displayed •Exp. Date = displayed below the ammnt. it is the date that the said ammount has to be paid •location = location to be redirected to ( TAKE NO NOTICE OF THIS ) right now the script i have is when i login it redirects me to another another webpage that what that location column is for but instead i want it to display the ammount and the Exp. date any help would be appreciated. . . This is the code for my login.html <html> <body> <form method="post" action="checklogin.php"> <fieldset> <legend>Create User</legend> <p><label for="Username">Acct. ID: </label><input type="text" name="username" id="username" /></p> <input type="submit" name="submit" id="submit" value="Go" class="btn" /> </fieldset> </form> </body> </html> The form action will look for checklogin.php <?php $host="localhost"; $username="root"; $password=""; $db_name="test"; $tbl_name="members"; mysql_connect("$host", "$username")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $username=$_POST['username']; $username = stripslashes($username); $username = mysql_real_escape_string($username); $sql="SELECT location FROM $tbl_name WHERE username='$username' "; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ session_register("username"); session_register("id"); $get_url = "SELECT location FROM $tbl_name WHERE username='$username' "; $url=mysql_query($get_url); $row = mysql_fetch_assoc($url); $max_id=$row['location']; header('Location: '.$max_id); exit; } else { echo "Wrong Acct. ID!"; } ?> try this link it will help you http://www.tizag.com/mysqlTutorial/mysqlfetcharray.php
March 15, 200917 yr Author Tried it not so sure if thats what i want though All i want is to display a single cell of data the ammnt. nevermind the exp. date SO •When you type in your acct. id and press go •It takes you to a page or pops up a box displaying whatever is in the ammnt. cell I dont want to display all of the ammnt. only the one corresponding to that acct ID could anyone provide a script or teach me how to make one you could add me in YM so that we could chat philipcuddehay1(at)yahoo(dot)com
Create an account or sign in to comment