0

Here is the error I am getting:

Unknown column 'Lo' in 'field list'

Here is my code. Any suggestions to get rid of this error:

global $conn,$dal;
$customerID = mysql_insert_id();

$strSQLInsert = "insert into Orders (CustomerID, LastName) values (".$customerID.", ".$values["LastName"].")";
db_exec($strSQLInsert,$conn);

$rs = $dal->Orders->Query("CustomerID=".$customerID." and LastName=".$values["LastName"],"");
$data = db_fetch_array($rs);

$idvalue = $data["ID"];
header("Location: Orders_edit.php?editid1=".$idvalue);
exit();

4
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

put single qoute for LastName as it is varchar.

global $conn,$dal;
$customerID = mysql_insert_id();

$strSQLInsert = "insert into Orders (CustomerID, LastName) values (".$customerID.", '".$values["LastName"]."')";
db_exec($strSQLInsert,$conn);

$rs = $dal->Orders->Query("CustomerID=".$customerID." and LastName='".$values["LastName"],"'");
$data = db_fetch_array($rs);

$idvalue = $data["ID"];
header("Location: Orders_edit.php?editid1=".$idvalue);
exit();
0

Thank you for the help. I tried the code and received this error:


Fatal error: Call to a member function Query() on a non-object

Still need an assist.

0

after inserting order what you exactly want?
i means what is the need for below code:

$rs = $dal->Orders->Query("CustomerID=".$customerID." and LastName='".$values["LastName"],"'");

if you want just last inserted id then it can be directly taken by mysql_insert_id

BTW above line use Orders as a class.
check your connection class and how to use that class functions for fetch table records.

0

I want to be able to insert the two fields into the customer table, then have the customer have the next page which is orders, with the two fields in the orders page and table.

0

Here is what I am trying to do. I have two tables, customers and orders. When the fields CustomerID and LastName are entered into the customers table, I want the same variables put into the new form which will then be inserted into the orders table when the rest of the form is filled.

0

The issue seems to be escaping variables. you should use ' and " in sql stmt to clearly distinguish variables into sql query. There can be some chances the code is getting failed before reaching to this point. Good luck. Keep us updated, what works for you.

1

Form as below clearly in your code

$query = "INSERT INTO symbols (country, animal) VALUES ('$country', '$animal')";
This topic has been dead for over six months. 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.