Jump to content

[SOLVED] retrieve the primary key after submitting?


simon551

Recommended Posts

Hi,

Newbie here. Just wondering if anyone can help me/point me to where I can find info on how to retrieve the primary key from a table after submitting a record through a form. I want to pull the primary key out, drop it on another form on the next page. Is that a stupid idea; like I said, newbie...

 

thanks in advance!

Parse error: syntax error, unexpected T_STRING in C:\Program Files\xampp\htdocs\vtmorg\Timesheets\whatever.php on line 9

 

<?php require_once('../Connections/conn_org.php'); ?>
<?php
mysql_select_db($database_conn_org, $conn_org);
$query_rswhatever = "SELECT * FROM timesheet_entries";
$rswhatever = mysql_query($query_rswhatever, $conn_org) or die(mysql_error());
$row_rswhatever = mysql_fetch_assoc($rswhatever);
$totalRows_rswhatever = mysql_num_rows($rswhatever);
$var = mysql_insert_id();
if ((any form post != ""))     {
  setcookie("whatever", "$var", time()+(60*60*24*30), "/", "", 0);
}
echo var$

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.