Im new to PHP, i just want to know if theres any rule in php in terms of single statement multiple lines. for example in VB.Net we uses "&_"(w/o the quote) to tell vb.net that it is a single statment and it has a continuation. is there any in php?

Heres the sample in In VB.Net

                    "INSERT INTO table(field1," &_
                     field2)VALUES(value1," &_ 

in php= ????

It will be a big help for a newbie like me.


Edited by OtepTheThird: additional

2 Years
Discussion Span
Last Post by matrixdevuk

I am not sure if this is exactly what you are looking for, but in PHP it is called transaction. The mysql ENGINE directives must be set to innodb.

Normally, if you are using PHP MVC frameworks like fuel PHP, laravel, and even CI (lower level), these frameworks are pre-packaged with database library that can easily handle transactions.

The idea is pretty similar to the ADODB objects. Similar to other programming languages, PHP trasactions can be roll-back. Meaning, if later on we don't want the latest modification on our database, we can roll it back to the previous state e.g.



if ($this->db->trans_status() === FALSE)

if this


evaluates to FALSE, then we can roll-back. Otherwise, we commit to finalize the transaction.

This topic is pretty huge and it requires practice and full understanding of ORM. At the moment, I really don't know what to recommend as far as tutorial is concern.

You can read more about it here and here.

Edited by veedeoo: more info added


If I got your question right you want to know whether a special character is required in PHP to write a statement on multiple lines. The code in PHP would be:

$query = "INSERT INTO table(field1," .
"field2)VALUES(value1," .


$query  = "INSERT INTO table(field1,";
$query .= "field2)VALUES(value1,";
$query .= "Value2)";

or simply

$query = "INSERT INTO table(field1,

You use a dot (.) to concatenate strings or use any whitespace (line break, spaces) within a string to format the code.

Edited by broj1

Votes + Comments
That was my take as well
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.