-1

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /var/www/2909kher/entabell/detaljer.php on line 23

<!doctype html>
<html>
<body>
Dette er detaljer.php <br>
<?php

include('oppkobling.php');

//$by = $_POST[''];
//echo($by);

// Lag SQL-setning
$query = 'SELECT * FROM rikestemennesker where id = '.$_GET['Plass'];

// Kjør spørringen
$resultat = mysqli_query($db, $query);

// Lagre antall poster som er funnet
$antall = mysqli_num_rows($resultat);

$rad = mysqli_fetch_array($resultat);

echo "Navn: ".$rad['Navn']."<img src='./bilder/'.$rad['Bilde'].<br>";
echo "Land: ".$rad['Land']."<br>";
echo "Nettoformue: ".$rad['Nettoformue']."<br>";
echo "Kilde: ".$rad['Kilde']."<br>";


?>
</body>
</html>
A J
  • 3,970
  • 14
  • 38
  • 53
ff29
  • 11
  • 3
  • 1
    `$query = 'SELECT * FROM rikestemennesker where id = '.$_GET['Plass'];` I hope this never goes in production. – Federico klez Culloca Jan 17 '18 at 11:55
  • it is the `'` in the query causing your error btw – NappingRabbit Jan 17 '18 at 12:00
  • 1
    @NappingRabbit there's nothing wrong with the query. The error is shown in the answer below. – Funk Forty Niner Jan 17 '18 at 12:12
  • 3
    Welcome to Stack Overflow! Please do not vandalize your posts. By posting on the Stack Exchange network, you've granted a non-revocable right for SE to distribute that content (under the [CC BY-SA 3.0 license](https://creativecommons.org/licenses/by-sa/3.0/)). By SE policy, any vandalism will be reverted. – Suraj Rao Jan 17 '18 at 12:57

1 Answers1

1

The problem is in

echo "Navn: ".$rad['Navn']."<img src='./bilder/'.$rad['Bilde'].<br>";

You forgot an " and used a ' instead of "

echo "Navn: ".$rad['Navn']."<img src='./bilder/".$rad['Bilde']."' /><br>";

Edit

For better readability, use single quotes when echoing HTML.

echo 'Navn: ' . $rad['Navn'] . '<img src="./bilder/' . $rad['Bilde'] . '" /><br>';
Scriptman
  • 424
  • 2
  • 13