patheticsam Posted January 23, 2009 Share Posted January 23, 2009 Hi! I have an SQL commande here : $sql = "SELECT `id`, `status`, `pricef`, `pricea`, `cut`, `note`, TIME(`start_time` + `lenght`) as end_time FROM table WHERE friend='$friend' AND city='$city' ORDER by `date`, `start_time`"; $req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error()); while($data = mysql_fetch_assoc($req)) With that code the start_time + lenght will diplay correctly with $data[start_time] and $data[end_time] But if I do the same thing with : $sql = "SELECT `id`, `status`, (`pricef` - `pricea`) as cut, `note`, TIME(`start_time` + `lenght`) as end_time FROM table WHERE friend='$friend' AND city='$city' ORDER by `date`, `start_time`"; $data[cut] will display correctly but $data[pricef] and $data[pricea] donsen't display anymore.... I don't understand what i'm doing wrong. Can someone help me out? Thanks!! Link to comment https://forums.phpfreaks.com/topic/142121-solved-what-am-i-doing-wrong/ Share on other sites More sharing options...
revraz Posted January 23, 2009 Share Posted January 23, 2009 You are putting them into a field called cut. List them by themself if you still want to see them. Link to comment https://forums.phpfreaks.com/topic/142121-solved-what-am-i-doing-wrong/#findComment-744367 Share on other sites More sharing options...
divadiva Posted January 23, 2009 Share Posted January 23, 2009 Thats because in you rsql you are not specifying to displat pricef and pricea .It is only deplaying id status cut note and endtime. "SELECT `id`, `status`, (`pricef` - `pricea`) as cut, `note`, TIME(`start_time` + `lenght`) as end_time FROM table WHERE friend='$friend' AND city='$city' ORDER by `date`, `start_time`" Modify to this: "SELECT `id`, `status`,pricef,pricea, (`pricef` - `pricea`) as cut, `note`, TIME(`start_time` + `lenght`) as end_time FROM table WHERE friend='$friend' AND city='$city' ORDER by `date`, `start_time`" Best Divya Link to comment https://forums.phpfreaks.com/topic/142121-solved-what-am-i-doing-wrong/#findComment-744370 Share on other sites More sharing options...
patheticsam Posted January 23, 2009 Author Share Posted January 23, 2009 It worked! Thanks I knew it wasn't something big...Thanks again! Link to comment https://forums.phpfreaks.com/topic/142121-solved-what-am-i-doing-wrong/#findComment-744379 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.