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

Group by in mysqli
Image insertion is working on local server but not on live server
Formatting MySQL Search Results
upload image to project directory and store other data in database with Codeigniter
XML PHP Display Loop not working
My autoloader loads the class file but gives a fatal errors for the class
PHP page to run MySQL query
Magento admin login failed on cloud server
Contact Form Bootstrap Form [duplicate]
Symfony's is valid forms always return false
Print pre formatted Array without <pre> tag
How to fill the value of all keys of array to specific value?
Loop through json array with php
Jquery EasyUI datagrid scrollview bug on more than 750000 rows
remove non alphanumeric characters PHP except “_” [duplicate]
parsing xml: wrong character set encoding

Categories

HOME
knockout.js
keyboard
xcode
yii
long-integer
loopbackjs
gprs
joomla3.2
phpseclib
kurento
cisco
nexus3
amazon-emr
responsivevoice
ex
max-msp-jitter
tomcat8
jaspersoft-studio
boomi
bluemix-mobile-services
kamailio
amazon-sns
websphere-portal
perfino
uri
background-color
msdeploy
tf-idf
tsung
audit
windows2012
snap-framework
john-the-ripper
appcode
nsuserdefaults
love2d
aurelia-cli
selenide
praat
windows-store
classnotfoundexception
raytracing
optionaldataexception
rightnow-crm
cloudwatch
icecast
nusoap
solr-query-syntax
watir-webdriver
ltrace
boost-compute
nvda
django-testing
system.net.mail
declarative
bbc-micro
deferred-rendering
odesk
cryptojs
ruby-on-rails-4.1
mousehover
apache-commons-digester
ora-04091
extend
algebraixlib
relational-model
scala-macros
subview
nanomsg
comctl32
berkeley-db-xml
object-code
ecos
full-text-indexing
category-theory
rpg
network-printers
prism.js
senchatouch-2.4
lsa
codahale-metrics
tnt4j
google-code-prettify
insertion
rikulo
spiral
towers-of-hanoi
clearinterval
viewpagerindicator
msinfo32
microblogging
delphi-prism
radscheduler
grails-validation
mygeneration
iphone-sdk-4.3
self-tracking-entities
oracle-pro-c
3270
wmd-editor
html-generation

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App