I want get id from this output and Update database how i can get From This query?
$text = "<test>output: 1;outdoor: 456;<test>
<test>output: 2;outdoor: 4564;<test>
<test>output: 3;outdoor: 645;<test>
<test>output: 4;outdoor: 765;<test>";
mysql_query("UPDATE test SET outdoor = $outdoor" where id = $output);
please try my answer
<?php
$text = "<test>output: 1;outdoor: 456;<test>
<test>output: 2;outdoor: 4564;<test>
<test>output: 3;outdoor: 645;<test>
<test>output: 4;outdoor: 765;<test>";
$text_arr = explode("\n",$text);
foreach($text_arr as $val_text_arr){
/*echo $val_text_arr."<bR>";*/
$output = explode(";",explode("output: ",$val_text_arr)[1])[0];
echo "output ".$output ."\n";
$outdoor = explode(";",explode("outdoor: ",$val_text_arr)[1])[0];
echo "outdoor ".$outdoor ."\n";
/*you can update here ypur query*/
mysql_query("UPDATE test SET outdoor = $outdoor" where id = $output);
}
?>
output:
output 1
outdoor 456
output 2
outdoor 4564
output 3
outdoor 645
output 4
outdoor 765
php link where i try this https://eval.in/872778
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.