Liberty Unleashed
Scripting => Script Help => Topic started by: JamesConway on June 20, 2015, 11:31:20 pm
-
Hello dear scripters,
For some reason this code crashes my server, is there any other way to get all rows from a mysql_fetch_assoc?
local row;
while(row = mysql_fetch_assoc(result))
{
MessagePlayer(row["type"] + " " + row["rank"], player, 255, 0, 0);
}
It only happens where there are more then 1 records in the database. I used the same example from the wikipedia. Result here is a mysql_query
-
I'm assuming you are using the MySQL plugin. If I remember correctly, it had a couple bugs in it which could result in issues like the one you have. Try the one listed on the wiki and see if that helps remedy your issue.
-
Strange. In all the time I've been using this plugin, I've never come across this issue.
I use mysql_fetch_assoc( ) all the time.
@JamesConway - Can you reply with a snippet that contains your query?
When I run a query, I always check to see if the returned result pointer actually exists. Sometimes running queries that have an issue with SQL syntax or some other problem causes issues. I also check to see if there are is at least one row before trying to use mysql_fetch_assoc().
Something like this: Pastebin Link (http://pastebin.com/raw.php?i=M1D7jAcY)
It may seem a bit excessive, but you can never be too careful I guess.
-
The problem was that the mysql plugin dll that gets shipped with the download is not the right one. I downloaded the sourcecode of the mysql plugin, compiled it myself and then it worked out fine.
I think that the latest update from the mysql plugin wasn't compiled with the download on the website.
-
Yeah, there was a problem with this a while back too ... An issue with the original compile or something.
I think it was re-compiled by another member here at LU, which that version has worked just fine for me ever since.
-
I think it was re-compiled by another member here at LU, which that version has worked just fine for me ever since.
I believe Stormeus was the one who did that after we discovered this bug a very long time ago.