Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How can i fix this? i want make this :
$diagnosa=blabla , blabla2 , blabla3 , ;
and then i use foreach but it cannot work,
$nama_diagnosa = Laporan::ViewDataDiagnosa(2,'2015-02-02');
$diagnosa = foreach ($nama_diagnosa as $cellDiagnosa){
echo $cellDiagnosa['nama_diagnosa']." , ";
}
[resolved]
Finally I added temporary variables to hold data for diagnosatemp variable, then I add a diagnosa variable like this
$nama_diagnosa=Laporan::ViewDataDiagnosa($cell['id_pasien'],$cell['tgl_rekam']);
$diagnosa = '';
foreach ($nama_diagnosa as $cellDiagnosa){
$diagnosaTemp=$cellDiagnosa['nama_diagnosa'];
$diagnosa=$diagnosa.",".$diagnosaTemp;
} echo $diagnosa;
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
enter image description here
show me how to fix this error , although there are quite a few posts but mine is a bit different . I don't understand php well thanks !
details of the error code line: $datainfo['category'] = $category['name'];
The error states that PHP cannot find the key "name" in an array. To counteract the error, you can make the following check and assignment at the point where the array is set.
Many ways to do it:
long version
if (! isset($category['name'])) {
$category['name'] = "";
}
medium long version
$datainfo['category'] = (isset($category['name'])) ? $category['name'] : "";
shortest version
$datainfo['category'] = $category['name'] ?? "";
For handle error, you can write code like:
$datainfo['category'] = (isset($category['name']))?$category['name']:"";
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
i want to echo massages id but i getting 'Warning: Attempt to read property' error
This is my code
<?php
$result ='{"num":1,"message":{"cont":"test"},"messages":[{"id":"123","rct":999}],"status":"success"}';
$obj = json_decode($result);
echo $obj->messages->id;
?>
You have to use like below because messages is also an array.
$result ='{"num":1,"message":{"cont":"test"},"messages":[{"id":"123","rct":999}],"status":"success"}';
$obj = json_decode($result,true);
echo $obj['messages'][0]['id'];
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I wrote a program that uses an ISBN to query Amazon for that ISBN's price, and returns the following result:
5cb66919-8a8d-4c13-9175-790f0476508d0.0401580000000000TrueISBN9780340979266OffersAllAll0340979267809USD$8.09688USD$6.88598USD$5.98241010000
I need to format this so that I have the price information in a format that would be understandable to a human.
How can I do this?
Use this way..
<?php
$s = '5cb66919-8a8d-4c13-9175-790f0476508d0.0401580000000000TrueISBN9780340979266OffersAllAll0340979267809USD$8.09688USD$6.88598USD$5.982410100000';
$p = explode('USD',$s);
echo "<pre>";
print_r($p);
echo "</pre>";
?>
function returnPrice($response){
$prices = explode('USD',$response);
unset($prices[0]);
return $prices;
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
$out_terms[$term->name] = '' . $text . '';
Please help me check where the code gone wrong,any missing notes etc,as I am really 0 into php
$out_terms[$term->name] = sprintf('%s', $term_link, $text);
Try this (best construct) :
$out_terms[$term->name] = "$text";
or :
$out_terms[$term->name] = ''.$text.'';
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Supposedly it works on the mac version of xampp but to no prevail, I own a windows PC
The code: http://pastebin.com/zQ6JxHZe
This part seems to be the problem:
function print_r_html( $arr )
{
?><pre><?
print_r( $arr );
?></pre><?
}
You are not opening the PHP tags correctly. Try this instead:
function print_r_html( $arr )
{
echo '<pre>';
print_r( $arr );
echo '<pre>';
}