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 can I track IPs to block malicious users?
how i can send a confirmation response to my API , when user click on activation link
iOS (objective c) send post request with json to php backend
Yii2 Url Rewrite with Array parameter
Dropdown menu with eloquent
how can i checked checkbox array data from mysql database
Passing variable using url Codeigniter
How to give alias name to table in bonfire..?
PHP Warning: mysqli::real_escape_string() expects parameter 1 to be string, array given
Replace character at a given position without affecting another similar character within the filename
Overriding messages PHP
Why my function returns an unexpected result? [duplicate]
Sending custom woocommerce mail on custom order status change
How to return raw php code?
How to debug 'Method Illuminate\View\View::__toString() must not throw an exception'
how to write a query in php with set in it

Categories

HOME
enums
activex
filesize
ios-simulator
elisp
cypher
tfs2015
jint
onvif
selection
stack-overflow
spring-security-oauth2
twitter-oauth
feature-extraction
heap-dump
uima
c#-7.0
vertica
tomcat8
yii2-basic-app
pyopencl
jstree
router
clipboard
list-comprehension
tsung
sales
fatfs
tightvnc
objectmapper
netbios
steam-web-api
wampsharp
cloudera-manager
polyml
redgate
best-buy-api
vb.net-to-c#
access-denied
oracle-bmcs
linq-to-excel
spongycastle
aws-kinesis-firehose
deployd
hibernate-ogm
gestures
simple-schema
android-mediarecorder
pen
algebra
patternlab.io
dblink
prefetch
boost-compute
bigdecimal
java-2d
xcode6.4
libharu
traversable
gnucash
mathnet
textblock
myfaces
python-cffi
msgpack
smart-tv
unhandled
postal-code
green-threads
cache-manifest
componentart
flow-js
wicked-gem
ocmockito
kotlin-android-extensions
sql-processor
inputbox
nidaqmx
windows-messages
redpitaya
.htpasswd
pre
strcmp
ggts
revmob
mp4parser
virtual-channel
lru
jacob
ofstream
reentrancy
linkbutton
viewpagerindicator
uitextfielddelegate
kaazing
struts2-s2hibernate
multidrop-bus
boost-foreach
channelfactory
mygeneration
self-tracking-entities
html-components
source-code-protection
motif
stretchblt
activex-exe
community-server
error-detection
webclient.uploaddata

Resources

Encrypt Message