Jump to content

Archived

This topic is now archived and is closed to further replies.

Monshery

Have A Simple Question

Recommended Posts

Well my question is how - do i insert data into my sql database i mean i done know how to use the quary i know how to load data from sql but dont know how the quarry of inserting or updateing a table look like or working - can anyone show a simple cose how to do so ? [img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /]

Second question is - i made a login form which connecting to sql - checking username and password and if they correct it will say something like welcome --<name of user> when i click on a link to another page and then going back the session somehow been deleted or some - its dont save the session and i have to reeneter the password and username .. code is like this :

This is on the TOP of page.
[code]
<?
$MMO_LINK=mysql_connect('localhost','Monshery','m7625zsw') or die("Connection fail");
mysql_select_db('mmodate',$MMO_LINK);
$MMO_USERD = mysql_query("SELECT * FROM USERDETAIL WHERE USERNAME = '$_POST[USERNAME]'",$MMO_LINK);
$MMO_LOGin = mysql_fetch_array($MMO_USERD);
$CHANGEV = $_POST['USERNAME'];
if(($CHANGEV == $MMO_LOGin['USERNAME']) && ($MMO_LOGin['PASSWORD'] == $_POST['PASSWORD']) && ($_POST['PASSWORD'] != null))
{
session_start();
$_SESSION['SUSERNAME'] = $MMO_LOGin['USERNAME'];
$_SESSION['SADMINL'] = $MMO_LOGin['ADMINL'];
}
else
{
$ErrorM = "Your username or passward is wrong please insert a new 1";
}
?>
[/code]



This is when the actualy form comes
[code]
<?PHP
if(isset($_SESSION['SUSERNAME']))
{
?>
<span class="style9">welcome <? echo $_SESSION['SUSERNAME']; ?></span><?
}
else
{
?>
<FORM action="INDEX.PHP" method="POST">
<p align="center" class="style12">Username:</p>
<p align="center">
  <input name="USERNAME" type="text" id="USERNAME" size="30" maxlength="30">
</p>
<p align="center" class="style12">Password:</p>
<p align="center">
  <input name="PASSWORD" type="password" id="PASSWORD" size="30" maxlength="30">
</p>
<p align="center">
  <input name="LOGIN" type="submit" id="LOGIN" value="Login">
  <span class="style8">--------------  </span>
</FORM> </p>
<span class="style8">
<FORM action="Register.PHP" method="POST">
<input name="REGISTER" type="submit" id="REGISTER" value="Register">
</FORM>
</span>
<p>  
<?
}
?>
[/code]

Any help will be apprciated with how do i make someone that login to not have to log in again everytime he change a page.

i though of useing sid on every link i do but .. not sure thats how thats gonna work.
Thnx in advance.

Share this post


Link to post
Share on other sites

×

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.