Php code does not come out from MySQL Database properly

98 views Asked by At

I was try to loop PHP CODE data from MYSQL database, but it looks different when it's echo'd out.

HERE IS MY PHP CODE:

<?php

mysql_connect("localhost","root","");
mysql_select_db("myweb");


?>

<table width="100%" border="1">
<?php
$query=mysql_query("SELECT * FROM right_widgets ORDER BY right_widgets_id ASC");
while($rows2=mysql_fetch_assoc($query))
{ 
    $right_widgets_id=$rows2['right_widgets_id'];
    $func_name=$rows2['func_name'];
    $active_status=$rows2['active_status'];

?>
  <tr>
    <td><?php echo $func_name; ?></td>
    </tr>
<?php
}
?>
  </table>

HERE IS MY SQL CODE:

--
-- Database: `myweb`
--

-- --------------------------------------------------------

--
-- Table structure for table `right_widgets`
--

CREATE TABLE IF NOT EXISTS `right_widgets` (
  `right_widgets_id` int(11) NOT NULL,
  `func_name` text NOT NULL,
  `active_status` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `right_widgets`
--

INSERT INTO `right_widgets` (`right_widgets_id`, `func_name`, `active_status`) VALUES
(1, '<?php get_search_engine(); ?>', 'true'),
(2, '<?php get_clock(); ?>', 'true'),
(3, '<?php get_virtual_nav_menu(); ?>', 'false'),
(4, '<?php get_non(); ?>', 'false');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `right_widgets`
--
ALTER TABLE `right_widgets`
  ADD PRIMARY KEY (`right_widgets_id`);

--
-- AUTO_INCREMENT for dumped tables
--

Problem is when it run it looks like this:

enter image description here

But I need this:

<?php get_search_engine(); ?>
1

There are 1 answers

0
Softbazz On BEST ANSWER

Please modify your table value ok, your code in sql

INSERT INTO `right_widgets` (`right_widgets_id`, `func_name`, `active_status`) VALUES
(1, '<?php get_search_engine(); ?>', 'true'),
(2, '<?php get_clock(); ?>', 'true'),
(3, '<?php get_virtual_nav_menu(); ?>', 'false'),
(4, '<?php get_non(); ?>', 'false');

That's mean you table cols name is func_name and value is <?php get_search_engine(); ?> ok, Please modify the value like this get_search_engine(); remove all of <?php ?> this I hope that will work. Thank you.