me again!! gettin the last row in a table
Posted: Wed May 07, 2003 9:55 am
hi!
I have a piece of code that works properly if i use it in the query analyseer but when i use it in my code it doesnt work!
I want it to take the last call id just entered and unsert it into another table!
It will work for the very first row but then every row inserte dinto that table after has the exact same value!!!
Any ideas would be great thanx!!
I have a piece of code that works properly if i use it in the query analyseer but when i use it in my code it doesnt work!
I want it to take the last call id just entered and unsert it into another table!
It will work for the very first row but then every row inserte dinto that table after has the exact same value!!!
Code: Select all
<?php
$Q03 = "INSERT INTO $dblog VALUES('$emp_username','$cust_username','$company_name','$date','$time','$call_type','$description','$priority','$res_call_imm','$solution','$assigned_to','$resolved','$solution2','$call_closed_date')";
$R03 = odbc_exec($db,$Q03) or die("Bad Q03:".mysql_error());
$Q93 = "SELECT TOP 1 Call_ID from calls_logged order by Call_ID desc; ";
$R93 = odbc_exec($db,$Q93) or die("Bad Q93:".mysql_error());
$result = odbc_fetch_into($R93,$A93);
$Q73 = "INSERT INTO
$dbcall_log
VALUES('$result','$emp_username','$cust_username','$date')";
$R73 = odbc_exec($db,$Q73) or die("Bad Q03:".mysql_error());
odbc_free_result($R73);
?>Code: Select all
Table one
Call_ID
1
2
3
4
Table two
1
1
1
1