Click here to Skip to main content
15,030,781 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi , i am middle of doing my final project for my studies . Now i'm having trouble for my fyp which is tailor management system .

my problem is i have two table (for database phpmyadmin) and form input which is ,Customer_detail(cid,customername,address,phoneno) and customer_order(orderid,customername,order_date,pickup_date) ..i want to select data customername and insert into customer order form (name :must be select option) which is the data must get from database column customername from customer_detail table .. i dont know how to create the code in php and mysql .

also how to create php code for order_date & pickup_date that must be insert into phpmyadmin database .

i hope anyone can help me :)

What I have tried:

for customer name :

connect_error) {
die("Connection failed: " . $conn->connect_error);
}
mysqli_select_db($conn,"tailorsystem"); //set the database name

$menu=" ";

$sql="SELECT cuname FROM customer"; //selection query
$rs = mysqli_query($conn, $sql);//odbc_exec($conn,$sql);


if (mysqli_num_rows($rs) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($rs)) {
$menu .= "" . $row['cuname']. "";
}
}

echo $menu;

mysqli_close($conn);

?>
Posted
Updated 11-Nov-18 3:04am

1 solution

Separate the two parts of your query. Start with extracting the various data items from the first table (SELECT). Once you have collected and validated the results you can add them to the other table with an INSERT.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900