TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,965
  • Latest: boruko
Stats
  • Total Posts: 195,982
  • Total Topics: 21,320
  • Online today: 247
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 118
  • Total: 118

Wrong value type sent to the database. Integer expected. (week)

Started by moto~man, January 02, 2012, 08:37:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

moto~man

I found a few threads about this but not this exactly.


Link to my site: othg-gamers
SMF version: SMF ver. SMF 2.0
TP version: TP ver. TinyPortal © 2005-2011
Default Forum Language: en_US
Theme name and version: DarkBreak by DzinerStudio
Browser Name and Version: all
Mods installed: Contact Page/SMF Links/Aeva Media/SMF Staff Page/Treasury/
Related Error messages:

Apply Filter: Only show the error messages of this URL
http://www.othg-gamers.com/forum/index.php?action=tpmod;dl
Apply Filter: Only show the errors with the same message
Wrong value type sent to the database. Integer expected. (week)
Function: TPortalDLManager
Apply Filter: Only show the errors from this file
File: /home2/othggame/public_html/othggamers/forum/Sources/TPdlmanager.php
Line: 610


ratbat

I have the same problem ...

Type of error: Critical

Apply Filter: Only show the error messages of this URL
http://forum.xxxxxx.de/index.php?action=tpmod;dl
Apply Filter: Only show the errors with the same message
Wrong value type sent to the database. Integer expected. (week)
Function: TPortalDLManager
Apply Filter: Only show the errors from this file
Datei: /var/www/vhosts/xxxxxxxxxxx/subdomains/forum/httpdocs/Sources/TPdlmanager.php
Zeile: 610


Apply Filter: Only show the error messages of this URL
http://forum.xxxxxx.de/index.php?action=tpmod;dl
Apply Filter: Only show the errors with the same message
Wrong value type sent to the database. Integer expected. (week)
Function: TPortalDLManager
Apply Filter: Only show the errors from this file
Datei: /var/www/vhosts/xxxxxxxxxxx/subdomains/forum/httpdocs/Sources/TPdlmanager.php
Zeile: 824


and ...

Apply Filter: Only show the error messages of this URL
http://forum.xxxxxx.de/index.php?action=tpmod;dl
Apply Filter: Only show the errors with the same message
Wrong value type sent to the database. Integer expected. (week)
Function: TPortalDLManager
Apply Filter: Only show the errors from this file
Datei: /var/www/vhosts/xxxxxxxxxxx/subdomains/forum/httpdocs/Sources/TPdlmanager.php
Zeile: 1387 


It seems that it has someting to do with this passage:

$request = $smcFunc['db_query']('', '
SELECT dlm.id, dlm.name, dlm.category, dlm.file, data.downloads, dlm.views, dlm.author_id as authorID, dlm.created, dlm.screenshot, dlm.filesize,
dlcat.name AS catname, mem.real_name as realName
FROM ({db_prefix}tp_dlmanager AS dlm, {db_prefix}tp_dldata AS data, {db_prefix}members AS mem)
LEFT JOIN {db_prefix}tp_dlmanager AS dlcat ON dlcat.id=dlm.category
WHERE dlm.type = {string:type}
AND (dlm.category = {int:cat} OR dlm.parent = {int:cat})
AND data.item = dlm.id
AND data.year = {int:year}
AND data.week = {int:week}
AND dlm.author_id = mem.id_member
ORDER BY data.downloads DESC LIMIT 10',
array('type' => 'dlitem', 'cat' => $currentcat, 'year' => $year, 'week' => $week)
);


I found in the database a column called 'week' in the table smf_tp_dldata. Is this the right one? The type of this column is tinyint(4). Should it be changed to integer?

IchBin

Nope int and integer work the same as far as the way SMF handles the queries. Do a var_dump($week) right before that query and see what the output is. Post it here if you would. Right now I'm working on my server and my sites aren't up or I'd test some things for you.

imcanadian

Same problem on my site when attempting to visit download manager.

Same problem on THIS site. See http://www.tinyportal.net/index.php?action=tpmod;dl

IchBin

Hmm... I wonder if this has something to do with the year change.... I don't know what, but that's the only thing I can think of right now since the DL manager was working before. Any of you able to do the var_dump()?

Temporary fix for this could be to find this:

$week = date("W",$now);
$year = date("Y",$now);


Replace with this:

$week = (int) date("W",$now);
$year = (int) date("Y",$now);

ratbat

@IchBin
sorry, I don't know how to use the var_dump function

// DEBUG !!!
var_dump($week)
$request = $smcFunc['db_query']('', '
SELECT dlm.id, dlm.name, dlm.category, dlm.file, data.downloads, dlm.views, dlm.author_id as authorID, dlm.created, dlm.screenshot, dlm.filesize,
dlcat.name AS catname, mem.real_name as realName
FROM ({db_prefix}tp_dlmanager AS dlm, {db_prefix}tp_dldata AS data, {db_prefix}members AS mem)
LEFT JOIN {db_prefix}tp_dlmanager AS dlcat ON dlcat.id=dlm.category
WHERE dlm.type = {string:type}
AND (dlm.category = {int:cat} OR dlm.parent = {int:cat})
AND data.item = dlm.id
AND data.year = {int:year}
AND data.week = {int:week}
AND dlm.author_id = mem.id_member
ORDER BY data.downloads DESC LIMIT 10',
array('type' => 'dlitem', 'cat' => $currentcat, 'year' => $year, 'week' => $week)
);


Here's the output:

Parse error: syntax error, unexpected T_VARIABLE in /var/www/vhosts/xxxxxxxxxxx.de/subdomains/forum/httpdocs/Sources/TPdlmanager.php on line 598

:-[

feline

That must be

// DEBUG !!!
var_dump($week);

Note the ; at the end ...

PortaMx released the Portax-Forum Version 1.2 with revolutionary features, which has no other Forum.

IchBin

ratbat, I've already posted a fix above for this if you want to apply it to your site.

ratbat

@Feline
How embarrassing!  :-[ Thank you.

Here's the result:

QuoteEin Fehler ist aufgetreten!
Wrong value type sent to the database. Integer expected. (week)
Zurück

Next I'll try the workaround.



F0L

Quote from: IchBinâ,,¢ on January 03, 2012, 05:21:26 AM
Hmm... I wonder if this has something to do with the year change.... I don't know what, but that's the only thing I can think of right now since the DL manager was working before. Any of you able to do the var_dump()?

Temporary fix for this could be to find this:

$week = date("W",$now);
$year = date("Y",$now);


Replace with this:

$week = (int) date("W",$now);
$year = (int) date("Y",$now);


Thankyou, this fixed the issue 100%.

There are about 4 or 5 instances, you need to change.
Once done Downloads were all working, no more week error, :).

This website is proudly hosted on Crocweb Cloud Website Hosting.