In the table 'themes' in a mySql database, there are six records, id 22 - 27. The fields ('columns') are id; name; image; bgcolor.
When I run, "SELECT * FROM themes WHERE id='24';" from phpmyadmin, I get:
id = 24;
name = "Spring";
image = "Gabrielle.jpg";
bgColor = 11;
just as I should. But when I run this php script, ...
<?php
require_once('../Connections/seaecardsDB.php');
function setGlobals(){
global $selectImg, $imgW, $imgTh;
global $thName, $thFont, $thFcol, $thBGcol;
$imgg = $_POST["selectedImage"];
$imgDataRA = explode(",",$imgg);
$imgW = $imgDataRA[1];
$imgTh = $imgDataRA[2];
}
setGlobals();
// GET THEME STUFF = name, font, fontcolor, bgcolor
// $imgTh from setGlobals() is the index
print "Do I have imgTh $imgTh ** "; // I always do
$qr = 'SELECT FROM themes WHERE thid= \''.$imgTh.'\';';
$re = mysql_query($qr) or die(mysql_error());
$th = array();
$th[] = array('name'=>mysql_result($re,'thname'), 'font'=>mysql_result($re,'thfont'), 'fcol'=>mysql_result($re,'thfontcolor'), 'bgcol'=>mysql_result($re,'thbgcolor'));
echo 'AND THE WINNER IS - - - name '.$th['name']." font ".$th['font']." fcol ".$th['fcol']." bgcol ".$th['bgcol'];
?>
... $th is not an array. It is a single value that equals $imgTh. $th['name'], etc, are empty.
I've tried "name=>mysql_result($re,0,'theme_name')" and as many other variations I could think of. I must have screwed up the syntax somehow, but I don't see how. I've run out of brainpower, strength and time. Please.
Any help will be treasured, and used immediately.
Thanks,
Paul