SA-MP Forums Archive
Strickenkids mysql_fetch_row_data to BlueG's mysql_fetch_field_row mysql-plugin - 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: Strickenkids mysql_fetch_row_data to BlueG's mysql_fetch_field_row mysql-plugin (/showthread.php?tid=357644)



Strickenkids mysql_fetch_row_data to BlueG's mysql_fetch_field_row mysql-plugin - tMike - 07.07.2012

Hi dear,

i've converted my script from strickenkids-mysql plugin to BlueG's ones. But now, a small system will not work, which uses "mysql_fetch_row_data". I tried it with "mysql_retrieve_row", but it only works for exactly three times (not more, with the mysql-plugin from strickenkid it works fine).

Example:

[pwn]
format(querystring,sizeof(querystring),"SELECT * FROM `infodatabase` WHERE id LIKE '%s' OR info1 LIKE '%%%s%%%' OR info2 LIKE '%%%s%%%' OR info3 LIKE '%%%s%%%' OR info4 '%%%s%%%' LIMIT 1", infonumb,info1,info1,info1,info1);
mysql_query(querystring, -1,-1,sqlconnection);
printf("2: %s",querystring);
mysql_store_result(sqlconnection);
mysql_retrieve_row(sqlconnection);
mysql_fetch_field_row(string, "infomsg");
mysql_free_result(sqlconnection);
[/pwn]

Before i've converted to BlueG's MySQL Plugin (from Strickenkids), it stands exactly like that:

[pwn] format(querystring,sizeof(querystring),"SELECT * FROM `infodatabase` WHERE id LIKE '%s' OR info1 LIKE '%%%s%%%' OR info2 LIKE '%%%s%%%' OR info3 LIKE '%%%s%%%' OR info4 '%%%s%%%' LIMIT 1", infonumb,info1,info1,info1,info1);
mysql_query(querystring);
mysql_store_result();
mysql_fetch_row_data();
mysql_fetch_field("infomsg",string);
mysql_free_result();[/pwn]

Do I use the wrong function?

Whats wrong?

Thanks for help.


Re: Strickenkids mysql_fetch_row_data to BlueG's mysql_fetch_field_row mysql-plugin - Vince - 07.07.2012

Seeing as you're only fetching a single field, you should restructure the query to select that field only (select infomsg from infodatabase ...). You can then simply call myqsl_fetch_row to store the result directly without the need to call any subsequent functions.


AW: Strickenkids mysql_fetch_row_data to BlueG's mysql_fetch_field_row mysql-plugin - tMike - 07.07.2012

Thanks a lot.