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

PDO effective SELECT and INSERT
Open all external links in new window
PHP tags show as plain text inside HTML code
Captcha in Yii works only if the image is refreshed bug
.htacces rewrite not working even with AllowOverride
How to upload a Excel file and insert data from that file into the database at the same time in php?
How to integrate payment gateway in yii2 using PayPal extension for the Yii2
optimization in symfony2 code without having to search for ID first
Reading pdf or word file with php
Other language $_POST are empty
active directory error server is unwilling to perform
PHP array mysql retrieve each record (part 2)
Yii Relations not working
Mysqli con function
Add to Laravel session by Session Id?
How to pass dynamic variable through class function

Categories

HOME
oracle
entity-framework
mod-rewrite
vagrant
facebook-messenger
android-fragments
paypal-ipn
systemd
antd
dry
dafny
android-emulator
websocket
google-sheets-query
hyperledger
visualforce
tfs2010
cocotb
scrape
fireloop
dhcp
exe
google-sites
tfsbuild
multiple-tables
libgit2
sqlplus
kamailio
tracing
introspection
points
bobo-browse.net
bitbake
xenapp
instructions
nsmutablearray
plantuml
gnu-classpath
bootstrap-sass
buildforge
wdk
stackpanel
xll
extbase
microkernel
plane
system-on-chip
julius-speech
docker-ucp
dredd
maven-jaxb2-plugin
emacs25
gapi
controllers
p6spy
always-on-top
fragmentstatepageradapter
distributed-cache
wif4.5
ioctl
bayesglm
nette
pythonxy
jnlp
unhandled
ngcordova
swagger-maven-plugin
bootstrap-wysiwyg
angular-amd
ipod
dbmigrate
dc
zend-mail
xml-signature
communicate
screwturn
bittorrent-sync
principalcontext
ggts
frontbase
non-ascii-characters
django-facebook
pacman
microformats
android-authenticator
oembed
cmath
xmlwriter
instance-variables
live-wallpaper
getproperty
image-formats
server-name
prefuse
nsrangeexception
servlet-container
bll
downgrade
aptitude
ixmldomdocument
yahoo-maps
error-detection

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