For the parameter passing problem on the php page, please advise
$query = $db->findall("p_newsclass where f_id='$_GET[cid]'");while ($row = $db->fetch_array($query)) {$news_class_in.= $row[id].",";}echo $news_class_in=$news_class_in."$_GET[cid]";
Is to display the news list and print it out correctly.
But it is written to SQL.
$result = mysql_query("select id from p_newsbase where cid in ($news_class_in)");$total = mysql_num_rows($result);pageft($total, 20);if ($firstcount < 0)$firstcount = 0;$query = $db->findall("p_newsbase where cid in ($news_class_in) limit $firstcount, $displaypg");
An error occurs. the obtained cid has changed.
Reply to discussion (solution)
$ News_class_in. = $ row [id]. ",";
In this way, a comma is added, which can be removed using substr or rtrim:
While ($ row = $ db-> fetch_array ($ query )){
$ News_class_in. = $ row [id]. ",";
}
$ New_class_in = rtrim ($ new_class_in ,",");
Echo $ new_class
It should be the SQL error caused by the last comma in the parentheses of cid in ().
The URL is an id. how can I GET it with $ _ GET [cid?
The URL is an id. how can I GET it with $ _ GET [cid?
$query = $db->findall("p_newsclass where f_id='$_GET[cid]'");while ($row = $db->fetch_array($query)) {$news_class_in.= $row[id].",";}echo $news_class_in=$news_class_in."$_GET[cid]";
This is the cid obtained by directly printing the URL.
The link specified for the htm file written below is cid.
{section name=l loop=$sm_list} {$sm_list[l].cidname} {$sm_list[l].title}
{$sm_list[l].date_time}
{/section}
$ News_class_in. = $ row [id]. ",";
In this way, a comma is added, which can be removed using substr or rtrim:
While ($ row = $ db-> fetch_array ($ query )){
$ News_class_in. = $ row [id]. ",";
}
$ New_class_in = rtrim ($ new_class_in ,",");
Echo $ new_class
It should be the SQL error caused by the last comma in the parentheses of cid in ().
Thank you for your answers. let me see the following. why is there no comma after I print it directly?
In the last figure, the incorrect SQL statement has an additional ",".
In this case, a comma is added at the end of the write loop.
$ News_class_in has a comma at the end of the variable.
Add one sentence:
$news_class_in = trim($news_class_in, ',');