Solved

Need another set of eyes on accessing variable.

Posted on 2016-07-15
4
33 Views
Last Modified: 2016-07-15
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"
0
Comment
Question by:breeze351
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41713328
Looks fine from here.  What do you think it is supposed to do?
http://php.net/manual/en/mysqli-result.fetch-array.php
0
 
LVL 22

Accepted Solution

by:
Kim Walker earned 500 total points
ID: 41713337
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
 

Author Closing Comment

by:breeze351
ID: 41713357
BINGO!!!!!  Never would have thought of it.
Thanks
0
 
LVL 11

Expert Comment

by:Ovid Burke
ID: 41713366
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question