I have created a simple 10 field or so mysql database. I have verified connectivity to the database via test php app and am using example code from JqWidgets to load said data using a connect.php and data.php file finally into index.php where a JqWidgets grid exists. I am receiving an error and have checked my syntax, checked the web for similar issues, searched based on the error I am receiving and I am still unable to work through the problem - so I thought I would submit my first post here. :) Thanks for any help that might be provided.
db name: texoma00_wardialers table name: table1
Code to follow for data.php which is where I am encountering the error. Note that I am only retrieving 2 fields below as I was trying to eliminate all possibilities of what was causing the error..
The error I see:
[12-Jul-2018 09:19:04 America/New_York] PHP Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /home/texoma00/wardialers.org/data.php on line 24
My Code:
<?php
#Include the connect.php file
include ('connect.php');
// Connect to the database
$mysqli = new mysqli($hostname, $username, $password, $database);
/* check connection */
if ( mysqli_connect_errno())
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
// get data and store in a json array
$from = 0;
$to = 30;
$query = 'SELECT * FROM Table1';
$result = $mysqli->prepare($query);
$result->bind_param('ii', $from, $to);
$result->execute();
/* bind result variables */
$result->bind_result($GrpAffil, $BBSAffil);
/* fetch values */
while ($result->fetch())
{
$table1[] = array(
'GrpAffil' => $GrpAffil,
'BBSAffil' => $BBSAffil
);
}
echo json_encode($table1);
/* close statement */
$result->close();
/* close connection */
$mysqli->close();
?>
Thank you for any help you might provide... Flames are fine - I'm a noob. But I have definitely done some legwork trying to find the answer myself.