$etomite->dbQuery() broken/useless?
#1
Posted 06 September 2010 - 06:41 PM
I'm trying to get dbQuery() to execute a query: "select count(*) from et_log_hosts;"
this is the last, final attempt before I posted... At this point, I'm at wit's end... The page returns a message saying that it blew up:
« Error »
Etomite encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed »
SQL: select count(*) from et_log_hosts
Doesn't say what the error actually is... And of course, if I copy the SQl into Toad and run it everything is perfect, and I get the results that I want...
So, how do I ACTUALLY run SQL commands in Etomite?
(If I comment out that line, then the code works fine, so I can assume that the problem is this single query..)
-Chert
#2
Posted 06 September 2010 - 09:02 PM
$res= $etomite->getIntTableRows("count(*)", "et_RegisteredUsers","CubeID='$CubeID' and UserID='$userid';");
which works.... So, I'd have to assume that the other function is broken totally... (which makes some sense, as other snippits are failing that shouldn't be... (the paypal snippit does nothing for example...)
-Chert
Greetings,
I'm trying to get dbQuery() to execute a query: "select count(*) from et_log_hosts;"
this is the last, final attempt before I posted... At this point, I'm at wit's end... The page returns a message saying that it blew up:
« Error »
Etomite encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed »
SQL: select count(*) from et_log_hosts
Doesn't say what the error actually is... And of course, if I copy the SQl into Toad and run it everything is perfect, and I get the results that I want...
So, how do I ACTUALLY run SQL commands in Etomite?
(If I comment out that line, then the code works fine, so I can assume that the problem is this single query..)
-Chert
#3
Posted 07 September 2010 - 01:30 AM
Is there any good way to debug this stuff... So far, I really love etomite, and this is the 2nd site I've done in in... However, I'm slamming hard up against this problem.... I'm going to have to do an insert somehow, and I just want to do a simple insert query to do it... don't need any wrapper around it... it is 1 line of code either way...
The only difference seems to be in how it pushes the results...
I'm going to try copying the working function into my code and see if it works, then pare it down until it either is just executing the sql successfully, or failing...
My luck, it will fail out of the box.. :-(
-Chert
I ended up with the following:
$res= $etomite->getIntTableRows("count(*)", "et_RegisteredUsers","CubeID='$CubeID' and UserID='$userid';");
which works.... So, I'd have to assume that the other function is broken totally... (which makes some sense, as other snippits are failing that shouldn't be... (the paypal snippit does nothing for example...)
-Chert
#4
Posted 07 September 2010 - 12:52 PM
$result = $etomite->dbQuery("SELECT setting_name, setting_value FROM ".$etomite->db."log_hosts");OR$result = $etomite->dbQuery("SELECT setting_name, setting_value FROM ".$etomite->dbConfig['dbase'].".".$etomite->dbConfig['table_prefix']."log_hosts");As you can see, both the database and table prefix are required... $etomite->db holds both of these values for ease of use..
You were headed in the right direction when you were studying the parser file, things just weren't making total sense... There is a bit of redundancy with a few parser functions which may be eliminated in the next major release, or maybe not...
#5
Posted 07 September 2010 - 03:32 PM
However, I just tried that and it worked... Perhaps, I tried it - expecting to have it return the same thing as the other function (instead of "Resource ID#24" - which is what print_r() prints out for it..)
None the less, it now looks like I can do what I want quickly again...
Thanks!!
-Chert
The dbQuery() function works perfectly as is evident by the fact that the parser, index.php, makes extensive use of the function... I just noticed that it is not included in the Etomite Documentation, so here is how it works...
$result = $etomite->dbQuery("SELECT setting_name, setting_value FROM ".$etomite->db."log_hosts");OR$result = $etomite->dbQuery("SELECT setting_name, setting_value FROM ".$etomite->dbConfig['dbase'].".".$etomite->dbConfig['table_prefix']."log_hosts");
As you can see, both the database and table prefix are required... $etomite->db holds both of these values for ease of use..
You were headed in the right direction when you were studying the parser file, things just weren't making total sense... There is a bit of redundancy with a few parser functions which may be eliminated in the next major release, or maybe not...
#6
Posted 07 September 2010 - 05:11 PM
Etomite encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from `runecube`.et_RegisteredUsers where CubeID='Demo1' and UserID='2'' at line 1 »
SQL: select dfg* from `runecube`.et_RegisteredUsers where CubeID='Demo1' and UserID='2';
[Copy SQL to ClipBoard]
(I added 'dfg' in front of the * to create an error)
I changed the dbquery command to fail using:
$this->messageQuit("Execution of a query to the database failed. Error: " . mysql_error(), $query);
This way you can get a clue what is wrong, and fix it in seconds instead of pulling your hair out trying to figure out what is up...
I would suggest this change be made in the release version...
-Chert
I thought that tried a fully qualified database name... ("select * from runecube.et_log_hosts;")...
However, I just tried that and it worked... Perhaps, I tried it - expecting to have it return the same thing as the other function (instead of "Resource ID#24" - which is what print_r() prints out for it..)
None the less, it now looks like I can do what I want quickly again...
Thanks!!
-Chert
#7
Posted 10 September 2010 - 12:36 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











