leequalls Posted February 13, 2011 Share Posted February 13, 2011 I need some help with the following code I need it to output the data it is only outputting the number from the table. code: while($nResult[$nexthour] != $aResult[$hour]) { $que = mysql_query('SELECT '.$nexthour.' from rp_timetable WHERE `rp_timetable`.`day` = "'.$nextday.'"') or die(mysql_error()); $nextmixologist = mysql_fetch_array($que, MYSQL_ASSOC); if($djName != $nextmixologist[$nexthour]) { $nResult[$nexthour] = $nextmixologist[$nexthour]; break; } $nexthour++; }[code=php:0] database day123456789 Mondaydatadatadatadatadatadatadatadatadata Tuesdaydatadatadatadatadatadatadatadatadata Quote Link to comment Share on other sites More sharing options...
leequalls Posted February 13, 2011 Author Share Posted February 13, 2011 . Quote Link to comment Share on other sites More sharing options...
litebearer Posted February 13, 2011 Share Posted February 13, 2011 may we see your db table structure? Quote Link to comment Share on other sites More sharing options...
leequalls Posted February 13, 2011 Author Share Posted February 13, 2011 structure Field Type Collation Null day varchar(30) latin1_swedish_ci No 1 varchar(30) latin1_swedish_ci No 2 varchar(30) latin1_swedish_ci No 3 varchar(30) latin1_swedish_ci No 4 varchar(30) latin1_swedish_ci No 5 varchar(30) latin1_swedish_ci No 6 varchar(30) latin1_swedish_ci No 7 varchar(30) latin1_swedish_ci No 8 varchar(30) latin1_swedish_ci No 9 varchar(30) latin1_swedish_ci No 10 varchar(30) latin1_swedish_ci No 11 varchar(30) latin1_swedish_ci No 12 varchar(30) latin1_swedish_ci No 13 varchar(30) latin1_swedish_ci No 14 varchar(30) latin1_swedish_ci No 15 varchar(30) latin1_swedish_ci No 16 varchar(30) latin1_swedish_ci No 17 varchar(30) latin1_swedish_ci No 18 varchar(30) latin1_swedish_ci No 19 varchar(30) latin1_swedish_ci No 20 varchar(30) latin1_swedish_ci No 21 varchar(30) latin1_swedish_ci No 22 varchar(30) latin1_swedish_ci No 23 varchar(30) latin1_swedish_ci No 24 varchar(30) latin1_swedish_ci No Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2011 Share Posted February 13, 2011 Rename them to "hour_1". You're actually selecting the value "1" when you do SELECT 1 FROM table. You can also try SELECT `1` FROM table. But it'd be better in the long run to use more descriptive names. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.