Jump to content

Php Text Show As ?


Mudsaf

Recommended Posts

So im having this problem with my php, when i get data from my SQL database example of this.gw-32?(f-bb>>&-p9yI@-)bSlj-wVyIW-(it will show it at website like this -load gw-32?(f-bb>>&-p9yI@-)bSlj-wVyIW-( So when it adds it goes like . Text is echoed to table. SQL type = TEXT. This is my charset on the page: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> Please any fix/help would be nice :).

Link to comment
Share on other sites

make that column collation as utf-8, serve the page as utf-8 and save the file also as utf-8. probably some characters of that is not supporting by current collation

Link to comment
Share on other sites

Saved the file as UTF-8, but didin't help, charset = utf-8. (Opened with notepad the php file and added on encoding UTF-8 is that correct?). How do i make column collation to utf-8.

Link to comment
Share on other sites

if you are using notepadd++ then use convert to utf-8 without BOM if notepad then you can simply slect encoding at the time of saving. you can change the collation from your phpmyadmin.. go to the table the field exist and alter the column. there you can see collation option too

Link to comment
Share on other sites

Changed on PhpMyAdmin to utf8_general_ci. Still doesn't show it correctly. Serve the page as UTF-8? Here is my PHP Code.

<?phpsession_start();include 'connect.php'; if ($_SESSION['check']=true) {echo "<a href=\"login_confirm.php\">Return to main</a>";echo " | ";echo "<a href=\"logout.php\">Logout</a>";echo "<br>";$id = $_SESSION['AccID'];$query = "SELECT * FROM war3savecode WHERE AccountID = $id";$querygoh = "SELECT * FROM war3savecode WHERE AccountID = $id AND Gamename = 'Guilds of Hyppos' AND visible = 'Yes'";$result = mysql_query($query)	or die("Error on result :" . mysql_error());   	echo "<h2>Guilds of Hyppos RPG<table border=\"1\">		<tr>		<th id=\"tablefont\">Gamename</th>		<th id=\"tablefont\">Hero</th>		<th id=\"tablefont\">Savecode</th>		<th id=\"tablefont\">Savedate</th>		<th id=\"tablefont\">Level</th>		<th id=\"tablefont\">Accountname</th>		<th id=\"tablefont\">Slayerpoints</th>		<th id=\"tablefont\">Masterpoints</th>		<th id=\"tablefont\">Item 1</th>		<th id=\"tablefont\">Item 2</th>		<th id=\"tablefont\">Item 3</th>		<th id=\"tablefont\">Item 4</th>		<th id=\"tablefont\">Item 5</th>		<th id=\"tablefont\">Item 6</th>		<th id=\"tablefont\">Comment</th>		</tr>\n";	while ($row = mysql_fetch_array($result)) {	echo "<tr>			<td id=\"tablefont\">$row[Gamename]</td>			<td id=\"tablefont\">$row[Hero]</td>			<td id=\"tablefont\">$row[Savecode]</td>			<td id=\"tablefont\">$row[Savedate]</td>			<td id=\"tablefont\">$row[Level]</td>			<td id=\"tablefont\">$row[Accountname]</td>			<td id=\"tablefont\">$row[Slayerpoints]</td>			<td id=\"tablefont\">$row[Masterpoints]</td>			<td id=\"tablefont\">$row[item1]</td>			<td id=\"tablefont\">$row[item2]</td>			<td id=\"tablefont\">$row[item3]</td>			<td id=\"tablefont\">$row[item4]</td>			<td id=\"tablefont\">$row[item5]</td>			<td id=\"tablefont\">$row[item6]</td>			<td id=\"tablefont\">$row[comment]</td>		</tr>\n";}echo "</table>\n</h2>";} else {echo "<h2>You haven't logged in or you haven't come from right page</h2>";	}?><html><head><link href="style/beta.css" rel="stylesheet" type="text/css"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="description" content="Confirm logging"><meta name="keywords" content="Confirm, Login, Mudsaf.comule.com, Mudsaf.info"></head><body><footer>Copyright © 2011 Mudsaf.info. All rights reserved.</footer></body></html>

Link to comment
Share on other sites

previous row will not be changed in that column...did you try entering new rows after altering the column?

Link to comment
Share on other sites

All the php code producing html table etc must be placed in the <body>..</body> above the footer fromif ($_SESSION['check']=true) { ... to echo "<h2>You haven't logged in or you haven't come from right page</h2>";}
Actually this didint help me anything :(. Code is like this and still doesn't work.
<html><head><link href="style/beta.css" rel="stylesheet" type="text/css"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="description" content="Confirm logging"><meta name="keywords" content="Confirm, Login, Mudsaf.comule.com, Mudsaf.info"></head><body><?phpsession_start();include 'connect.php';if ($_SESSION['check']=true) {echo "<a href=\"login_confirm.php\">Return to main</a>";echo " | ";echo "<a href=\"logout.php\">Logout</a>";echo "<br>";$id = $_SESSION['AccID'];$query = "SELECT * FROM war3savecode WHERE AccountID = $id";$querygoh = "SELECT * FROM war3savecode WHERE AccountID = $id AND Gamename = 'Guilds of Hyppos' AND visible = 'Yes'";$result = mysql_query($query)    or die("Error on result :" . mysql_error());    echo "<h2>Guilds of Hyppos RPG<table border=\"1\">        <tr>        <th id=\"tablefont\">Gamename</th>        <th id=\"tablefont\">Hero</th>        <th id=\"tablefont\">Savecode</th>        <th id=\"tablefont\">Savedate</th>        <th id=\"tablefont\">Level</th>        <th id=\"tablefont\">Accountname</th>        <th id=\"tablefont\">Slayerpoints</th>        <th id=\"tablefont\">Masterpoints</th>        <th id=\"tablefont\">Item 1</th>        <th id=\"tablefont\">Item 2</th>        <th id=\"tablefont\">Item 3</th>        <th id=\"tablefont\">Item 4</th>        <th id=\"tablefont\">Item 5</th>        <th id=\"tablefont\">Item 6</th>        <th id=\"tablefont\">Comment</th>        </tr>\n";    while ($row = mysql_fetch_array($result)) {    echo "<tr>            <td id=\"tablefont\">$row[Gamename]</td>            <td id=\"tablefont\">$row[Hero]</td>            <td id=\"tablefont\">$row[Savecode]</td>            <td id=\"tablefont\">$row[Savedate]</td>            <td id=\"tablefont\">$row[Level]</td>            <td id=\"tablefont\">$row[Accountname]</td>            <td id=\"tablefont\">$row[Slayerpoints]</td>            <td id=\"tablefont\">$row[Masterpoints]</td>            <td id=\"tablefont\">$row[item1]</td>            <td id=\"tablefont\">$row[item2]</td>            <td id=\"tablefont\">$row[item3]</td>            <td id=\"tablefont\">$row[item4]</td>            <td id=\"tablefont\">$row[item5]</td>            <td id=\"tablefont\">$row[item6]</td>            <td id=\"tablefont\">$row[comment]</td>        </tr>\n";}echo "</table>\n</h2>";} else {echo "<h2>You haven't logged in or you haven't come from right page</h2>";    }?><footer>Copyright © 2011 Mudsaf.info. All rights reserved.</footer></body></html>

Link to comment
Share on other sites

When i watched page source code the part from-load g&

#2

w-32?(f-bb>>&-p9yI@-)bSlj-wVyIW-(is orange. Does it have any effect or? I readed this from Unicode and HTML Wiki A character reference takes the form N;, where N is either a decimal number for the Unicode code point, or a hexadecimal number, in which case it must be prefixed by x. (I Have the )

Numeric character references Main article: Numeric character referenceIn order to work around the limitations of legacy encodings, HTML is designed such that it is possible to represent characters from the whole of Unicode inside an HTML document by using a numeric character reference: a sequence of characters that explicitly spell out the Unicode code point of the character being represented. A character reference takes the form N;, where N is either a decimal number for the Unicode code point, or a hexadecimal number, in which case it must be prefixed by x. The characters that compose the numeric character reference are universally representable in every encoding approved for use on the Internet.For example, a Unicode code point like U+5408, which corresponds to a particular Chinese character, has to be converted to a decimal number, preceded by and followed by ;, like this: 合, which produces this: 合 (if it doesn't look like a Chinese character, see Template:Special characters).The support for hexadecimal in this context is more recent, so older browsers might have problems displaying characters referenced with hexadecimal numbers—but they will probably have a problem displaying Unicode characters above code point 255 anyway. To ensure better compatibility with older browsers, it is still a common practice to convert the hexadecimal code point into a decimal value (for example 合 instead of 合).
Aftere bit figuring out i noticed when i add text to HTML the same #& and it does it like this
<p>#&</p><p>&#</p>

Link to comment
Share on other sites

previous row will not be changed in that column...did you try entering new rows after altering the column?
What do you mean, could you fix my code or explain me noob-friendly how-to do it :).
what he is saying is that all the data currently in the database will not be automatically changed when you change the collation. You need to enter new data into the table and then test that.
Link to comment
Share on other sites

Well kind a strange because added few rows. This works -load #& --35 -362¤%¤/%¤/"!#%¤¤()& But then this doesnt -load gw-32?(f-bb>>&-p9yI@-)bSlj-wVyIW-(

Link to comment
Share on other sites

I believe there's some kind of misunderstanding in this thread. Do you want to be parsed as an entity or as those characters? You can pass any string through the htmlspecialchars() function to make sure they're not parsed as entities:

$text = "";$text = htmlspecialchars($text);

Link to comment
Share on other sites

Thankyou Ingolme, you fixed my problem. Code that is working is like this if any1 face this problem. Thanks for all others too for trying to help me i appreciate it!

<html><head><link href="style/beta.css" rel="stylesheet" type="text/css"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="description" content="Confirm logging"><meta name="keywords" content="Confirm, Login, Mudsaf.comule.com, Mudsaf.info"></head><body><?phpsession_start();include 'connect.php';if ($_SESSION['check']=true) {echo "<a href=\"login_confirm.php\">Return to main</a>";echo " | ";echo "<a href=\"logout.php\">Logout</a>";echo " | ";echo "<a href=\"newcode.php\">Insert new code</a>";echo "<br>";$id = $_SESSION['AccID'];$query = "SELECT * FROM war3savecode WHERE AccountID = $id";$querygoh = "SELECT * FROM war3savecode WHERE AccountID = $id AND Gamename = 'Guilds of Hyppos' AND visible = 'Yes'";$result = mysql_query($query)or die("Error on result :" . mysql_error()); echo "<h2>Guilds of Hyppos RPG<table border=\"1\">  <tr>  <th id=\"tablefont\">Gamename</th>  <th id=\"tablefont\">Hero</th>  <th id=\"tablefont\">Savecode</th>  <th id=\"tablefont\">Savedate</th>  <th id=\"tablefont\">Level</th>  <th id=\"tablefont\">Accountname</th>  <th id=\"tablefont\">Slayerpoints</th>  <th id=\"tablefont\">Masterpoints</th>  <th id=\"tablefont\">Item 1</th>  <th id=\"tablefont\">Item 2</th>  <th id=\"tablefont\">Item 3</th>  <th id=\"tablefont\">Item 4</th>  <th id=\"tablefont\">Item 5</th>  <th id=\"tablefont\">Item 6</th>  <th id=\"tablefont\">Comment</th>  </tr>\n";while ($row = mysql_fetch_array($result)) {$text = $row[Savecode];$text = htmlspecialchars($text);echo "<tr>    <td id=\"tablefont\">$row[Gamename]</td>   <td id=\"tablefont\">$row[Hero]</td>   <td id=\"tablefont\">$text</td>   <td id=\"tablefont\">$row[Savedate]</td>   <td id=\"tablefont\">$row[Level]</td>   <td id=\"tablefont\">$row[Accountname]</td>   <td id=\"tablefont\">$row[Slayerpoints]</td>   <td id=\"tablefont\">$row[Masterpoints]</td>   <td id=\"tablefont\">$row[item1]</td>   <td id=\"tablefont\">$row[item2]</td>   <td id=\"tablefont\">$row[item3]</td>   <td id=\"tablefont\">$row[item4]</td>   <td id=\"tablefont\">$row[item5]</td>   <td id=\"tablefont\">$row[item6]</td>   <td id=\"tablefont\">$row[comment]</td>  </tr>\n";}echo "</table>\n</h2>";} else {echo "<h2>You haven't logged in or you haven't come from right page</h2>";}?><footer>Copyright © 2011 Mudsaf.info. All rights reserved.</footer></body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...