Parse Error: Syntax Error, Unexpected End of File in My PHP Code

Parse error: Syntax error, unexpected end of file in my PHP code

You should avoid this (at the end of your code):

{?>

and this:

<?php}

You shouldn't put brackets directly close to the open/close php tag, but separate it with a space:

{ ?>
<?php {

also avoid <? and use <?php

Parse error: syntax error, unexpected end of file Issue

<?php

function so56917978_upload_callback() {

//Register variables

$adddate = $_POST['adddate'];
$addcontact = $_POST['addcontact'];
$adda = $_POST['adda'];
$addb = $_POST['addb'];
$addincome = $_POST['addincome'];
$addpayment = $_POST['adddate'];
$addsubbie = $_POST['addsubbie'];
$addcust = $POST['addcust'];

//connect with Database

$host_name = 'zzz.hosting-data.io';
$database = 'zzz';
$user_name = 'zysql_connect($host_name, $user_name, $password);

if(!$connect) {
die('Not Connected To Server');
}

//Connection to database
if(!mysql_select_db($connect, $database)) {
echo 'Database Not Selected';
}
$query = mysql_query($connect,"SELECT * FROM table WHERE adddate = '$adddate' OR addcontact = '$addcontact' OR adda= '$adda' OR addb = '$addb' OR addincome = '$addincome' OR addpayment = '$addpayment' OR addsubbie = '$addsubbie' OR addcust = '$addcust'");
$sql = "INSERT INTO table (adddate, addcontact, adda, addb, addincome, addpayment, addsubbie, addcust) VALUES ('$adddate', '$addcontact', '$adda', '$addb', '$addincome', '$addpayment', '$addsubbie', '$addcust')";

if (!mysql_query($connect,$sql)) {
die('Error: ' . mysql_error($connect));
}
echo "1 record added";

mysql_close($connect);
}

You forgot the closing }

Parse error: syntax error unexpected end of file in php

You're missing the closing php tags before curly braces <?php }}. Becasue of that you're getting Line : 36 -- syntax error, unexpected end of file

Try this way,

<html>
<head>
<script type="text/javascript" src="<?php echo base_url('assests/js/jquery.min.js') ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assests/css/bootstrap.min.css') ?>">
<script type="text/javascript" src="<?php echo base_url('assests/js/bootstrap.min.js') ?>"></script>
</head>
<body>
<div class="container">
<table class="hover hover-table">
<tr>
<th>No</th>
<th>Code</th>
<th>Name</th>
<th>Address</th>
</tr>
<?php if(count($all_user>0))
{ $i=0;
foreach ($all_user as $user)
{

$i++;
?>
<tr>
<td><?php echo $i ?></td>
<td><?php echo $user->code ?></td>
<td><?php echo $user->name?></td>
<td><?php echo $user->address ?></td>
</tr>
<?php
}
}
?>
</table>
</div>

</body>
</html>


Related Topics



Leave a reply



Submit