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

dropdown selection message missing PHP
how to get all parameter from foreign key entity symfony 3
PHP concatenate &para to variable
Trying to pass ajax value from php to jquery in selectize
PHP Error: T_CONSTANT_ENCAPSED_STRING [duplicate]
.htaccess Remove trailing / unless directory
Don't allow new user, if a user has already logged in
Error Fetching http headers in wsdltophp.com
function results in Notice: Undefined offset: 0 on one website but not the other
send mail in laravel 5.4 with request input
Php generated wrong format url file path after upload to server
Php PDO search string as Google or order by best match
Submitting the same value many times when the value needs to be unique
'Order by' specified order in Woocommerce shortcode
woocommerce hooks warning “function not found”
How to acces value from route in symfony2

Categories

HOME
freeradius
shinyapps
android-fragments
kivy
visual-studio-2010
tabs
portable-class-library
nsis
implicit-conversion
ag-grid
bootstrap-switch
distributed-computing
cmake-gui
plyr
list-comprehension
onchange
macromedia
source-insight
private-key
ms-media-foundation
serversocket
cmis
polyml
spinner
code-rally
strapi
telephonymanager
extbase
windows-store
slideshow
morphline
moinmoin
daz3d
axis
adblock
brightscript
nonlinear-functions
password-hash
non-linear-regression
sequence-diagram
winmerge
mongodb-aggregation
dynamics-crm-4
msxml
degrees
prefetch
xcode6.4
system.web.optimization
spring-mongo
gnucash
android-syncadapter
codecharge
rails-engines
facebook-ios-sdk
exists
jeditable
jemdoc
flask-security
outlook.com
deeplink
dsa
asp.net-web-api-helppages
hmisc
sequence-sql
textscan
kotlin-android-extensions
mod-auth-openidc
mojo
configurable-product
device-admin
squeezebox
screwturn
sql-function
nodeload
facebook-game-groups
san
notifyjs
acceptance-testing
axacropdf
dojo-1.9
handshake
towers-of-hanoi
spark-view-engine
algol68
dynamic-c
digiflow
multiple-users
sscli
rational-unified-process
google-translator-toolkit
spring-modules
processors
wmd-editor
fuzzy-comparison
accumulator
jboss-mdb
regioninfo
community-server
service-factory
account-management

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