Converting mysqlite to mysql
#1

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
Reply
#2

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

Also, look up the syntax it varies slightly
Reply
#3

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
Reply
#4

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

And what about the mysql_next_row part?
Reply
#6

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

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

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

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)
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)