php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5648 INSERT statements no longer work using mysql_query()
Submitted: 2000-07-17 22:20 UTC Modified: 2000-08-20 06:18 UTC
From: alanflum at aksi dot net Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0.1pl2 OS: Debian GNU Linux "Woody" Kernel
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alanflum at aksi dot net
New email:
PHP Version: OS:

 

 [2000-07-17 22:20 UTC] alanflum at aksi dot net
We recently upgraded to MySQL 3.23.21-beta and php 4.01pl2 (Apache 1.3.12, Debian v.10.8 Debian GNU Linux "Woody"). 
INSERT statements no longer work using the mysql_query() . The return value is always 0. UPDATE, and SELECT seem to work fine. In addition, INSERT seems to work OK using mysql_db_query() .Others have reported this same exact problem on phpbuilder.com mailing list archive. In addition, all php scripts on the upgraded machine using INSERT and mysql_query experience the same problem (for example phpMyAdmin).

Here is some sample code:

$user= "demo";
$host= "localhost";
$password= "mypassword";
$database= "mydatabase";

$connection = mysql_connect($host,$user,$password)or die("No Connection");
mysql_select_db($database, $connection)or die("Can't Select Database");
$addrow = "INSERT INTO test  VALUES ('$name1', '$name2')"; 
$result= mysql_query($addrow, $connection) or die("Can't Add Selections to Test Table"); 

If I remove the die() in the last statement and check the value of $result, it always returns a 0. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-20 06:18 UTC] sniper@php.net
Read the manual:

http://www.php.net/manual/function.mysql-query.php


--Jani
 [2002-06-30 04:37 UTC] akujin11 at yahoo dot com
i have been experianceing the exact same problem. i require the use of the INSERT SQL command and i cannot seem to get it to work. the command SEEMS to process correctly, with one error. the data is never added to the database.

the manual does NOT give the required information, and i need a solution. if you can not give me what i want, can you direct me to someone that can?

the Akujin
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 05:01:31 2024 UTC