PHP Classes

Posssible BUG - I have fixed and want share!

Recommend this page to a friend!

      Remote MySQL Query  >  All threads  >  Posssible BUG - I have fixed and...  >  (Un) Subscribe thread alerts  
Subject:Posssible BUG - I have fixed and...
Summary:BUG
Messages:4
Author:Fernando Reis Guimaraes
Date:2007-08-23 18:31:52
Update:2010-03-17 16:41:26
 

  1. Posssible BUG - I have fixed and...   Reply   Report abuse  
Picture of Fernando Reis Guimaraes Fernando Reis Guimaraes - 2007-08-23 18:31:52
Hello guys!

I hope that I have found a bug in this class!

When I have tryed to send a REPLACE or INSERT statement, then I got error on line 91.

That line tries to fetch results when does not have nothing to fetch because that isnīt a SELECT statement.

I have fixed that, simply put that before line 91, do not forget to close

if (is_resource($result)) // THAT IS BUG FIX
{
// process one row at a time
while ($row = mysql_fetch_assoc($result)) {

// Keep the row count
$rowCount = $rowCount + 1;

// Add node for each row
$element = $doc->createElement('row');
$element = $root->appendChild($element);
$element->setAttribute('index', $rowCount);

// Add a child node for each field
foreach ($row as $fieldname => $fieldvalue) {
$child = $doc->createElement($fieldname);
$child = $element->appendChild($child);

// $fieldvalue = iconv("ISO-8859-1", "UTF-8", $fieldvalue);
$fieldvalue = htmlspecialchars($fieldvalue);
$value = $doc->createTextNode($fieldvalue);
$value = $child->appendChild($value);
} // foreach

} // while
} // THAT BUG FIX ENDS HERE!


Contribution of Fernando Reis Guimarães
Site http://www.fernandobhz.com.br

  2. Re: Posssible BUG - I have fixed and...   Reply   Report abuse  
Picture of Jeff Williams Jeff Williams - 2007-08-26 21:33:56 - In reply to message 1 from Fernando Reis Guimaraes
Thank you for your contribution, Fernando Reis Guimarães!

I have added your name to the credits at the top of the file.

  3. Re: Posssible BUG - I have fixed and...   Reply   Report abuse  
Picture of Fernando Reis Guimaraes Fernando Reis Guimaraes - 2007-08-27 18:55:11 - In reply to message 2 from Jeff Williams
You are welcome, I'm happy to help the community.
Congratulations for the class, it has been very useful for me.

  4. Re: Posssible BUG - I have fixed and...   Reply   Report abuse  
Picture of girish girish - 2010-03-17 16:41:27 - In reply to message 3 from Fernando Reis Guimaraes
I am getting following error while connecting to remote server

Warning: file_get_contents(http://www.agnisdesigners.com/remote_query_server.php?key=pass123&db=agnisdes_laginghai&host=XXXXX&user=XXXXXX&pass=gXXXXX&sql=SELECT+%2A+FROM+city) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\domains\alhidayatshadi.com\wwwroot\remotequery.class.php on line 106
Could not connect to remote server