0

私はプラグイン開発の物語を続けています..それで、以前のコードで犯したすべての間違いを修正しました-> joomlaメソッドの使用により、プラグインでのファイルの動作が停止します

そして今、私はすべてうまくいったと思っていましたが、dbクエリは機能しません。ここで何が問題なのかわかりません。dbクエリは私には良さそうです

<?php
// Set flag that this is a parent file
define('_JEXEC', 1);

// No direct access.
defined('_JEXEC') or die;

define( 'DS', DIRECTORY_SEPARATOR );

define('JPATH_BASE', dirname(__FILE__).DS.'..'.DS.'..'.DS.'..'.DS.'..' );

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
jimport( 'joomla.database.database' );


$db = JFactory::getDbo();

if(JRequest::getInt('id'))
{

$id = JRequest::getInt('id');
$name = JRequest::getVar('name');

$query = "update #__messages set $name=$name+1 where id='$id'";
$db->setQuery( $query );
$db->query( $query ) or die('blogai');


?>
<div style="margin-bottom:10px">
<b>Ratings for this blog</b> ( <?php echo $total; ?> total)
</div>
<table width="700px">

<tr>
<td width="30px"></td>
<td width="60px"><?php echo $up_value; ?></td>
<td width="600px"><div id="greebar" style="width:<?php echo $up_per; ?>%"></div></td>
</tr>

<tr>
<td width="30px"></td>
<td width="60px"><?php echo $down_value; ?></td>
<td width="600px"><div id="redbar" style="width:<?php echo $down_per; ?>%"></div></td>
</tr>

</table>

<?php

}
4

1 に答える 1

0

これを試してみてください..それは私のために働いています

define( '_JEXEC', 1 );
chdir("../../");
getcwd();
define('JPATH_BASE', getcwd() );

define( 'DS', DIRECTORY_SEPARATOR );

require_once (JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

global $mainframe;

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();

$db         =  JFactory::getDBO();
于 2012-09-18T03:54:31.837 に答える