php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22636 the function mysql_query makes errors in PHP variables
Submitted: 2003-03-11 10:21 UTC Modified: 2003-03-12 02:50 UTC
From: real_mctl at yahoo dot fr Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.1 OS: Linux Red Hat 7.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: real_mctl at yahoo dot fr
New email:
PHP Version: OS:

 

 [2003-03-11 10:21 UTC] real_mctl at yahoo dot fr
It's simple, my entreprise updated the version of PHP, from 4.1.2 to 4.3.1.
The problem is that when the function mysql_query is executing some query, this function overwrite all data on my PHP script even the query itself !

An example (the query is indeed correct) :

$query = "select * from table" ;
$result = @mysql_query($query,$idCnx) ;
The execution of the query crashes, return 1 (don't return a ressource id) and owerwrite the content of $query to an empty value !


Thanks

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-11 11:19 UTC] sniper@php.net
huh? What if you remove that @ from the mysql_query() call?

 [2003-03-11 11:20 UTC] sniper@php.net
And add a _FULL_ but short example script here, not just 2 lines from one..

 [2003-03-11 14:40 UTC] real_mctl at yahoo dot fr
no need to copy the entire code (huge app).
the code before and after mysql_query is correct.
 [2003-03-11 20:39 UTC] sniper@php.net
Can't reproduce. You're doing something wrong obviously.

 [2003-03-12 02:49 UTC] real_mctl at yahoo dot fr
<?
	function fSelectionnerNiveauSuivi(&$tabNiveauSuivi)
	{
		$succes=false;
		if ( ($idLienCnx=fConnecterBase(CONFIG_SUJET)) != false) // fConnecterBase() works properly, parses a constant who contains identifiers for the connection to the database
		{
			if (($resultat = fSelectNiveauSuivi($idLienCnx))!= false) 
			{
				$succes=true;
				while ($ligne=mysql_fetch_object($resultat))
				{
					$tabNiveauSuivi['idNiveauSuivi'][]=$ligne->idNiveauSuivi;
					$tabNiveauSuivi['nom'][]=$ligne->nom;
								
				}
				$succes = fLiberer($resultat,$succes); // fLiberer() free the memory (works properly)
			}
			$succes=fDeconnecterBase($idLienCnx,$succes); // fDeconnecterBase() close the connection with the base
		}
		return $succes ;
	}

	function fSelectNiveauSuivi($idLienCnx)
	{
		$requete="SELECT * FROM NiveauSuivi ORDER BY nom ";
		$resultat=fEmettreRequete($requete,$idLienCnx) ;
		return $resultat ;
	}

	function fEmettreRequete($requete,$idLienCnx) 
	{
		// Emission de la requ?te
		$resultat = @mysql_query($requete,$idLienCnx);
		
		if ($resultat==false) 
		{
			// Requ?te en erreur
			fEnregistrerErreur(mysql_errno(), mysql_error() . " Requete:" . $requete) ; // fEnregistrerErreur() mails the webmaster that an error occured when quering the database
		}
		
		// Retour
		return $resultat ;
	}

	$succes = fSelectionnerNiveauSuivi(&$tabNiveauSuivi) ;
?>

OK !
The script works perfect with PHP 4.1.2 but with 4.3.1, it does not work
One other detail : the functions listed above are in different include files and the include instruction is always called when necessary.
After all, if I reload the page with the script, i have no problem

Is this bogus again ??

Thanks
 [2003-03-12 02:50 UTC] real_mctl at yahoo dot fr
a
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 15:01:34 2025 UTC