this part is i am un sure what its doing.
while($row = mysql_fetch_array($sql))
{
$id = $row["id"];
}
why cant i do this?
$row = mysql_fetch_assoc($item_query);
$id = $row['id'];
this is my login in script.
full code
//BINARY for case sensitive
$sql = mysql_query("SELECT user_id FROM user WHERE user_name='$username_p' AND BINARY password='$password_p'");
//make sure person exists in database---
$existCount = mysql_num_rows($sql); //count the rows where the sql is ture
if($existCount == 1) //make sure name is only one in database
{
while($row = mysql_fetch_array($sql))
{
$id = $row["id"];
}
//cookies doesnt get destory when window is close
setcookie("id", $id, time()+172800);
setcookie("username", $username_p, time()+172800); //seconds - 2 days
header("location: ../index.php");
}