php - Output escaped data in laravel 5.1 -
i inserting escaped data in database using core php.
$collect = $conn->real_escape_string($value); $sql = "insert data (collect) values ('$collect')"; if ($conn->query($sql) === true) { echo ' : new record created '; } else { echo "error: " . $sql . "<br>" . $conn->error; }
records created successfully. when output data same database using laravel 5.1, shows weird characters “ , †instead of "". outputting data in .blade.php file.
@foreach ($data $d) {{ $d->collect }}<br /> @endforeach
if output data using core php output perfect. in core php outputting data this.
$sql = "select collect data"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo " collect: ".$row["collect"]."<br>"; } } else { echo "0 results"; }
how can output data using laravel 5 correctly?
try following output data without escaping.
{!! $d->collect !!}
{{}}
escape text.
Comments
Post a Comment