TinyPortal

Development => Support => Topic started by: jozeta on January 19, 2008, 09:14:25 AM

Title: error message
Post by: jozeta on January 19, 2008, 09:14:25 AM
hi
i got this strange error message in the logs. does anyone know what this is?


Använder filter: Felmeddelande '2: Missing argument 3 for db_query(), called in /customers/bulleforum.se/bulleforum.se/httpd.www/smf/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 7 and defined
Fil: /customers/bulleforum.se/bulleforum.se/httpd.www/smf/Sources/Subs.php
Rad: 238'

i have the following mods installed:

1. TinyPortal 0.983
2. FlashChat Integration 1.0
3. Custom Profile Field Mod 3.17
4. SMF Links 1.6.5
Title: Re: error message
Post by: Dragooon on January 19, 2008, 09:22:33 AM
This doesn't looks like a TP problem but anyway, can you post code from line 228-248 in Subs.php?
Title: Re: error message
Post by: jozeta on January 19, 2008, 12:57:37 PM
here is line 237-263. everything before line 237 is comments

// Do a query.  Takes care of errors too.
function db_query($db_string, $file, $line)
{
global $db_cache, $db_count, $db_connection, $db_show_debug, $modSettings;

// One more query....
$db_count = !isset($db_count) ? 1 : $db_count + 1;

// Debugging.
if (isset($db_show_debug) && $db_show_debug === true)
{
// Initialize $db_cache if not already initialized.
if (!isset($db_cache))
$db_cache = array();

if (!empty($_SESSION['debug_redirect']))
{
$db_cache = array_merge($_SESSION['debug_redirect'], $db_cache);
$db_count = count($db_cache) + 1;
$_SESSION['debug_redirect'] = array();
}

$db_cache[$db_count]['q'] = $db_string;
$db_cache[$db_count]['f'] = $file;
$db_cache[$db_count]['l'] = $line;
$st = microtime();
}
Title: Re: error message
Post by: G6Cad on January 19, 2008, 02:29:19 PM
What theme are you using ?
Make sure all the template code from your mod is applied correctly.
Especially the custom profile mod
Title: Re: error message
Post by: Dragooon on January 19, 2008, 02:58:13 PM
I am having a feeling it is a block, do you got any custom block which uses db_query?
Title: Re: error message
Post by: jozeta on January 20, 2008, 12:02:42 PM
yes i have two custom php blocks, that i made my self.
------------
first code displays the latest updated wordpress mu blog:
global $db_prefix, $scripturl;


$query = db_query(
    "SELECT *
     FROM wp_blogs
     ORDER BY last_updated DESC LIMIT 4");

while ($row = mysql_fetch_array( $query ))
     {
     // skriver ut innehÃ¥llet radvis
echo "<a href='http://www.bulleforum.se";
echo $row['path']."' target='blank'>";     

$title = $row['path'];
$title = substr($title, 6);
$title = str_replace("/", "", $title);
echo $title;
echo "</a> <i>";
$day = $row['last_updated'];
$day = substr($day, 8, 2);
echo $day;

echo "/";

$mon = $row['last_updated'];
$mon = substr($mon, 5, 2);
echo $mon;

echo " ";

$time = $row['last_updated'];
$time = substr($time, 11, 5);
echo $time;

echo "</i><br> ";
          }


second code displays a random link from the db:

global $db_prefix, $scripturl;


$query = db_query(
    "SELECT *
     FROM smf_links
     ORDER BY RAND() LIMIT 5");

while ($row = mysql_fetch_array( $query ))
     {
     // skriver ut innehÃ¥llet radvis
echo "<a href='";
echo $row['url']."' target='blank'>";     
echo $row['title']."</a><br>";
          }


Title: Re: error message
Post by: Dragooon on January 20, 2008, 12:24:48 PM
That explains it, in the first block replace the query with
$query = db_query(
    "SELECT *
     FROM wp_blogs
     ORDER BY last_updated DESC LIMIT 4",__FILE__,__LINE__);

And replace the query in second block with
$query = db_query(
    "SELECT *
     FROM smf_links
     ORDER BY RAND() LIMIT 5",__FILE__,__LINE__);

Title: Re: error message
Post by: jozeta on January 20, 2008, 11:30:43 PM
Maybe a stupid question.

but what does the extra: "__FILE__,__LINE__);" do?
Title: Re: error message
Post by: jozeta on January 21, 2008, 12:52:55 AM
that seems to clear up alot of the errors. now i only get this error msg:



store   idag kl. 01:07:28 
xx.xxx.xx.xxx     d5d5785fd5c7619f4e2aee4a5c0558d0 
http://www.bulleforum.se/smf/index.php?action=search2 
8: Undefined index: brd
Fil: /customers/bulleforum.se/bulleforum.se/httpd.www/smf/Sources/Search.php
Rad: 407

Title: Re: error message
Post by: IchBin on January 21, 2008, 01:39:32 AM
__FILE__ outputs what file PHP is in, __LINE__ outputs what line its on.

Undefined index: brd is probably something to do with another mod you've installed.
Title: Re: error message
Post by: tick on January 21, 2008, 02:01:21 AM
Find that line 407 in your search.php   it should read this  if (!is_array($_REQUEST['brd']) && !empty($_REQUEST['brd']))   and replace it with this.  if (!empty($_REQUEST['brd']) && !is_array($_REQUEST['brd']))


It is a bug in the search with smf. 
Title: Re: error message
Post by: jozeta on January 21, 2008, 10:37:55 AM
thanks a bunch. no error msg any more.