Error when output "introtext" from mysql? [Solved]

Codes here !

Moderators: egami, macek, gesf

Post Reply

Wed Jun 27, 2012 3:07 pm

Hello! I can't figure out how to input an HTML content into a module...
This one does't work (but the query works on phpmyadmin)

Code: Select all

<? php
$SQL = 'SELECT introtext FROM 'jmo_content' WHERE Id=127';
$result = $mysql_query($sql) ;
$row = mysql_fetch_assoc($result);
Output = error!
Any advice?

Thanks a lot!

The graal: a code to display any content from joomla database into php module jumi

`<?php $db =& JFactory::getDBO();
$query = "SELECT introtext FROM #__content WHERE Id=127";
$text= $db->loadResult(); ?>`

`<?php echo $text; ?>`
Last edited by Zemerak on Thu Jun 28, 2012 7:32 am, edited 1 time in total.

php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Wed Jun 27, 2012 11:51 pm

Post the full error message. also, you are saving the query as $SQL and then using it as $sql.


Thu Jun 28, 2012 1:25 am

Hi John!
Thanks so much for your reply!

Code: Select all

also, you are saving the query as $SQL and then using it as $sql.
Well no! I do not want to save or change anything in the db I just want to display a single things (I want to output an HTML content "introtext" inside a joomla modul that support php). Well I was going on the wrong side, I m completely lost....
Parse error: syntax error, unexpected T_VARIABLE in /homez.420/kmxsiksf/ : eval()'d code on line 4
Thanks a lot for your reply!

Post Reply