PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm not sure it it's doing this because of some quark of PHP but when I run the code below it will show values in the first table generated but not the second. There are values in the database I double and triple checked that it did. Any help would be greatly appreciate it.
if(isset($store_number['store1'])) //Checks to see if the user has a store number associated with them.
{
$store = $store_number['store1'];
?>
<h3>Store: <?= $store?> <a href="graph/graph.php?id=<?=$store?>" target="_blank" align="center">Graph</a></h3>
<?
$numbers['week'] = get_week($store_number['store1']); //Each of these functions are located in a seperate fuctions.php file
$numbers['retail'] = "$".get_retail($store_number['store1']);
$numbers['service'] = "$".get_service($store_number['store1']);
$numbers['netsales'] = "$".get_netsales($store_number['store1']);
$numbers['clients'] = get_clients($store_number['store1']);
$numbers['serviceavg'] = "$".get_serviceavg($store_number['store1']);
$numbers['natserviceavg'] = "$".get_natserviceavg($store_number['store1']);
$numbers['retailavg'] = "$".get_retailavg($store_number['store1']);
$numbers['natretailavg'] = "$".get_natretailavg($store_number['store1']);
$numbers['floorhrs'] = get_floorhrs($store_number['store1']);
include('table.php'); //Generates a table to display the values.
}
if(isset($store_number['store2']))
{
$store = $store_number['store2'];
?>
<h3>Store: <?= $store?> <a href="graph/graph.php?id=<?=$store?>" target="_blank" align="center">Graph</a></h3>
<?
$numbers['week'] = get_week1($store_number['store2']);
$numbers['retail'] = "$".get_retail($store_number['store2']);
$numbers['service'] = "$".get_service($store_number['store2']);
$numbers['netsales'] = "$".get_netsales($store_number['store2']);
$numbers['clients'] = get_clients($store_number['store2']);
$numbers['serviceavg'] = "$".get_serviceavg($store_number['store2']);
$numbers['natserviceavg'] = "$".get_natserviceavg($store_number['store2']);
$numbers['retailavg'] = "$".get_retailavg($store_number['store2']);
$numbers['natretailavg'] = "$".get_natretailavg($store_number['store2']);
$numbers['floorhrs'] = get_floorhrs($store_number['store2']);
include('table.php');
}
I know this can be done with a loop, I am just trying to get the program working right now. The program generates the tables but only displays values for the first table and for the second on it only puts the "$" that I appended to the strings. If there is anything that is unclear let me know and I will elaborate.
Thats the thing, there is data in the database, but when I run the query it says: MySQL returned an empty result set (i.e. zero rows). (Query took 0.0002 sec)
Well, I'm thinking I may have set the database up wrong. But that still wouldn't account for the program working with the first row but not any of the subsequent rows.
In my database I have this:
Table: reports number= TX201 varchar(32)
weekending = 6/20/2009 varchar(32)
clients = 254 int(32)
etc...
When I try to run:
"SELECT weekending FROM reports WHERE number = 'TX201'"
But you say you get a record when you do "SELECT weekending FROM reports WHERE number = 'TX201'", but not when you do "SELECT weekending FROM reports WHERE number = 'TX202'" That seems to indicate that there is no 'TX202' in the number column. My examples where just examples, you need to find out the exact value. Maybe try "SELECT weekending FROM reports WHERE number LIKE '%TX202%'".