Miguel lópez dinaweb dpto. programación wrote:

Hi,

I can't send multiple sql staments in one query,  i always get an error
saying that the sentece is incorrect, i thorw the sentece in a mysql
console and works fine, i'm sepraing sentences with ; i try to separe
using ;\n or ;\r\n but don't work

Anyone can help me?

:-)
________________________________________________________
Miguel López Sánchez
Programador
Voz +34 902 014 945    E-mail: [EMAIL PROTECTED]
--------------------------------------------------------
Dinaweb Networks s.l.
Rúa das Orfas 27
15703 Santiago de Compostela A Coruña Gz Sp ECC
Voz +34 902 014 945    GMT+1
E-mail: [EMAIL PROTECTED]
--------------------------------------------------------
http://www.dinaweb.com   http://www.dinahosting.com
http://www.u-lo.com         http://www.empregogalego.com
 ________________________________________________________

Hi Miguel,

Here's a function that I use to run multiple SQL statements at once - similar to running MySQL in batch mode. It relies on a semicolon to separate the SQL statements.

function SendBatchQuery($db_host, $db_base, $db_user, $db_pw, $query) {
$message = "Connection with server $db_host failed";
mysql_connect($db_host, $db_user, $db_pw) or die($message);
$message = "Could not select database $db_base";
mysql_select_db($db_base) or die($message);
$array = explode(';', $query);
foreach($array as $value) {
if(!$result = mysql_query($value)) {
break;
}
}
return $result;
}

Enjoy,

Seth Remington
SaberLogic, LLC
661-B Weber Drive
Wadsworth, Ohio 44281
Phone: (330)335-6442
Fax: (330)336-8559


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to