Jump to content

Can you break up really long mysql queries?


Rifts

Recommended Posts

can I do this

 

mysql_query("INSERT INTO directory (field, field, field,

field,field,field,

field,field,field,

fieldfield,field,

field,field,field,)

VALUES ('field','field','field',

'field','field','field',

'field','field','field',

'field','field','field'

,'field','field','field',)");

 

please ignore any syntax errors and stuff its just the concept of breaking it into different lines?

 

thanks

Yes. And you're really better off to store the query string in a variable, then use the variable when you execute the query. It makes debugging much easier.

 

$query = "SELECT `field` FROM `table`";
$result = mysql_query( $query );

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.