Jump to content

header redirect not working


joecooper

Recommended Posts

       if(($trucks*10)<=$money){     //if they can afford it
       $money=$money-($trucks*10);
           $result = mysql_query("UPDATE users SET location='{$_GET['newlocation']}' WHERE username='$username'") or die(mysql_error());
           $result = mysql_query("UPDATE users SET money='$money' WHERE username='$username'") or die(mysql_error());
           header("Location: index.php");

       }

 

this will put the data in the MySQL DB but wont redirect the page to index.php afterwards

Link to comment
https://forums.phpfreaks.com/topic/104362-header-redirect-not-working/
Share on other sites

Well try this too:

 

$link_update ="path_to_the_page";

echo "<script language=\"javascript\">";

echo "location.href = \"$link_update\"";

echo "</script>";

exit();

 

It is the same thing actually, but give it a try :)

 

P.S. and yeah if 1 of the queries fives you an error then the code won't work.

Archived

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

×
×
  • Create New...

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.