Not adding space on MYSQL
#1

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

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

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

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?
Reply
#5

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)