Need another set of eyes on accessing variable.

I can't see what's wrong with this (the query is correct and returns 5000+ records).

$SqlString = "select * from comp";
$comp = $conn->query($SqlString);
$row_comp = $comp->fetch_array();
$work = $row_comp['TID'];

$work ends up as "TID"
breeze351Asked:
Who is Participating?
 
Kim WalkerWeb Programmer/TechnicianCommented:
This would suggest that the value of the column "TID" in the first row of your result is also "TID". Did you upload a CSV file that had a header row? If you did, the first row in your table is that header row.

Other that this, there isn't enough information here to guess. Have you run the query in your database control panel to see what the values are in the first row?
1
 
Dave BaldwinFixer of ProblemsCommented:
Looks fine from here.  What do you think it is supposed to do?
http://php.net/manual/en/mysqli-result.fetch-array.php
0
 
breeze351Author Commented:
BINGO!!!!!  Never would have thought of it.
Thanks
0
 
Ovid BurkeConsultant InstructorCommented:
I tend to agree with Kim. It seems likely that at least one row in tour data contains the column names of your table.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.