Parse error: syntax error, unexpected ‘{‘ in /home/bessent1/public_html/ben.broxie.co.uk/benwoolner/test.php on line 18
Thats the error message I’m getting running this code, i’m not 100% why though. I’ve check and all my brackets seem to be balanced and I can’t see a missing ;
The code I’m using i’ve used before too, on another website and I’ve had no issues with it, admitidly this is only has one query instead of the 2 of the orignal.
If I uncomment line 19 and comment all the if else statement it works and returns me the first set of data, but as I want an array that returns all the contents I was using the if else.
[code=php]
<?php
//connect to server and select database; you may need it
$mysqli = mysqli_connect(“localhost”, “xxx”, “xxx”, “bessent1_ben”);
// sets up queries
$get_data_qry = “SELECT * FROM portfolio_content”;
// sets up query calls
$get_data_res = mysqli_query($mysqli, $get_data_qry) or die(mysqli_error($mysqli));
//get and show 1st level navigation
if (mysqli_num_rows($get_data_res) < 1)
{
echo “<h3>We’re Sorry!</h3><p>We’ve searched our database and couldn’t find anything under that category</p>n”;
}
else ($data = mysqli_fetch_array($get_data_res))
{ //line 18
//$data = mysqli_fetch_array($get_data_res);
$title = ucwords(stripslashes($data[‘title’]));
$desc = $data[‘description’];
$thumb = $data[‘thumbnail’];
$stage = $data[‘main’];
$link = $data[‘link’];
}
echo $title.”<br />”;
include($desc);
echo “<br />”;
echo “<img src=”.$thumb.” /><br />”;
echo $stage.”<br />”;
if (is_null($link) == false)
{
echo $link.”<br />”;
}
?>
Any help would be greatful