Thank you. That was all as I had surmised but I am so much more comfortable having it confirmed. That was great of you to put so much effort into the response. I already use PHP extensively but I hear so much about rails. I will try rails and or python next.
I have used the jsonp approach and it works except I find I have to handle the jsonp object as an array in stead of an object. Not sure why. I do know that there are not any associative arrays in javascript but I am basically just using code like
$dbc = mysqli_connect(kDB_Host, kDB_User, kDB_Password, kDB_Name);
$query = "SELECT movies.movieTitle FROM ShopSearchDemoMovies AS movies ".
"INNER JOIN ShopSearchDemoAuthorizedMoviesForUser AS authMovies ON authMovies.movieFK = movies.moviePK ".
"INNER JOIN ShopSearchDemoUsers AS users ON authMovies.userFK = users.userPK ";
$data = mysqli_query($dbc, $query);
//create array of movie titles
$movies = array();
$i=0;
while ($row = mysqli_fetch_array($data))
{
$movies[$i] = $row['movieTitle'];
}
$data = json_encode($movies);
if(array_key_exists('callback', $_GET))
{
header('Content-Type: text/javascript; charset=utf8');
//header('Access-Control-Allow-Origin:
http://www.tsquaredapps.com/');
//header('Access-Control-Max-Age: 3628800');
//header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
$callback = $_GET['callback'];
echo $callback.'('.$data.');';
I realize this is a bit much to look over but the esscence is
1)mysqli select query on database connection
2)iterate over rows to create an array
while ($row = mysqli_fetch_array($data))
{
$movies[$i] = $row['movieTitle'];
}
3) json_encode array
$data = json_encode($movies);
echo back function call