0

HI,
how do i change tis code so when the php is done it gos to page running.php insted of the

" echo "1 record added"; " line ?

<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

$sql="INSERT INTO Persons (FirstName, LastName, Age)
VALUES
('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con);
?> 

thanks , I know its simple however my 420 head will not compute it just at the moment lol.

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by AndreRet
1

This should do the trick -

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
    header('Location: running.php');

    mysql_close($con);
    exit();
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.