Rama Lingam Rama Lingam - 1 year ago 75
SQL Question

Cannot get values insight <<Some_text_here>> or <some_text_here> from MSQL using PHP

I cannot get the values insight single<......> or double<<....>> symbol from mysql.

It's always return <> or <<>>.

Mysql Data:
enter image description here

Sample Code :

$sql = "SELECT id,html_form_data FROM `user_detail`";
$result = mysqli_query($con, $sql);
while($row = mysqli_fetch_assoc($result))
$getFormData[] = $row;

Getting Result:

Array ( [0] => Array ( [id] => 1 [html_form_data] => ) 1 => Array ( [id] => 2 [html_form_data] => <> ) )

Note : I am geting the values after interchanged the <.....> into $.....$

But I know that any reason for return it? or any ways to getting values?

Answer Source

As I earlier mentioned in the comments try printing your $getFormData like this:

array_map("printHTML", $getFormData);

function printHTML($a) {
  echo htmlentities($a)."<br/>";

Note: This is for your testing. This handles only one dimensional array for now.

This handles multidimensional array:

function printHTML($a) {
    echo htmlentities($a)."<br/>";
    array_map("printHTML", $a);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download