[Plugin] [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded...
#21

had an issue, but i solved it...it was posted here. i was being an idiot
Reply
#22

if i do a while loop like that, how do i access the data as the loop runs? everything i try crashes the server.
Reply
#23

try to use timer? (and im having problems editing posts! dont know why)
Reply
#24

here is a sample code for your loop:
Code:
new resultline[1024]; 

samp_mysql_connect("127.0.0.1", "root", "");   //replace with the good params
samp_mysql_select_db("test");            //replace with the good database
samp_mysql_query("SELECT * FROM members"); //replace with the good query
samp_mysql_store_result(); 

while(samp_mysql_fetch_row(resultline))
{
  printf("%s\n", resultline);
}

samp_mysql_close();
Reply
#25

lets see if posting is fixed here...

pawn Code:
public billboard(playerid){
    new conBillboard;
    conBillboard = samp_mysql_connect(mysqlhost, mysqluser, mysqlpassword);
    if(conBillboard == 0){
        SendClientMessage(playerid,red,"Error connecting to mysql database. Please notify administrator.");
    }else{
        samp_mysql_select_db(mysqldb);
        samp_mysql_query("select entry from billboard order by id");
        samp_mysql_store_result();
        new string[1024];
        while(samp_mysql_fetch_row(string)){
      printf("%s\n",string);
        }
        samp_mysql_close();
    }
    SetTimer("billboard",120000,0);
    return 1;  
}
thats what im doing. it causes a server crash as soon as a player connects. as best i can tell, i am doing the exact same thing you are doing.

the database is working, the userid, password, and mysqldb are all set correctly because i use them in a vehicle spawn function (that looks up vehicle id's in a sql table based on their name)...

its only when i am doing the while loop that things break.

for windows, i am using your executables entirely. on linux, i compiled the plugin, and am using a precompiled libmysqlclient from 5.0.41

as for the double post above, i apologize...but this site was having tremendous difficulty in doing anything with large posts earlier

i dont see the point of complaining about double posting on a forum anyway. if you dont do it at times, it completely does away with the intended purpose of "show new replies to your posts". this is my opinion, and thats all it is. i dont make the rules here, nor do i enforce them. i try and follow them as best i can, but with the site doing what it was doing earlier, there was no way around it.
Reply
#26

Now, the project is hosted on dev.sa-mp.com.
Click here to see the page.
Reply
#27

well, i dont know what i did...but somewhere between switching from the broken WHILE, to the working FOR, on to a working WHILE...i arrived back at a WHILE that was broken...i deleted the entire function and tried to rewrite it several times as a while...loop to no avail. it just crashed the server each time i connected.

im back to the working for...loop for now, and im perfectly happy with that. lol...ive never used while loops before, i have no idea why i decided to start when i read this thread. lol...
Reply
#28

Quote:
Originally Posted by Flyin
fluid !
Quote:

« Last Edit: Today at 11:10:49 AM by fluid »

:} GZ
lol...
After becoming a "good loop scripter", he'll become a good post "editor"...
Reply
#29

actually, i talked to someone on irc, and they did say they were having problems with the machine these forums are on...but that the person who could fix it was asleep...soooooo :P
Reply
#30

New Release is out !!!

Check out it HERE
Reply
#31

What did you add/Fix?

strtok, ping?
Ok, lets ping each other xD
Reply
#32

Take a look to the official page (link is in the first post of the topic)...
Reply
#33

while...loop works exactly as i did it before (when it didnt work). i am using your .so file though instead of compiling my own...so i dont know if something was wrong with mine, or you made some change that fixed it.
Reply
#34

The new one is fixed...

And if you look the Pawn example, you'll see a "very beautiful working" while loop...
Reply
#35

Quote:
Originally Posted by [RAZ
ADreNaLiNe-DJ ]
The new one is fixed...

And if you look the Pawn example, you'll see a "very beautiful working" while loop...
well my not-very-beautifully-working while loop is now very-beautifully-working ... hehe...

this rocks btw...i seriously sat around wishing the other day that i didnt have to stuff so much crap into an array the other day (vehicle data), and then use rudimentary array functions on it to find what i needed...

i love it, and a lot of us appreciate it...

you should do some simple benchmark tests, just to see what reading a populated table, and looping each of the records is like as opposed to a script that uses the filesystem to do the same... there was a miniargument today on irc about mysql being slower than the way most people store their data (flat files). hehe...
Reply
#36

The inconvenient of MySQL is to send and receive something to another program (MySQL), waiting for reply,...
But the advantage is that you can make queries. Queries are like filters on data that you don't have in flat files.


Is it a solution using SQL-Lite ?

It depends on the use of the database, if databse is also used by a website, MySQL is best to a better handling of multi-threading.
Reply
#37

Quote:
Originally Posted by [RAZ
ADreNaLiNe-DJ ]
The inconvenient of MySQL is to send and receive something to another program (MySQL), waiting for reply,...
But the advantage is that you can make queries. Queries are like filters on data that you don't have in flat files.


Is it a solution using SQL-Lite ?

It depends on the use of the database, if databse is also used by a website, MySQL is best to a better handling of multi-threading.
i agree with that 100%...it also keeps your freaking filesystem clean. lol...id just love to see how long the filesystem takes to loop through 4896 users created with dudb (not saying dudb is bad, its great!) in comparison to 4896 users in a mysql table...

mysql would be in milliseconds...cause we did a table that size last night and thats how long it took to select and give back the resultset for all rows. hehe...
Reply
#38

If you can give me your table, i'll make some tests...

I'll give you results and my "server" specification (not really a server, it's a too old pc...).
Reply
#39

Crashes windows server if failed to connect to mysql server.
Reply
#40

It's a known bug, read the Installation Notes !!!

If you make "your job" to get all returned values by function you can prevent from crashing...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)