Hi,
I was wonder how would I get the last inserted record, as I want to display the record I just inserted on the screen.
I was thinking I might need another
$sqlResult = @mysql_query("Select * FROM Customer WHERE Name='$Name'"
;
after the insert query.
But how would I select the record using the CustomerID rather then the Name. The thing is I can't get the CustomerID since it is auto incremented.
My code looks something like
---
$sqlResult = @mysql_query("INSERT INTO Customer VALUES (NOT NULL, '$Title', '$Name', '$Address1', '$Address2','$CSP','$Postcode','$City','$Country', '$Telephone', '$Email','$CardType','$CardNumber','$IssueNumber', '$Year''$Month''01','$CardHolder')"
;
while ( $row = mysql_fetch_array($sqlResult) )
{
echo("<TABLE>"
;
echo("<TR><TD>CustomerID : </TD><TD>" . $row["CustomerID"] . "</TD></TR>"
;
echo("<TR><TD>Title : </TD><TD>" . $row["Title"] . "</TD></TR>"
;
echo("<TR><TD>Name : </TD><TD>" . $row["Name"] . "</TD></TR>"
;
....
....
....
-----
Grateful for any help, thanks.
I was wonder how would I get the last inserted record, as I want to display the record I just inserted on the screen.
I was thinking I might need another
$sqlResult = @mysql_query("Select * FROM Customer WHERE Name='$Name'"
after the insert query.
But how would I select the record using the CustomerID rather then the Name. The thing is I can't get the CustomerID since it is auto incremented.
My code looks something like
---
$sqlResult = @mysql_query("INSERT INTO Customer VALUES (NOT NULL, '$Title', '$Name', '$Address1', '$Address2','$CSP','$Postcode','$City','$Country', '$Telephone', '$Email','$CardType','$CardNumber','$IssueNumber', '$Year''$Month''01','$CardHolder')"
while ( $row = mysql_fetch_array($sqlResult) )
{
echo("<TABLE>"
echo("<TR><TD>CustomerID : </TD><TD>" . $row["CustomerID"] . "</TD></TR>"
echo("<TR><TD>Title : </TD><TD>" . $row["Title"] . "</TD></TR>"
echo("<TR><TD>Name : </TD><TD>" . $row["Name"] . "</TD></TR>"
....
....
....
-----
Grateful for any help, thanks.