简体   繁体   中英

Websql Database insert data into one table not another?

Hello Friend I Face a Strange Problem. I developing the PHP Desktop Application,

And I am using the websql Database.When I submitted the Data into users table

Data Submitted Successfully.But When I submitted to another Table Data is not

Submitted.table Structure is same.I don't Know what to do for this?

Please help. Here is my code...

<?php

session_start();
//$WindowUser = getenv('username');
//$myPDO = new PDO("sqlite:C:/Users/".$WindowUser."/Desktop/barber_shop/webcache/databases/http_127.0.0.1_51915/2");
include("../sqlitePhpDatabase/sqlitePhpDatabase.php");   
$store_name = $_POST['store_name'];
$street = $_POST['street'];
$status = $_POST['status'];
$location_id = $_POST['location_id'];

 $sth = $myPDO->exec("INSERT INTO bs_stores(store_name,street, status,location_id)VALUES('store_name','$street','$status','$location_id')");
//$sth = $myPDO->exec("INSERT INTO bs_locations(city)VALUES('rere')");
if(isset($sth) && !empty($sth))
{
    echo "done";    
}
else
{
    echo "data is not submiting";   
}   ?>

Try this code for copy all data :-

INSERT INTO tab1 SELECT * FROM tab2;

or this for copy selected data:-

INSERT INTO tab1
SELECT col1,
       col2,
       col3,
       NULL
  FROM tab2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM