php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10394 mysql_query() dosen't stable!
Submitted: 2001-04-19 05:55 UTC Modified: 2001-06-02 22:47 UTC
From: ttttntl at yahoo dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.4pl1 OS: Linux RedHat7
Private report: No CVE-ID: None
 [2001-04-19 05:55 UTC] ttttntl at yahoo dot com
Hi,
I have a table:
CREATE TABLE boardlist (
   board_id int(11) DEFAULT '0' NOT NULL,
   header_inc mediumtext NOT NULL,
   footer_inc mediumtext NOT NULL,
   board_width varchar(10) NOT NULL,
   board_align varchar(10) NOT NULL,
   name varchar(50) NOT NULL,
   description varchar(255) NOT NULL,
   admin varchar(20) NOT NULL,
   password varchar(20) NOT NULL,
   email varchar(50) NOT NULL,
   mail_reply tinyint(4) DEFAULT '0' NOT NULL,
   color1 varchar(20) NOT NULL,
   color2 varchar(20) NOT NULL,
   color3 varchar(20) NOT NULL,
   color4 varchar(20) NOT NULL,
   color5 varchar(20) NOT NULL,
   img_id tinyint(4) DEFAULT '0' NOT NULL,
   btn_id tinyint(4) DEFAULT '0' NOT NULL,
   rows tinyint(4) DEFAULT '10' NOT NULL,
   pages tinyint(4) DEFAULT '10' NOT NULL,
   image_path1 varchar(50) NOT NULL,
   image_path2 varchar(50) NOT NULL,
   image_path3 varchar(50) NOT NULL,
   id_check tinyint(4) DEFAULT '0' NOT NULL,
   writer_check tinyint(4) DEFAULT '0' NOT NULL,
   date_check tinyint(4) DEFAULT '0' NOT NULL,
   point_check tinyint(4) DEFAULT '0' NOT NULL,
   counter_check tinyint(4) DEFAULT '0' NOT NULL,
   image_check tinyint(4) DEFAULT '0' NOT NULL,
   text_check tinyint(4) DEFAULT '0' NOT NULL,
   color_check tinyint(4) DEFAULT '0' NOT NULL,
   bg_image_check tinyint(4) DEFAULT '0' NOT NULL,
   bg_color_check tinyint(4) DEFAULT '0' NOT NULL,
   usertype tinyint(4) DEFAULT '0' NOT NULL,
   write_check tinyint(4) DEFAULT '0' NOT NULL,
   update_check tinyint(4) DEFAULT '0' NOT NULL,
   delete_check tinyint(4) DEFAULT '0' NOT NULL,
   reply_check tinyint(4) DEFAULT '0' NOT NULL,
   upload_check tinyint(4) DEFAULT '0' NOT NULL,
   PRIMARY KEY (board_id)
);
------------
and use:
$board_id=2;
$sql="insert boardlist(board_id, header_inc, footer_inc, board_width, board_align, name, description, admin, password, email, mail_reply, color1, color2, color3, color4, color5, img_id, btn_id, rows, pages, image_path1, image_path2, image_path3, id_check, writer_check, date_check, point_check, counter_check, image_check, text_check, color_check, bg_image_check, bg_color_check, usertype,write_check, update_check, delete_check, reply_check, upload_check) values('$board_id', '', '', '80%', 'left', 'Board', 'Board', 'admin', '1323', '', '0', '#7DA7D9', '#E1E1FA', '#FFFFFF', '#D0D0FC', '#D0D0FC', '1', '1', '10', '10','http://user.chollian.net/~dawn0121/icon.htm', '', '', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '1', '1', '1', '1', '1');";
		//$sql="insert into boardlist(board_id) values(".$board_id.")";
		mysql_query($sql) or die(mysql_error()."<br>sql==".$sql);
		echo $sql;
------------------
Sometime it works (inserts ok) but sometime doesn't (without notice an error!).
When it doesn't, I copy the sql statement from echo $sql result, paste into mysql command line,and run, but it always works!!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-02 22:47 UTC] sniper@php.net
use addslashes() on data you put into db.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 30 22:01:28 2024 UTC