Two rogue fields not printing their contents...
Posted: Sun Dec 14, 2003 5:08 pm
Hi 
I have a database with a bunch of stuff in the tables, it contains these things:
$id = $xcontent["id"];
$uid = $xcontent["uid"];
$year = $Xcontent["year"];
$month = $Xcontent["month"];
$number = $Xcontent["number"];
$title = $Xcontent["title"];
$animator = $Xcontent["animator"];
$hardware = $Xcontent["hardware"];
$software = $Xcontent["software"];
$creationtime = $Xcontent["creationtime"];
$rendertime = $Xcontent["rendertime"];
$viewrecommend = $Xcontent["viewrecommend"];
$animdescription = $Xcontent["animdescription"];
$descriptionofcreation = $Xcontent["descriptionofcreation"];
$popularity = $Xcontent["popularity"];
$mpg = $Xcontent["mpg"];
$jpg = $Xcontent["jpg"];
$rating = $Xcontent["rating"];
$ratingtally = $Xcontent["ratingtally"];
$ratingavg = $Xcontent["ratingavg"];
$ratingafter = $Xcontent["ratingafter"];
Now, what I want to do, for this example, is simply print the contents of these variables (which I've created above). Here's my code:
Now I should say there is tonnes more code in this and I want to do more than just print, but what I find bizzarre is that the variables $id and $uid print nothing even though there IS content in the database. EVERY other field prints out its contents just fine.
To see if the content was coming through I changed the code to this:
(note I used uid to order rather than id)
This DID have an effect showing that the original $sql query can see the contents of the database in those fields, but when I try and access them with my $uid = $xcontent["uid"]; it doesn't seem to work.
Does anyone have any suggestions?
It's wierding me out and slowing me down and I just can't see what it could be. I've spent two nights on this now and just HAVE to get through it.
Thanks a TON to anyone who can offer a suggestion.

Rob
I have a database with a bunch of stuff in the tables, it contains these things:
$id = $xcontent["id"];
$uid = $xcontent["uid"];
$year = $Xcontent["year"];
$month = $Xcontent["month"];
$number = $Xcontent["number"];
$title = $Xcontent["title"];
$animator = $Xcontent["animator"];
$hardware = $Xcontent["hardware"];
$software = $Xcontent["software"];
$creationtime = $Xcontent["creationtime"];
$rendertime = $Xcontent["rendertime"];
$viewrecommend = $Xcontent["viewrecommend"];
$animdescription = $Xcontent["animdescription"];
$descriptionofcreation = $Xcontent["descriptionofcreation"];
$popularity = $Xcontent["popularity"];
$mpg = $Xcontent["mpg"];
$jpg = $Xcontent["jpg"];
$rating = $Xcontent["rating"];
$ratingtally = $Xcontent["ratingtally"];
$ratingavg = $Xcontent["ratingavg"];
$ratingafter = $Xcontent["ratingafter"];
Now, what I want to do, for this example, is simply print the contents of these variables (which I've created above). Here's my code:
Code: Select all
$connection = mysql_connect($dbhost, $dbusername, $dbpassword);
// connect to current table
$dir = "ASC";
mysql_select_db($dbname);
$sql = "SELECT * FROM current ORDER BY id $dir";
$content = mysql_query($sql);
$Xcontent = mysql_fetch_array($content);
// how many entries are there?
$ShowMax = mysql_num_rows($content);
echo "Total number of entries so far: <b>$ShowMax</b> <br /><br />";
// see if this person has already entered
for ($y=1; $y<=$ShowMax; $y++)
{
$id = $xcontent["id"];
$uid = $xcontent["uid"];
$year = $Xcontent["year"];
$month = $Xcontent["month"];
$number = $Xcontent["number"];
$title = $Xcontent["title"];
$animator = $Xcontent["animator"];
$hardware = $Xcontent["hardware"];
$software = $Xcontent["software"];
$creationtime = $Xcontent["creationtime"];
$rendertime = $Xcontent["rendertime"];
$viewrecommend = $Xcontent["viewrecommend"];
$animdescription = $Xcontent["animdescription"];
$descriptionofcreation = $Xcontent["descriptionofcreation"];
$popularity = $Xcontent["popularity"];
$mpg = $Xcontent["mpg"];
$jpg = $Xcontent["jpg"];
$rating = $Xcontent["rating"];
$ratingtally = $Xcontent["ratingtally"];
$ratingavg = $Xcontent["ratingavg"];
$ratingafter = $Xcontent["ratingafter"];
echo "id = $id <br />";
echo "uid = $uid <br />";
echo "number = $number <br />";
echo "year = $year <br />";
echo "month = $month <br />";
echo "animator = $animator <br />";
echo "title = $title <br /><br />";
//empty database query stuff so we can cycle and see what is next thru the loop
$Xcontent = mysql_fetch_array($content);
}Now I should say there is tonnes more code in this and I want to do more than just print, but what I find bizzarre is that the variables $id and $uid print nothing even though there IS content in the database. EVERY other field prints out its contents just fine.
To see if the content was coming through I changed the code to this:
Code: Select all
$sql = "SELECT * FROM current ORDER BY uid $dir";This DID have an effect showing that the original $sql query can see the contents of the database in those fields, but when I try and access them with my $uid = $xcontent["uid"]; it doesn't seem to work.
Does anyone have any suggestions?
It's wierding me out and slowing me down and I just can't see what it could be. I've spent two nights on this now and just HAVE to get through it.
Thanks a TON to anyone who can offer a suggestion.
Rob