mysql - Echo out specific value from array PHP? -
i need insert specific array values in html form. query, fetch , array mysql table. when print_r($array) below output.
question: let´s want echo out value dæk bag
html form question, how do that?
info: have 40 questions in form.
ps. app own use only, , aware of use of mysqli or pdo instead of mysql -> change asap.
array:
array ( [0] => 1 [id] => 1 [1] => dæk [title_task_dk] => dæk ) array ( [0] => 2 [id] => 2 [1] => dæk bag [title_task_dk] => dæk bag ) array ( [0] => 3 [id] => 3 [1] => dæk alm. [title_task_dk] => dæk alm. ) array ( [0] => 4 [id] => 4 [1] => dæk indl. [title_task_dk] => dæk indl. ) array ( [0] => 5 [id] => 5 [1] => slange/lapning [title_task_dk] => slange/lapning )
my php code:
<?php $results = mysql_query("select * task_list"); while($array = mysql_fetch_array($results)) { print_r($array); } ?>
my mysql table:
create table `task_list` ( `id` int(11) not null auto_increment, `title_task_dk` varchar(255) not null, primary key (`id`) ) engine=innodb auto_increment=37 default charset=utf8;
try match key/value expected result array
while($array = mysql_fetch_array($results)) { if($array['id'] == 2) { echo $array['title_task_dk']; } }
Comments
Post a Comment