Hello ,
$sql = "select col1 , col2 from table where id=2"; // sometimes query larger
$q = $conn->prepare($sql);
$q->execute(array_values($v));
$q->setFetchMode(PDO::FETCH_BOTH);
while($r = $q->fetch())
{
echo " $r[$i]";
}
Code is Working Fine.
Now i want To save Query Result to Another Temporary Table. i Dont know no. of columns generated in Query result. Each time Query is different so columns and data is different. So How store that Query result to another table.
You could let MySQL do that work for you, eg via
CREATE TEMPORARY TABLE new_tbl SELECT * FROM orig_tbl WHERE ...
see http://dev.mysql.com/doc/refman/5.1/en/create-table.html
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.