MyBB Community Forums

Full Version: Help me i am newbie. How to solve it?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
When i used this to show latest threadsquery("SELECT  FROM ".TABLE_PREFIX."threads ORDER BY tid DESC LIMIT $tlimit");$list='';while( $fetch=$db->fetch_array($query)){$list.=" | ".htmlspecialchars_uni($fetch['subject'])."";/*$poster = "{$fetch['username']}";$list .= "Created by: {$poster}  ";$list .= "" .$fetch['replies']. "  Replies";$list .= " , " .$fetch['views']. "  Views  ";$list .= " (Last post by: " .$fetch['lastposter']. ")";*/}//outputecho "";echo$list;echo"

 ";?>i used this code it show meMyBB SQL ErrorMyBB has experienced an internal SQL error and cannot continue.SQL Error:1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM mybb_threads ORDER BY tid DESC LIMIT 15' at line 1QueryConfusedELECT FROM mybb_threads ORDER BY tid DESC LIMIT 15Please contact the MyBB Groupfor support.My link/ltr.php pls help me.Pls help me. My site adilop.com
this
$query=$db->query("SELECT FROM ".TABLE_PREFIX."threads ORDER BY `tid` DESC LIMIT $tlimit");
replace
$query=$db->query("SELECT * FROM ".TABLE_PREFIX."threads ORDER BY `tid` DESC LIMIT $tlimit");
But better define what u want to select from this table. Like
 SELECT lastposter, views, replies FROM 
Now why itz blank.

Now itz showing this
 SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT15' at line 1
Query:
SELECT lastposter, views, replies FROM mybb_ threads ORDER BY `tid` DESC LIMIT15
Please contact the MyBB Groupfor support.
Pls help me pls see it www.adilop.com/ltr.php pls help me
Use space after LIMIT and before $limit
<?php define("IN_MYBB",1)
require'/global.php';
// Change this if needed

$tlimit=5;

// How many titles you want
$query=$db->query("SELECT lastposter, views, replies FROM ".TABLE_PREFIX." threads ORDER BY tid DESC LIMIT$tlimit ");

$list='';while( $fetch=$db->fetch_array($query))
{$list.=" | <strong><a href=\"showthread.php?tid={$fetch['tid']}\" target=\"_blank\">".htmlspecialchars_uni($fetch['subject'])."</a></strong>";
/*
$poster = "<a href=\"member.php?action=profile&uid=".$fetch['uid']."\">{$fetch['username']}</a>";
$list .= "Created by: {$poster} ";
$list .= "<i>" .$fetch['replies']. " Replies</i>";
$list .= "<i> , " .$fetch['views']. " Views</i> ";
$list .= " (<i>Last post by: " .$fetch['lastposter']. "</i>)<br /><hr width=\"50\"><br />";*/
}
//output
echo "<marquee direction='right' scrollamount='3'>";
echo$list;
echo"</marquee></p> ";
?>
Parse error: syntax error, unexpected T_REQUIRE in /home/u87645....../public_html/ltr.php on line 2
basically the mistake is in the SQL Query. what exactly is selected ? it is missing the fields to fetch

SELECT * FROM
Its show me error in line 2. But how?
<?php
define("IN_MYBB",1);
require_once("global.php");  
$tlimit = 5;   
....  ..... ......
... ... ... ... ...
I used this
 <?php define("IN_MYBB",1);
REQUIRE_ONCE('global.php'); 
 // Change this if needed

$tlimit= '15' ;

// How many titles you want
$query=$db->query("SELECT * FROM ".TABLE_PREFIX." threads ORDER BY `tid` DESC LIMIT$tlimit ");

$list='';while( $fetch=$db->fetch_array($query))
{$list.=" | <strong><a hretf=\"showthread.php?tid={$fetch['tid']}\" target=\"_blank\">".htmlspecialchars_uni($fetch['subject'])."</a></strong>";
/*
$poster = "<a  href=\"member.php?action=profile&uid=".$fetch['uid']."\">{$fetch['username']}</a>";
$list .= "Created by: {$poster}  ";
$list .= "<i>" .$fetch['replies']. "  Replies</i>";
$list .= "<i> , " .$fetch['views']. "  Views</i>  ";
$list .= " (<i>Last post by: " .$fetch['lastposter']. "</i>)<br /><hr width=\"50\"><br />";*/
}
//output
echo "<marquee direction='right' scrollamount='3'>";
echo$list;
echo"</marquee></p> ";
?>
and show me
 SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT15' at line 1
Query:
SELECT * FROM mybb_ threads ORDER BY `tid` DESC LIMIT15
do me a favour. Pls
<?php
define("IN_MYBB",1);
require_once('global.php');  // Change this if needed

$tlimit =  '15' ;  // How many titles you want
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads ORDER BY `tid` DESC LIMIT $tlimit ");

$list = '';
while( $fetch=$db->fetch_array($query))
{$list .=" | <strong><a href=\"showthread.php?tid={$fetch['tid']}\" target=\"_blank\">".htmlspecialchars_uni($fetch['subject'])."</a></strong>";
/*
$poster = "<a  href=\"member.php?action=profile&uid=".$fetch['uid']."\">{$fetch['username']}</a>";
$list .= "Created by: {$poster}  ";
$list .= "<i>" .$fetch['replies']. "  Replies</i>";
$list .= "<i> , " .$fetch['views']. "  Views</i>  ";
$list .= " (<i>Last post by: " .$fetch['lastposter']. "</i>)<br /><hr width=\"50\"><br />";*/
}
//output
echo  "<marquee direction='right' scrollamount='3'>";
echo $list;
echo "</marquee></p> ";
?>
Pages: 1 2