php


Laravel DB query throwing 'ErrorException: htmlentities() expects parameter 1 to be string…'


When I run the below query:
`$this_application = \DB::table('applications')->where('application_id', '9650-9348-8494-8846')->first();`
I get the following error:
Next ErrorException: htmlentities() expects parameter 1 to be string, object given (View: /home/forge/default/resources/views/a_page.blade.php) in /home/forge/default/vendor/laravel/framework/src/Illuminate/Support/helpers.php:466
Stack trace:
#0 /home/forge/default/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(44): Illuminate\View\Engines\CompilerEngine->handleViewException(Object(ErrorException), 1)
#1 /home/forge/default/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/home/forge/def...', Array)
What am I doing wrong? I can change the query or columns and I still get the same error. The hard coded ID was a replacement for the dynamic one that gets passed in, incase that was the issue.
The query is inside a controller.
The error is associated with how you're displaying the data in the view a_page.blade.php. You must be trying to do something like {{ $this_application }}, instead use the properties that you fetch like {{ $this_application->application_id }}
We could help you better if you shared the view code.
I think you are trying to print an array in a_page.blade.php with {{}} instead of array element. {{}} outputs string and not an array. try to output {{$this_application->application_id }} as #Sandeesh suggested

Related Links

How to store api url in zf2 local.php [closed]
php variable not saving output of query
RewriteRule: bad flag delimiter
Popup Button not working inside Ajax success via JSON
How to execute Jess in php
How to get different Wordpress category links within one php file?
What should an HTML 5 form submit when no value is set [duplicate]
How to present enum table property in Laravel Model
Send request “post” with hidden field and wordpress
PHP and MySQL pagination issue
php - performance of continue state
ZF2 Model getters and setters mismatching form element names
Selecting and matching data from 3 tables
How to get the request data in codeigniter
Format dynamic ul list generated by php
python doesn't write if call from php

Categories

HOME
knockout.js
mod-rewrite
angular-ui-grid
yii
bots
writefile
transactions
nsview
apk
informatica
elk-stack
apache-kafka-connect
capistrano
firebase-dynamic-links
save
timber
alljoyn
graphdb
csrf
responsivevoice
createjs
stimulsoft
orange-api
l20n
parceler
clr
android-custom-view
bluemix-mobile-services
el
react-dnd
managed-c++
data-collection
bonita
basic-authentication
region
amazon-iam
reporting
actframework
restful-architecture
grails-2.5
nsuserdefaults
jade4j
installanywhere
sspi
flowchart
slideshow
plane
data-uri
julius-speech
git-tfs
oracle-bmcs
audio-converter
absolute
non-linear-regression
visual-format-language
iptv
sigsegv
case-when
emacs25
ogg
rational-performance-test
pyaudio
jsf-2.3
svnserve
system.net.mail
groovyfx
eclemma
qpixmap
jeasyui
textblock
gridbaglayout
teensy
bjam
supersocket.net
swagger-maven-plugin
embeddedwebserver
componentart
phpredis
clarion
tidyr
subview
fiware-bosun
createfile
cakephp-2.2
zend-mail
gpu-programming
iosched
assetic
sensormanager
ctp
frontbase
iirf
jbox2d
popup-blocker
cakeyframeanimation
platform-independent
acpi
memory-pool
radscheduler
qt-mobility
botnet
page-curl
kext
kernel32
jquery-1.4
digiflow
airprint
libxslt
active-record-query
cassini
odac
icicles
yahoo-maps
database-cloning

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App