dnishe Posted June 18, 2009 Share Posted June 18, 2009 Please help me out here this works offline but when i upload it just wont work $sql = mysql_query ("SELECT * FROM mydb WHERE add = '$un' && pin ='$pswd'") or die (mysql_error()); if ($sql) { $fixid = mysql_fetch_array($sql); header("location:home.php?user=$id"); } my redirection would work witout the parameters passed but offline its different online Link to comment https://forums.phpfreaks.com/topic/162734-problem-with-haderlocationhomephpuserid/ Share on other sites More sharing options...
trq Posted June 18, 2009 Share Posted June 18, 2009 Saying something simply doesn't work doesn't help us help you much. What do you mean by 'won't work'? I don't see $id defined anywhere. Link to comment https://forums.phpfreaks.com/topic/162734-problem-with-haderlocationhomephpuserid/#findComment-858783 Share on other sites More sharing options...
dnishe Posted June 18, 2009 Author Share Posted June 18, 2009 ok.... when offline it would redirect and would pass the "user=$id" but when i put it online it would just redirect without the "user=$id" Link to comment https://forums.phpfreaks.com/topic/162734-problem-with-haderlocationhomephpuserid/#findComment-858787 Share on other sites More sharing options...
trq Posted June 18, 2009 Share Posted June 18, 2009 Again, I don't see $id defined anywhere in the code you posted. Link to comment https://forums.phpfreaks.com/topic/162734-problem-with-haderlocationhomephpuserid/#findComment-858800 Share on other sites More sharing options...
dnishe Posted June 18, 2009 Author Share Posted June 18, 2009 Again, I don't see $id defined anywhere in the code you posted. here is the code $un = mysql_real_escape_string(trim($_POST['usr'])); $pswd = mysql_real_escape_string(trim($_POST['pin'])); $sql = mysql_query ("SELECT * FROM mydb WHERE add = '$un' && pass ='$pin") or die (mysql_error()); if ($sql) { $fixid = mysql_fetch_array($sql); $id = $fixid['id']; header("location:home.php?user=$id"); } Link to comment https://forums.phpfreaks.com/topic/162734-problem-with-haderlocationhomephpuserid/#findComment-858804 Share on other sites More sharing options...
trq Posted June 18, 2009 Share Posted June 18, 2009 You never check your query actually returns any result. $un = mysql_real_escape_string(trim($_POST['usr'])); $pswd = mysql_real_escape_string(trim($_POST['pin'])); if ($result = mysql_query("SELECT * FROM mydb WHERE add = '$un' && pass ='$pin'")) { // check you got a result. if (mysql_num_rows($result)) { $fixid = mysql_fetch_array($result); $id = $fixid['id']; header("location:home.php?user=$id"); exit; } else { echo "No result found"; } } else { echo mysql_error(); } Link to comment https://forums.phpfreaks.com/topic/162734-problem-with-haderlocationhomephpuserid/#findComment-858807 Share on other sites More sharing options...
dnishe Posted June 18, 2009 Author Share Posted June 18, 2009 You never check your query actually returns any result. $un = mysql_real_escape_string(trim($_POST['usr'])); $pswd = mysql_real_escape_string(trim($_POST['pin'])); if ($result = mysql_query("SELECT * FROM mydb WHERE add = '$un' && pass ='$pin'")) { // check you got a result. if (mysql_num_rows($result)) { $fixid = mysql_fetch_array($result); $id = $fixid['id']; header("location:home.php?user=$id"); exit; } else { echo "No result found"; } } else { echo mysql_error(); } that i did but my problem is not offline... when i upload this page online i dont get the parameters passed through the url i just get the home.php alone without the ?user=$id thats my problem.... what could be the cause Link to comment https://forums.phpfreaks.com/topic/162734-problem-with-haderlocationhomephpuserid/#findComment-858838 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.