Jump to content

help with header("location:polish.php"); i have problem


Recommended Posts

hi some people can help me i dont why im put this to my Hostmaster www.one.com but my

if ($query)
						{
							header("[color=red]location:polish.php[/color]");	
						}

 

is not work they will not header to my polish.php when im finished with my update in my database

 

 <?
                    	$raekke = $_POST['raekke'];
					$modelnr = $_POST['modelnr'];
					$navn = $_POST['navn'];
					$priser = $_POST['priser'];
					$display = $_POST['display'];
					$bruger = $_POST['bruger'];
					$salg = $_POST['salg'];
					$usedup = $_POST['usedup'];
					$instock = $_POST['instock'];
					$totaltstock = $_POST['totaltstock'];
					$username="usename"; // Mysql username 
					$password="password"; // Mysql password 


					mysql_connect ("hostt","$username", "$password") or die ("cannot connect");
					mysql_select_db("database") or die ("cannot select DB");
					$query="INSERT INTO opi(id, raekke, modelnr, navn, priser, display, bruger, salg, usedup, instock, totaltstock) VALUES ('NULL', '".$raekke."', '".$modelnr."','".$navn."', '".$priser."', '".$display."','".$bruger."','".$salg."','".$usedup."','".$instock."','".$totaltstock."')";
					mysql_query($query) or die ('error updating databasen');

					mysql_close($query);
					if ($query)
						{
							header("location:polish.php");	
						}


?>

 

i want to when im finished they will header to my polish.php

 

thanks

this:

header("location:polish.php");

 

(like you have it in your bottom script) should work fine. the problem must be with

if($query)...

 

if the condition isn't met, your page will not redirect. I'm guessing you have some problem with the database connection or query.

change these 3 lines:

 

mysql_query($query) or die ('error updating databasen');
mysql_close($query);
if ($query)

 

to:

 

$result = mysql_query($query) or die ('error updating databasen');
mysql_close();
if ($result)

 

and try again

your database is called database?

 

 <?
$raekke = $_POST['raekke'];
$modelnr = $_POST['modelnr'];
$navn = $_POST['navn'];
$priser = $_POST['priser'];
$display = $_POST['display'];
$bruger = $_POST['bruger'];
$salg = $_POST['salg'];
$usedup = $_POST['usedup'];
$instock = $_POST['instock'];
$totaltstock = $_POST['totaltstock'];
$username="usename"; // Mysql username 
$password="password"; // Mysql password 


$c = mysql_connect ("hostt","$username", "$password") or die ("cannot connect");
mysql_select_db("database",$c) or die ("cannot select DB");
$query="INSERT INTO `opi` (`raekke`, `modelnr`, `navn`, `priser`, `display`, `bruger`, `salg`, `usedup`, `instock`, `totaltstock`)
VALUES ('$raekke','$modelnr','$navn','$priser','$display','$bruger','$salg','$usedup','$instock','$totaltstock')";
$result = mysql_query($query,$c) or die ('error updating databasen');
@mysql_close($c);
if ($result){
header("location:polish.php");
}
?>

<?                    	$raekke = $_POST['raekke'];						$modelnr = $_POST['modelnr'];						$navn = $_POST['navn'];						$priser = $_POST['priser'];						$display = $_POST['display'];						$bruger = $_POST['bruger'];						$salg = $_POST['salg'];						$usedup = $_POST['usedup'];						$instock = $_POST['instock'];						$totaltstock = $_POST['totaltstock'];						$username="usename"; // Mysql username 						$password="password"; // Mysql password 																		mysql_connect ("Host name","$username", "$password") or die ("cannot connect");						mysql_select_db("polish") or die ("cannot select DB");						$query="INSERT INTO opi(id, raekke, modelnr, navn, priser, display, bruger, salg, usedup, instock, totaltstock) VALUES ('NULL', '".$raekke."', '".$modelnr."','".$navn."', '".$priser."', '".$display."','".$bruger."','".$salg."','".$usedup."','".$instock."','".$totaltstock."')";						$result = mysql_query($query) or die ('error updating databasen');												mysql_close($result);						if ($result )							{								header("location:polish.php");			?>					}

????

 

mysql_connect ("THIS NEEDS TO BE YOUR HOST NAME","$username", "$password") or die ("cannot connect");

 

(probably 'localhost')

 

mysql_select_db("THIS NEEDS TO BE YOUR DATABASE NAME",$c) or die ("cannot select DB");

<?
                    	$raekke = $_POST['raekke'];
					$modelnr = $_POST['modelnr'];
					$navn = $_POST['navn'];
					$priser = $_POST['priser'];
					$display = $_POST['display'];
					$bruger = $_POST['bruger'];
					$salg = $_POST['salg'];
					$usedup = $_POST['usedup'];
					$instock = $_POST['instock'];
					$totaltstock = $_POST['totaltstock'];
					$username="User"; // Mysql username 
					$password="PASS"; // Mysql password 


					mysql_connect ("HOST NAME","$username", "$password") or die ("cannot connect");
					mysql_select_db("DATABASE NAME") or die ("cannot select DB");
					$query="INSERT INTO opi(id, raekke, modelnr, navn, priser, display, bruger, salg, usedup, instock, totaltstock) VALUES ('NULL', '".$raekke."', '".$modelnr."','".$navn."', '".$priser."', '".$display."','".$bruger."','".$salg."','".$usedup."','".$instock."','".$totaltstock."')";
					$result = mysql_query($query) or die ('error updating databasen');						
					mysql_close($result);
					if ($result )
						{
							header("location:polish.php");	
						}


?>

i have try this code but it not work. i dont why went i try in my location server this code work fine, when i finished to update in database they will jump back to my polish.php but went i upload to my hostmaster server they will not jump back to polish.php i dont why??? can some one help me

 

thanks u

database is called "polish", and I expect your host is 'localhost'...

 

 

Try this. Don't forget to change the username and password to access your database

 

<?php
$raekke = $_POST['raekke'];
$modelnr = $_POST['modelnr'];
$navn = $_POST['navn'];
$priser = $_POST['priser'];
$display = $_POST['display'];
$bruger = $_POST['bruger'];
$salg = $_POST['salg'];
$usedup = $_POST['usedup'];
$instock = $_POST['instock'];
$totaltstock = $_POST['totaltstock'];
$username="usename"; // Mysql username 
$password="password"; // Mysql password 


$c = mysql_connect ("localhost","$username", "$password") or die ("cannot connect");
mysql_select_db("polish",$c) or die ("cannot select DB");
$query="INSERT INTO `opi` (`raekke`, `modelnr`, `navn`, `priser`, `display`, `bruger`, `salg`, `usedup`, `instock`, `totaltstock`)
VALUES ('$raekke','$modelnr','$navn','$priser','$display','$bruger','$salg','$usedup','$instock','$totaltstock')";
$result = mysql_query($query,$c) or die ('error updating databasen');
@mysql_close($c);
if ($result){
header("location:polish.php");
}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.