[PHP-DB] Query was empty - Strange problem

2005-03-16 Thread Vinayakam Murugan
Hi

I have an application in which i am connecting to three different
databases. I have three  connect and query procedure. I am facing
problems with one of these databases.

---
$Conn = mysql_pconnect($Hostname,$Loginname,$Passwd);

$Ret = mysql_select_db ($Dbname, $Conn);

if (!$Ret)
{
$Error = Error opening Database : $Dbname BR;
return FALSE;
}

$Ret = mysql_query ($Query, $Conn) or $Error = BRBR .
mysql_errno() . --- . mysql_error() . BRBR;

echo $Error;
---

I am getting an Error - Query was empty.

I have tried echoin $Query before and after the mysql_query. It shows
a proper query which if I copy and execute in phpmyadmin, i get the
required results. It is not workign through PHP only.


Any pointers would be very helpful.

-- 
Warm Regards

Vinayak

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



Re: [PHP-DB] Query was empty - Strange problem

2005-03-16 Thread Vinayakam Murugan
This is a common procedure. $Query is being passed to it. As I had
said before, i had tried echoing $Query before and after the
mysql_query statement and it displays a proper query.

That's what driving me nuts! :-(

On Wed, 16 Mar 2005 22:36:13 -0800, Stephen Johnson [EMAIL PROTECTED] wrote:
 I do not see where you are populating $Query -- therefore your query
 would be empty --
 
 
 On Mar 16, 2005, at 10:30 PM, Vinayakam Murugan wrote:
 
  Hi
 
  I have an application in which i am connecting to three different
  databases. I have three  connect and query procedure. I am facing
  problems with one of these databases.
 
  ---
  
  $Conn = mysql_pconnect($Hostname,$Loginname,$Passwd);
 
  $Ret = mysql_select_db ($Dbname, $Conn);
 
  if (!$Ret)
  {
  $Error = Error opening Database : $Dbname BR;
  return FALSE;
  }
 
  $Ret = mysql_query ($Query, $Conn) or $Error = BRBR .
  mysql_errno() . --- . mysql_error() . BRBR;
 
  echo $Error;
  ---
  
 
  I am getting an Error - Query was empty.
 
  I have tried echoin $Query before and after the mysql_query. It shows
  a proper query which if I copy and execute in phpmyadmin, i get the
  required results. It is not workign through PHP only.
 
 
  Any pointers would be very helpful.
 
  --
  Warm Regards
  
  Vinayak
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 *
 Stephen Johnson
 [EMAIL PROTECTED]
 http://www.thelonecoder.com
 
 --continuing the struggle against bad code--
 *
 
 


-- 
Warm Regards

Vinayak

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



Re: [PHP-DB] Query was empty - Strange problem

2005-03-16 Thread Vinayakam Murugan
Here is the entire function

function Executequery($Query)
{
global $Error, $Hostname,$Loginname,$Passwd,$Dbname,$Conn;

$Conn = mysql_pconnect($Hostname,$Loginname,$Passwd);

$Ret = mysql_select_db ($Dbname, $Conn);

if (!$Ret)
{
$Error = Error opening Database : $Dbname BR;
return FALSE;
}

$Ret = mysql_query ($Query, $Conn) or $Error = BRBR .
mysql_errno() . --- . mysql_error() . BRBR;


if (!$Error)
{
$numfields = mysql_num_fields($Ret);
$numrows = mysql_num_rows($Ret);
if($numrows == 0)
{
$Error = Query returned zero records;
return FALSE;
}
}
else
{
return FALSE;
}


}


On Wed, 16 Mar 2005 22:36:13 -0800, Stephen Johnson [EMAIL PROTECTED] wrote:
 I do not see where you are populating $Query -- therefore your query
 would be empty --
 
 
 On Mar 16, 2005, at 10:30 PM, Vinayakam Murugan wrote:
 
  Hi
 
  I have an application in which i am connecting to three different
  databases. I have three  connect and query procedure. I am facing
  problems with one of these databases.
 
  ---
  
  $Conn = mysql_pconnect($Hostname,$Loginname,$Passwd);
 
  $Ret = mysql_select_db ($Dbname, $Conn);
 
  if (!$Ret)
  {
  $Error = Error opening Database : $Dbname BR;
  return FALSE;
  }
 
  $Ret = mysql_query ($Query, $Conn) or $Error = BRBR .
  mysql_errno() . --- . mysql_error() . BRBR;
 
  echo $Error;
  ---
  
 
  I am getting an Error - Query was empty.
 
  I have tried echoin $Query before and after the mysql_query. It shows
  a proper query which if I copy and execute in phpmyadmin, i get the
  required results. It is not workign through PHP only.
 
 
  Any pointers would be very helpful.
 
  --
  Warm Regards
  
  Vinayak
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 *
 Stephen Johnson
 [EMAIL PROTECTED]
 http://www.thelonecoder.com
 
 --continuing the struggle against bad code--
 *
 
 


-- 
Warm Regards

Vinayak

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



Re: [PHP-DB] Query was empty - Strange problem

2005-03-16 Thread Stephen Johnson
I do not see where you are populating $Query -- therefore your query  
would be empty --

On Mar 16, 2005, at 10:30 PM, Vinayakam Murugan wrote:
Hi
I have an application in which i am connecting to three different
databases. I have three  connect and query procedure. I am facing
problems with one of these databases.
--- 

$Conn = mysql_pconnect($Hostname,$Loginname,$Passwd);

$Ret = mysql_select_db ($Dbname, $Conn);
if (!$Ret)
{
$Error = Error opening Database : $Dbname BR;
return FALSE;
}
$Ret = mysql_query ($Query, $Conn) or $Error = BRBR .
mysql_errno() . --- . mysql_error() . BRBR;
echo $Error;
--- 


I am getting an Error - Query was empty.
I have tried echoin $Query before and after the mysql_query. It shows
a proper query which if I copy and execute in phpmyadmin, i get the
required results. It is not workign through PHP only.
Any pointers would be very helpful.
--
Warm Regards

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

*
Stephen Johnson
[EMAIL PROTECTED]
http://www.thelonecoder.com
--continuing the struggle against bad code--
*
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php