Created Table using
MYSQLTest <- mysql_connect("blabla", "blabla", "blabla", "blabla");
mysql_query( MYSQLTest, "CREATE TABLE IF NOT EXISTS TTP( Name TEXT, TTP NUMERIC, Onine_Time TEXT )" );
Now by simply using this query
local myqueryttp = mysql_query( MYSQLTest,"SELECT Name FROM TTP WHERE Name='"+player.Name+"'");
The query returns false & connection and everything else is fine. :(
Not trying to be rude but, why would you query for a name if you know the name? lol
Quote from: Shadow on Apr 03, 2017, 12:30 PMNot trying to be rude but, why would you query for a name if you know the name? lol
To check if name exists in "TTP" maybe.
Quote from: vito on Apr 03, 2017, 12:57 PMQuote from: Shadow on Apr 03, 2017, 12:30 PMNot trying to be rude but, why would you query for a name if you know the name? lol
To check if name exists in "TTP" maybe.
Yup
its just an example of simple query which returns false everytime.
Any idea how to fix this.
What does mysql_error return?
To that query, I would suggest limiting the results to 1 (https://www.w3schools.com/php/php_mysql_select_limit.asp) in order to prevent searching the remaining rows if the condition was met. Thus avoiding the removal of hot data from the cache to make room for something that isn't even relevant.
Maybe there should be used COUNT() because one don't need a data from table, just checking.
COUNT() is kinda irrelevant since you only select a single row. This is equal to simply selecting the row ID instead of the name. Except the latter might be simpler and or faster.
Dunno, need to make a benchmark w/o cache to test what is faster.
Quote from: Thijn on Apr 03, 2017, 04:29 PMWhat does mysql_error return?
Not tried ill check..
Quote from: happymint on Apr 03, 2017, 05:00 PMTo that query, I would suggest limiting the results to 1 (https://www.w3schools.com/php/php_mysql_select_limit.asp) in order to prevent searching the remaining rows if the condition was met. Thus avoiding the removal of hot data from the cache to make room for something that isn't even relevant.
I cant, actually i am using queries for webstats.
The given example was just to show that simple query returns false.
Quote from: vito on Apr 03, 2017, 05:38 PMDunno, need to make a benchmark w/o cache to test what is faster.
Ill try it tomorrow.
@zeus Give proper permissions to your db or check table is exists or not because i run the same query only change the db name and tabble name its not giving any error
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi65.tinypic.com%2F2im9s05.png&hash=1c150e3f61efc3d2cc8fd6b9bad277cd70aa1347)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi66.tinypic.com%2Feameit.png&hash=2cdad8e22abc7c48774826679eeef45700520acc)