I would like to select multiple table in one query say like below and insert into multiple table:
$result = $db->sql_query("SELECT * FROM data1,data2,data3,data4 WHERE person='" .$name. "'");
$row = $db->sql_fetchrow($result);
$day = $row['regtime'];
$days = (strtotime(date("Y-m-d")) - strtotime($row['regtime'])) / (60 * 60 * 24);
if($row > 0 && $days < 15){
$row = ['name'];
$row = ['age'];
//etc
}else { //do something
if ($row == 0 && $name > 0){
$db->sql_query("INSERT INTO data1 ??????
}
This seems problem as days are not been calculated hence it always process new data and not accessing stored data in table…
Is there any way which this can get work??
It looks like you want to use a join. There are a lot of different joins, but all of them involve asking for one or more columns in the first table to be lined up with one or more columns in the second table. In your query above, you’re including lots of tables in the FROM clause, but you aren’t specifying how the tables should be joined together.
Without knowing what each table looks like, it’s hard to give an example using your tables. The link I provided above has many, many examples.