Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 days ago.
Improve this question
My query getting loop so I have duplicate value option select.
<?php
$query = "select * from alt_diagnosis;";
$result = mysqli_query($koneksi,$query);
while ($row = mysqli_fetch_assoc($result)) {
foreach ($diagnosa as $diag) {
?>
<option <?php if($row['code2']==$diag){echo 'selected';}?> value="<?=$row['code2']?>"><?=$row['description']?></option>
<?php
}
}
?>
I want the output to only run my query once and it doesn't enter the foreach loop.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
can someone please show where is the error ?
$material = DB::table('material_user')->where('material_user.id', $id)
->leftjoin('users', 'users.id','=','material_user.user_id')
->leftjoin('materials', 'materials.id','=','material_user.material_id')
->select('users.first_name','users.last_name','users.sexe','materials.serial','materials.name','material_user.created_at')
->get();
dd($material->first_name);
Exception
Property [first_name] does not exist on this collection instance.
get() returns a collection. So you have to iterate over the collection to get the first_name for e.g
foreach ($material as $object)
echo $object->first_name;
endforeach
Or you can get the single record using below & can access first_name directly
$object = $material->first();
echo $object->first_name
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
How can i echo PHP Get request with []?
example: value=ok¶ms[account]=123456
There is no problem with:
echo $value = $_GET["value"];
Not working with:
echo $account = $_GET["params[account]"];
echo $account = $_GET["params"]["account"];
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I am facing some issues with a query.
The result for this
public function index()
{
$subscribers = Subscriber::where('user_id', Auth::user()->id)->get();
return view('backend.newsletter.contacts.index')->withSubscribers($subscribers);
}
is only the last entry. My assumption with get() is that I get all entries that match my where clause?
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I'm not the best at php and mysql and i'm still learning however i have this userlevel variable which i define in my session
and if i message it back to myself using
<?php echo"$session->userlevel"; ?>
It'll work, it'll tell me that me that my userlevel is "0" which it should be however when i'm using an if statement to check it won't work?
<?php
if ($_SESSION['userlevel'] = 0) {
echo "Userlevel 0 was found!";
}
?>
Any though
if($_SESSION['userlevel'] = 0)
should be
if($_SESSION['userlevel'] == 0)
Otherwise you don't check, you assign the value 0 to $_SESSION['userlevel']
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
it says unexpected "="... What should I rewrite? Thanks
$result = mysql_query("SELECT * FROM soubory, users
WHERE id='".$id."'" AND soubory.users_id = users.id );
Remove the second " after $id."'
$result = mysql_query("SELECT * FROM soubory, users WHERE soubory.users_id='".$id."' AND soubory.users_id = users.id");