0

I am facing problem to select data from database in mysql.

my table name is:
record enter image description here

my query is:

$query = mysql_query(Select `salt` from record where `id` = '1012');
$row = mysql_fetch_array($query);
echo $row['salt'];

my output

sJ@>L0CeKotpH;kokFo1Z9BwE/ey8(i?nbpQ3ICY;]PRaD7TJE)I3@RYWZTSV]YkO2cduj6eeE0IFGuYE

So please suggest me how to get salt column value from the table.

Vishnu Pratap
  • 65
  • 1
  • 9

3 Answers3

0

The problem should be caused by echo $row['salt'];

Your column salt has a < in its value, so when echo it, the string after < will be discarded, you can try to run this:

<?php
echo 'sJ@>L0CeKotpH;kokFo1Z9BwE/ey8(i?nbpQ3ICY;]PRaD7TJE)I3@RYWZTSV]YkO2cduj6eeE0IFGuYE<R1GZ+OM2`Oto<W\`U:'
?>

Then you will find the result is

sJ@>L0CeKotpH;kokFo1Z9BwE/ey8(i?nbpQ3ICY;]PRaD7TJE)I3@RYWZTSV]YkO2cduj6eeE0IFGuYE

Edited:

echo htmlspecialchars('sJ@>L0CeKotpH;kokFo1Z9BwE/ey8(i?nbpQ3ICY;]PRaD7TJE)I3@RYWZTSV]YkO2cduj6eeE0IFGuYE<R1GZ+OM2`Oto<W\`U:')
Blank
  • 12,308
  • 1
  • 14
  • 32
0

Replace with bellow line then it will display as you want. But in other operations it will be same as it is.

echo str_replace("<","&lt;",$row['salt']);
0
echo htmlentities($row['salt']);

That should do it.