[MYSQL](Hardcoding). Its not saving any rows.
#21

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
Browse allows you to browse any content within the table. Structure shows you how the layout of the table, allows you to add/remove fields/columns, rearrange them, etc.

Do this:
Click the 'SQL' tab.

Copy the below query into the input box and click 'Go' which is at the right hand side.
PHP код:
INSERT INTO `misc` (`gMOTD`) VALUES ('This is my first MOTD!'
Then click 'Browse' and see if it returns anything.
What if the query is integer. It is still VALUE ?
Like this example concept below:

Код:
The query is
format(query, sizeof(query), "%s `gMOTD` = '%s',", query, g_mysql_ReturnEscaped(GlobalMOTD, MainPipeline));
Then the insert Code will be like this
PHP код:
INSERT INTO `misc` (`gMOTD`) VALUES ('This is my first MOTD!'
Second Query is like this
pawn Код:
format(query, sizeof(query), "%s `ShopClosed` = '%d',", query, ShopClosed);
Then what will be the insert code guys ??
PHP код:
INSERT INTO `misc` (`ShopClosed`) VALUES ?? OR INTEGER What will be (`valuehere`) 
Im so newbie at Mysql coding. Its hardcoding for me

Thanks for your help. I will give +REP
Reply
#22

Up (10chars)
Reply
#23

Yes, you still use "VALUES" no matter what you are inserting.

So to insert values into the gMOTD and ShopClosed fields, you would do this:

PHP код:
new query[100];
format(querysizeof(query), "INSERT INTO `misc` (`gMOTD`, `ShopClosed`) VALUES ('%s', '%d')"g_mysql_ReturnEscaped(GlobalMOTDMainPipeline), ShopClosed); 
Reply
#24

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
Yes, you still use "VALUES" no matter what you are inserting.

So to insert values into the gMOTD and ShopClosed fields, you would do this:

PHP код:
new query[100];
format(querysizeof(query), "INSERT INTO `misc` (`gMOTD`, `ShopClosed`) VALUES ('%s', '%d')"g_mysql_ReturnEscaped(GlobalMOTDMainPipeline), ShopClosed); 
Very nice , Thanks for helping , I will still reply back if some problem occurs again.
Reply
#25

Another Problem.

I was going to run this query directly through SQL Tab but i got this error


If you're going to tell me Im a noob, Please its okay for , Im noob at MySQL, So beginner aswell
Reply
#26

Quote:
Originally Posted by PURG3D
Посмотреть сообщение
Another Problem.

I was going to run this query directly through SQL Tab but i got this error


If you're going to tell me Im a noob, Please its okay for , Im noob at MySQL, So beginner aswell
The reason that happened is because MySQL doesn't format your queries like the format(..) function does in PAWN.

If you want to run that through the MySQL tab, try this code instead:

PHP код:
INSERT INTO `misc` (`gMOTD`, `ShopClosed`) VALUES ('The first Global MoTD!''1'
Reply
#27

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
The reason that happened is because MySQL doesn't format your queries like the format(..) function does in PAWN.

If you want to run that through the MySQL tab, try this code instead:

PHP код:
INSERT INTO `misc` (`gMOTD`, `ShopClosed`) VALUES ('The first Global MoTD!''1'
THank you so much!.

P.S : My coode about (format) . How to execute that format ?

for example : SendQuery(query)

How to send those format above directly to SQL Tab ?
Reply
#28

You have to use the function that was available for the version of MySQL you're using.

From your first post, you had this function so I'll assume this is the function you need:
PHP код:
format(querysizeof(query), "INSERT INTO `misc` (`gMOTD`, `ShopClosed`) VALUES ('%s', '%d')"g_mysql_ReturnEscaped(GlobalMOTDMainPipeline), ShopClosed);  
mysql_function_query(MainPipelinequeryfalse"OnQueryFinish""i"SENDDATA_THREAD); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)