Re: howto get PK id after INSERT??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think I got it correct got the most part. I am having a problem with
the urlencode function I believe.
 
On page CustomerAddNew1.php ( page than handles form data ) im using:
 
$last_id = mysql_query("SELECT LAST_INSERT_ID() from customerinfo");
$last_id = urlencode ($last_id);
header("Location: UserMain.php?custid='$last_id'");
 
and on the UserMain.php page I am using this to return the data:
 
$cid = "$last_id";
ini_set('display_errors', 1);
error_reporting(E_ALL &~ E_NOTICE);
$connect = mysql_connect("") or die ("unable to connect to database" .
mysql_error() . ""); $select = mysql_select_db("") or die ("unable to
connect to database" . mysql_error() . "SPDATA"); $result =
mysql_query("select * from customerinfo where custid='$cid'") or die
(mysql_error("Unable to query database")); while ($row =
mysql_fetch_array($result)) { $firstname = $row['firstname']; $lastname
= $row['lastname']; <snip>
 
I am not able to display the data that was just entered. If I change
select * from customerinfo where custid=3 it will display row 3 data.
Can someone point out where I went wrong?
 
Thanks again for the help
 

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux