SA-MP Forums Archive
Not adding space on 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: Not adding space on MYSQL (/showthread.php?tid=654373)



Not adding space on MYSQL - idegod - 27.05.2018

I have a system to register last players deaths, to show it on website...

I doing this:
a while...
Код:
                format(kstr, sizeof(kstr), "'<a href=player.php?p=%s>%s</a>' ", PlayerName(killerid), PlayerName(killerid) ); 
            }
            strcat(strkillers, kstr);
And inserting:
Код:
 mysql_format(ConnectMYSQL, query, sizeof(query), "INSERT INTO `mt` (`player`, `killers`, `date`) VALUES (%d, %s, '%s')", playerid, strkillers, datestr); 
mysql_query(ConnectMYSQL,query);
On DB mt:
Код:
player int(11)
killers text
date varchar(20)
But it's registering:
Код:
<a href=player.php?p=Steve>Steve</a><a href=player.php?p=CarlJr>CarlJr</a>
Instead of:
Код:
<a href=player.php?p=Steve>Steve</a> <a href=player.php?p=CarlJr>CarlJr</a>
And i need to show on player death list:
Player1 Player2

Not Player1Player2 like its beeing for now

Is anybody know how to help me?


Re: Not adding space on MYSQL - Mugala - 28.05.2018

what about to add space here? (in red)
format(kstr, sizeof(kstr), "'<a href=player.php?p=%s>%s</a> ' ", PlayerName(killerid), PlayerName(killerid) );


Re: Not adding space on MYSQL - BroZeus - 28.05.2018

That's not how its supposed to be done at all, don't store HTML directly in the database, store the killerID and playerID in the database and then select those IDs and generate HTML using the backend language you are using accordingly.


Re: Not adding space on MYSQL - idegod - 28.05.2018

Quote:
Originally Posted by Mugala
Посмотреть сообщение
what about to add space here? (in red)
format(kstr, sizeof(kstr), "'<a href=player.php?p=%s>%s</a> ' ", PlayerName(killerid), PlayerName(killerid) );
Yes i'm already doing, thats is the code:
Код:
format(kstr, sizeof(kstr), "'<a href=player.php?p=%s>%s</a>' ", PlayerName(killerid), PlayerName(killerid) );
Quote:
Originally Posted by BroZeus
Посмотреть сообщение
That's not how its supposed to be done at all, don't store HTML directly in the database, store the killerID and playerID in the database and then select those IDs and generate HTML using the backend language you are using accordingly.
I just added the HTML code because i have to add
sometimes
<a href="#">A</a>
sometimes
<a href="#">A</a> <a href="#">B</a>
sometimes
<a href="#">A</a> <a href="#">B</a> <a href="#">C</a>

So just a space in the end should be enough, but is not working...
So how should i add only the IDs of players and check how many ids have in a single storage to create the HTML code?


Re: Not adding space on MYSQL - GTLS - 28.05.2018

PHP код:
format(kstrsizeof(kstr), "'<a href=player.php?p=%s>%s</a>&nbsp; ' "PlayerName(killerid), PlayerName(killerid) ); 
HTML does not recognize empty white spaces. Use &nbsp; to give spaces.


Re: Not adding space on MYSQL - idegod - 03.06.2018

Quote:
Originally Posted by GTLS
Посмотреть сообщение
PHP код:
format(kstrsizeof(kstr), "'<a href=player.php?p=%s>%s</a>&nbsp; ' "PlayerName(killerid), PlayerName(killerid) ); 
HTML does not recognize empty white spaces. Use &nbsp; to give spaces.
I'm sorry to this too long!
Thank you again! Works!
+REP