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

PHP Postmark Invalid argument supplied for foreach() in generated file
Laravel: How to modularize? [duplicate]
Laravel - Get related data with find method (for one record)
PHPExcel trimming leading zero?
Create JSON from mysqli query based on primary key
Having trouble with curl on wamp server
How to get google account email address after oauth2 using the hwioauthBundle
PHP mysql INSERT causing blank first row
Display PHP echo in DIV [closed]
Responsive submenu
How do I get the Vector skin to work on Mediawiki with Heroku?
How can I get users to connect to my database if my server deny's remote access for allowing all i.p's (*.*) ?
How can I get single message from rabbitMq queue using PHP?
Displaying Google Chart with info from a Datasource
html form with Php code not executing
Running PHP in browser for fake ip voting? [closed]

Categories

HOME
yahoo-weather-api
kendo-dropdown
paypal-ipn
mongoid
fogbugz
google-sheets-query
tibco
dji-sdk
position
angular-meteor
mithril.js
selection
mutation-testing
nexus3
alljoyn
grocery-crud
outlook-restapi
spring-jpa
fosuserbundle
scala-ide
amazon-mws
data-type-conversion
gollum-wiki
quantitative-finance
eclipse-emf
vuforia
morris.js
unrar
microprocessors
basic-authentication
infopath2010
shapeless
advanced-filter
ms-media-foundation
counting
devtools
pdfnet
telephonymanager
django-smart-selects
assemblies
python-sounddevice
angular-datatables
elasticsearch-aggregation
aws-kinesis-firehose
sonatype
connect-direct
alertify
pjax
visual-studio-monaco
android-sdcard
piping
strpos
uibinder
mnesia
taco
outlook.com
boost-proto
godeps
variable-length-array
html.actionlink
arbre
nastran
bjam
unhandled
fantom
org-babel
relational-model
clarion
deque
fuseesb
flurry-analytics
windows-rt
back
angular-ui-select
lumia-imaging-sdk
network-printers
redpitaya
typesafe-stack
visual-c++-2005
acitree
virtual-channel
pacman
insertion
dynamic-rdlc-generation
msinfo32
uitextfielddelegate
server-name
jdom
kobold2d
acpi
mediacontroller
nsconnection
django-pagination
turbine
eaccelerator
pinax
tabbarcontroller
firephp
accumulator

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile