Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding string variable

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
How do I do this?

//$query = "SELECT Orderdate,Ordernumber, Description, Caption FROM Orders ORDER BY `orders`.`ID` ASC , `orders`.`OrderNumber` ASC;";

Trying to reduce the length of the codeline. I tried & and + but does not like it? Thanks

$query = "SELECT Orderdate,Ordernumber, ";
$query = $query + "Description, Caption FROM Orders ORDER BY `orders`.`ID` ASC , `orders`.`OrderNumber` ASC;";
 
Solved thanks:
$queryA = "SELECT Orderdate,Ordernumber, ";
$queryB = "Description, Caption FROM Orders ORDER BY `orders`.`ID` ASC , `orders`.`OrderNumber` ASC;";
$query=$queryA.$queryB;
 
A simpler and cleaner solution would be:
Code:
$query  = "SELECT Orderdate,Ordernumber, ";
$query .= "Description, Caption  FROM Orders ORDER BY `orders`.`ID` ASC , `orders`.`OrderNumber` ASC;";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top