SA-MP Forums Archive
Converting mysqlite to mysql - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Converting mysqlite to mysql (/showthread.php?tid=318803)



Converting mysqlite to mysql - thimo - 16.02.2012

So hello. Well i have got a code wich is for mysqlite but i want to use mysql its this:
http://pastebin.com/aTCz3FY2
Can anyone convert it into mysql?

Thanks in advance


Re: Converting mysqlite to mysql - Rob_Maate - 16.02.2012

It's pretty much the same, just: mysql_ instead of db_

Also, look up the syntax it varies slightly


Re: Converting mysqlite to mysql - thimo - 17.02.2012

But what about this line:
pawn Код:
dbr = mysql_query(db, str); //Send the query to the SQLite system integrated in SA:MP
I get an error of the db ofcourse but what i have to put there ?
Edit: Also this how is this in mysql:
pawn Код:
mysql_next_row(dbr); //Jumps to the next returned row



Re: Converting mysqlite to mysql - Toreno - 17.02.2012

pawn Код:
dbr = mysql_query(str);



Re: Converting mysqlite to mysql - thimo - 17.02.2012

And what about the mysql_next_row part?


Re: Converting mysqlite to mysql - Toreno - 17.02.2012

I think you can delete that part and replace the loop with while(mysql_num_row(str)), then do whatever you want inside.


Re: Converting mysqlite to mysql - thimo - 17.02.2012

What has this to be?
pawn Код:
mysql_get_field(dbr, 0, str, sizeof(str)); //Gets the first field of the row returned (HouseID)



Re: Converting mysqlite to mysql - Toreno - 17.02.2012

XXX is a specific column you want to take information from, which is a specific table.
pawn Код:
mysql_get_field("XXX", str);



Re: Converting mysqlite to mysql - thimo - 17.02.2012

So it should be like this?
pawn Код:
mysql_get_field("%s", str); //Gets the first field of the row returned (HouseID)
Edit:
This gives me error:
pawn Код:
while(mysql_num_rows(str))
This is the error code:
Код:
C:\Users\Thimo\Desktop\Sa-mp 0.3d\gamemodes\ER.pwn(692) : error 035: argument type mismatch (argument 1)



Re: Converting mysqlite to mysql - Toreno - 17.02.2012

Let's say you have a few columns in a specific table, such as HOUSES. You have HouseID, Owner, Locked, in that specific table.
pawn Код:
mysql_get_field("Locked", str);
I was wrong, I think... this retrieves rows.
pawn Код:
while(mysql_retrieve_row())
EDIT: This will only confuse you, I suggest you try learning a few MySQL tutorials, instead of asking how to convert, this will make it easier for you, since I'm not an expert of SQL Lite.