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 is the ID Converted to A Task?
phpmailer working on site but not on localhost
Table join confusion retrieving data
SQL syntax error
Checking whether specific data is already in a table using SQL and PHP
The temporary folder is not writable for CKFinder
echo a conditional substring
Codeigniter join two tables display category name and list all items
Get current user email address in Outlook Api PHP
Change variable value in CodeIgniter subview
str_replace function replace placeholders
PHP - Public function inside foreach loop (WordPress widget)
Post picture to my Facebook page without link
Managing project folder structure in PhpStorm
css seems to not work properly when i use .htaccess to make 'pretty links'
Adding a composer package to Laravel 5

Categories

HOME
hpoo
entity-framework
extjs
shinyapps
dotnetnuke
workflow
applescript
activex
message-queue
plpgsql
biztalk
mathematical-optimization
elisp
tibco
lapack
game-maker
spring-amqp
angular4
xbox360
office-ui-fabric
http-authentication
android-custom-view
unity-container
connection-refused
mime-types
eclipse-emf
uilocalnotification
annotation-processing
objectmapper
sql-execution-plan
kendo-listview
twilio-php
variable-variables
secure-coding
hypothesis-test
httphandler
non-linear-regression
webvtt
sequence-diagram
pen
word-2007
deedle
stateless-session-bean
zend-server
emf-compare
email-injection
pbx
thread-exceptions
nsrunloop
seccomp
callouts
dpkg
eclemma
bbc-micro
node.js-connect
verisign
gdl
html.actionlink
lowercase
place
blank-line
gluon-desktop
supersocket.net
dynamics-ax-2012-r2
bootstrap-wysiwyg
alwayson
flow-js
vs-unit-testing-framework
nidaqmx
forceclose
typesafe-stack
armv6
autonumber
insertonsubmit
tnt4j
rikulo
simplecov
popup-blocker
coordinate
telerik-ajax
uitextfielddelegate
kernel32
upshot
webresponse
odac
android-input-method
raw-data
spring-modules
data-retrieval
rakudo
levels

Resources

Encrypt Message