FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Semicolon in SQL





k2-4u
if you use below SQL
its not work Sad

Code:


INSERT INTO `table`   SET  text="use Semicolon ; Here ";

INSERT INTO `table`   SET  text="use Semicolon ; Here ";

INSERT INTO `table`   SET  text="use Semicolon ; Here ";


:!
because split_sql_file($sql_query, ';'); function can not split queries
what should i do?

thanks
ocalhoun
Split this off into a new topic because it used to be a reply to a very old topic, only marginally related to the subject of that topic.
Aredon
ocalhoun wrote:
Split this off into a new topic because it used to be a reply to a very old topic, only marginally related to the subject of that topic.

Kind of wish context for the post had been moved too... I don't know what the question is.
jmraker
In an effort to thwart sql injection attacks in php mysql_query can only run one sql statement at a time

The comments in the manual page offer some solutions
http://php.net/manual/en/function.mysql-query.php

http://www.dev-explorer.com/articles/multiple-mysql-queries
and
Code:
function mysql_exec_batch ($p_query, $p_transaction_safe = true) {
  if ($p_transaction_safe) {
      $p_query = 'START TRANSACTION;' . $p_query . '; COMMIT;';
    };
  $query_split = preg_split ("/[;]+/", $p_query);
  foreach ($query_split as $command_line) {
    $command_line = trim($command_line);
    if ($command_line != '') {
      $query_result = mysql_query($command_line);
      if ($query_result == 0) {
        break;
      };
    };
  };
  return $query_result;
}


There's also the mysql_unbuffered_query function that probably has the same one statement limit, but there's no mention of it in it's manual page
http://www.php.net/manual/en/function.mysql-unbuffered-query.php
Related topics
Help: SQL error after uploading new files(thread updated)
SLOW UPLOADING AN SQL FILE
have problem on my sql
SQL Basics
SQL Tutorial
Executing a .sql file through PHP
I can't upload my Database SQL script ! Helllppppp!!!!
SQL
SQL
SQL and PHP
Is there such a wsiwyg editor for sql
SQL Server 2000 and MYSQL, pls help me.
Can I create many SQL database by my self
SQL Disk usage?
How to edit SQL files?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.