Jump to content

[SOLVED] What am I doing wrong?


patheticsam

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.