join() function combines array elements into a string.
join() function is an alias of implode() function.
Example
$arr = array('hello','world!','beautiful','day!');
echo join(" ",$arr);
?>Output:hello world! beautiful day!
The following is a dedecms search page condition using the join function
if($this->starttime > 0)
{
$ksqls[] = " arc.senddate>'".$this->starttime."' ";
}
if($this->typeid > 0)
{
$ksqls[] = " typeid in (".getsonids($this->typeid).") ";
}
if($this->channeltype > 0)
{
$ksqls[] = " arc.channel='".$this->channeltype."'";
}
if($this->mid > 0)
{
$ksqls[] = " arc.mid = '".$this->mid."'";
}
$ksqls[] = " arc.arcrank > -1 ";
$this->addsql = ($ksql=='' ? join(' and ',$ksqls) : join(' and ',$ksqls)." and ($ksql)" );
It forms a select * from table where condition, which is constructed into a complete sql query statement according to the amount of $ksql
Note: join() can receive two parameter orders. However, due to historical reasons, explode() does not work. You must ensure that the separator parameter comes before the string parameter.
Tables in the database tutorial can be linked to each other by keys. The primary key is a column in which the value of each row is unique. In a table, each primary key value is unique. The purpose of this is to cross-bundle data between tables without duplicating all the data in each table.