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 extract data from this JSON ? [closed]
Image cropping and thumb creation
How to draw a name in a database [duplicate]
PHP: Generating category/subcategory UL list from array?
wikipedia servers gzip content
How to escape ' in setParameter
onclick submit check php
php: how to shoow session variable on every php page [duplicate]
Multilingual site: switching languages
jQuery hide() flicker
Cascading dropdown with jQuery
Regex to match alphanumeric characters, underscore, periods and dash, allowing dot and dash only in the middle
Setting Facebook PHP SDK access_token with setAccessToken()
How do I modify the path used by exec in php
Broken link check while initiating cron-multi
How to format `23/05/2012` into insertable value in DATETIME column?

Categories

HOME
jboss
lambda
seedstack
add-on
operating-system
stacktrace.js
code-formatting
websocket
liferay-7
bittorrent
gprs
pyresttest
specifications
log4j2
match
fbloginview
documentum
dma
synthesis
home
spring-shell
anova
password-generator
introspection
macromedia
copy-protection
objectmapper
rust-cargo
amazon-kms
assertions
formsauthenticationticket
jslint
love2d
django-smart-selects
aurelia-http-client
tidal-scheduler
assemblies
grails-spring-security
data-uri
yoast
fluid-mac-app-engine
permission-denied
vesta
rm
xcglogger
hibernate-ogm
jgrapht
algebra
adobe-reader
maatwebsite-excel
yargs
cocoa-bindings
nunit-console
cdo.message
node.js-connect
i2b2
wepay
myfaces
pack
enunciate
diawi
python-cffi
smart-tv
self
ruby-on-rails-4.1
extend
featuretoggle
search-form
domino-designer-eclipse
bootstrap-wysiwyg
physicsjs
kotlin-android-extensions
innerhtml
python-curses
tidyr
ssmtp
fiware-bosun
jcheckbox
phonegap-facebook-plugin
ildasm
inequality
berkeley-db-xml
angular-ui-select
radius-protocol
boolean-algebra
roxy-fileman
code39
acitree
ember-table
sly-scroller
background-thread
lynx
onconfigurationchanged
gitx
clearinterval
differentiation
delphi-prism
server-variables
j2mepolish
firephp
subtext
iphone-sdk-3.1.3
jboss-mdb

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