CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Why does $db->query sometimes not work?

Print topic Send  topic

Author Message
Jeannine
Posted: 06/05/2003, 6:04 PM

Sometimes I can run teh $db functoins fine, and at other times I simply cannot retrieve data this way. At those times I have to result to mysql_connect (etc.) or mssql_connect (etc) methods. I cannot seem to nail down what the problem is. It happens on both mySQL and MS SQL. I am using DSN connections.

Any ideas?
glerma
Posted: 06/05/2003, 6:51 PM

Post an example code snippet that is sometimes not working...
Jeannine
Posted: 06/06/2003, 6:36 AM

Orginally I had a complex query that did not run. I dummied it down considerably to this silly example. Still it did not work. Note that mysql_connect, mysql_dfetch etc. worked. So did dloookup...

here is a simple code snippet that did not work:

$thequery = "select * from states where state_id = 10";
$db->query($thequery);
$fldstate_id = $db->f("state_id");

--- $fldstate_id came back null.
glerma
Posted: 06/06/2003, 12:28 PM

Are you creating a new $db connection object every time or are you just globalizing the original?

What I mean is when I need to do custom queries, I always create a new connection object.

Example: $db = new clsDB<Name>;

Then I do my normal query operations.
$db->query($sql);

After I'm all finished, then I cleanup the $db object.
unset($db);

Regards,
george


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.