![](/img/trans.png)
[英]How to use radio buttons in a table that is retrieved from the database and store the value in another table
[英]how to store the value in a variable retrieved from mysql table and to use it in another query using php
是否有可能在php
和mysql
中使用查詢從表中獲取值並將值存儲在變量中,然后在其他查詢的條件下使用該變量,例如
$us = mysql_query("select regional from td_user where user_id='".$_SESSION['use_i']."'");
$us_row=mysql_fetch_row($us);
$reg = $us_row[`regional`] ;
現在我將值存儲在名為$reg
的變量中
$sql = "SELECT * FROM td_excel where regional = '$reg'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result)
{
<?php echo $row['Vehicle_description'];?>
<?php echo $row['Year'];?>
//it will display many rows like this
}
它沒有顯示任何記錄!!!,我以正確的方式進行操作..請幫助我!!! PS我是一個學習者!
你嘗試過這個嗎?
$sql = "SELECT * FROM td_excel where regional = ".$reg;
更改$us_row=mysql_fetch_row($us);
到$us_row=mysql_fetch_array($us);
並且還更改$reg = $us_row[
地區] ;
到$reg = $us_row['regional'] ;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.