-1
助けてください、私はテーブルに配列(11,7,10)を挿入しています。エコーアレイからmysqlへ<option>値
like this structure iwant to make it
<select>
<option value="11">11- HbA1C</option>
<option value="7">10- O"Solivan Test</option>
<option value="10">7- Randam Blood Glucose</option>
</select>
/////////////////////////////////////
table==>
id \t name \t date \t re_doctor \t sex \t age \t no_ana \t name_pr
11 \t aaaa \t 17/04/2017 \t \t Female \t \t 11,10,7 \t 11- HbA1C,10- O"Solivan Test,7- Randam Blood Gluco.
////////////////////////////////////////////////
my code :-
<?
$qqq=$_GET['n'];
$sql = "SELECT * FROM `profile` where id ='$qqq'"; // select only the username field from the table "users_table"
$result = mysql_query($sql); // process the query
$username_array = array(); // start an array
while($row = mysql_fetch_array($result)){ // cycle through each record returned
$array1[] = $row[6]; // get the username field and add to the array above with surrounding quotes
// get the username field and add to the array above with surrounding quotes
$array3[] = $row[7]; // get the username field and add to the array above with surrounding quotes
}
?>
<select> <option>
<?
foreach($array1 as $it=>$ss){
foreach($array3 as $rr=>$vv){
if ($it==$rr) {
echo str_replace(',', '<option value="'.$ss.'">', $vv .'</option>');
}
}
}
?>
</select>
まずmysql'廃止されました1 ''としてmysqli_extension'を使用する複数の属性を行う方法です!そしてあなたのtable_nameはあなたのコメントの中で** profile **と** users_table **と言っていたからです。 – Anonymous
あなたが持っているのは、正規化が必要なデータベースです。 2番目のテーブルを作成します。ユーザー/医師のIDを追加し、「no_ana」と「name_pr」にそれぞれ1つの列を追加してから、それぞれの行を1つの行に転送します。そうすれば、ここに表示されているユーザーにリンクされている3つのID(IDは同じですが、「no_ana」と「name_pr」の内容が異なります)が表示されます。 – junkfoodjunkie
テーブル名==>プロフィール –