News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

im stumped sub actions

Started by SA™, May 31, 2008, 12:26:40 AM

Previous topic - Next topic

Dragooon

It doesn't shows anything because you didn't made it to return anything
Try
function clickcounts() {
   
   db_query("UPDATE {$db_prefix}clickcounts     
   SET value = value + 1     
   WHERE name = ' Conquer Antarctica Multiplayer'     
   LIMIT 1", __FILE__, __LINE__);
$request = db_query("SELECT value
FROM {$db_prefix}clickcounts
WHERE name = ' Conquer Antartica Multiplayer'",__FILE__,__LINE__);
list($views) = mysql_fetch_row($request);
mysql_free_result($request);
return $views;
   }

Do the table corrections you made.

SA™

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 'WHERE name = ' Conquer Antartica Multiplayer'' at line 2
File: C:\xampp\htdocs\test\Sources\multiplayer.php
Line: 111
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Dragooon

Actually, I just realized that db_prefix wasn't in globals.
Try
function clickcounts() {
   global $db_prefix;
   db_query("UPDATE {$db_prefix}clickcounts     
   SET value = value + 1     
   WHERE name = ' Conquer Antarctica Multiplayer'     
   LIMIT 1", __FILE__, __LINE__);
$request = db_query("SELECT value
FROM {$db_prefix}clickcounts
WHERE name = ' Conquer Antartica Multiplayer'",__FILE__,__LINE__);
list($views) = mysql_fetch_row($request);
mysql_free_result($request);
return $views;
   }

SA™

http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Nathaniel

Is the name ' Conquer Antarctica Multiplayer' meant to have a space at the beginning, maybe it should be 'Conquer Antarctica Multiplayer'. This could be the problem. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

SA™

nope still not displaying any numbers
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Dragooon

Hm, open up the table with phpMyAdmin, do you see any rows?

SA™

hmmm the table is there i cant brouse it tho as the brouse button isnt clicking
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Nathaniel

That means that there isn't anything in there, try adding a row with the name 'Conquer Antarctica Multiplayer'. There should be an insert tab.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

SA™

hmm help lol im in the insert bit this is what im seeing

Field Type Function Null Value

where i start
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Dragooon

OK Try this function, and make sure to enter the correct value in the $gameName clause.

function clickcounts($gameName) {
global $db_prefix;

$request = db_query("SELECT value
FROM {$db_prefix}clickcounts
WHERE name = '$gameName'",__FILE__,__LINE__);
list($views) = mysql_fetch_row($request);
if(mysql_num_rows($request) == 0)
{
db_query("
INSERT INTO {$db_prefix}clickcounts
(name, value)
VALUES
($gameName, 0)",__FILE__,__LINE__);
$views = 0;
}

mysql_free_result($request);
db_query("UPDATE {$db_prefix}clickcounts     
SET value = value + 1     
WHERE name = '$gameName'     
LIMIT 1", __FILE__, __LINE__);
$views = $views + 1;
return $views;
}

SA™

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 ' 0)' at line 4
File: C:\xampp\htdocs\test\Sources\multiplayer.php
Line: 116
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Dragooon

Try
function clickcounts($gameName) {
   global $db_prefix;
   
   $request = db_query("SELECT value
   FROM {$db_prefix}clickcounts
   WHERE name = '$gameName'",__FILE__,__LINE__);
   list($views) = mysql_fetch_row($request);
   if(mysql_num_rows($request) == 0)
   {
      db_query("
         INSERT INTO {$db_prefix}clickcounts
         (name, value)
         VALUES
         ('$gameName', 0)",__FILE__,__LINE__);
      $views = 0;
   }
   
   mysql_free_result($request);
   db_query("UPDATE {$db_prefix}clickcounts     
   SET value = value + 1     
   WHERE name = '$gameName'     
   LIMIT 1", __FILE__, __LINE__);
   $views = $views + 1;
   return $views;
}

SA™

nope still nothing im getting peed of lol so im gonna shoot my self :D

so ithink im gonna leave this one as im not gonna be able to do it

thank you dragoon,LHVWB,[sinan] i appretiate you help

ill try again somtime next century [never]lol
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

[SiNaN]

Can you attach here the source file and template file?
Former SMF Core Developer | My Mods | SimplePortal

SA™

#55
sure heres the whole packeg i undone all the changes i made just now sry

click
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

SA™

Sadrazam have you manged to help with this yet?


wayne
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

[SiNaN]

Checked your codes. You've made it in a very long way. Why don't you save the game name, game picture, game description, game url in the db?

Or what is the difference between this one and the SMF Arcade?
Former SMF Core Developer | My Mods | SimplePortal

Dragooon

@Sardazm, this I believe, basically is a multiplayer game script showing multiplayer games from various sites.

[SiNaN]

Quote from: Dragooon on June 05, 2008, 10:34:43 AM
@Sardazm, this I beli....

It's Sadrazam Dragooon. :P

Hımmm, okay. Something like this would be better:

This is your smf_multiplayer table:

ID_GAME gameName gameDescription timesPlayed gameUrl pictureUrl active

Then when ?action=multiplayer is called, you get the ID_GAME gameName gameDescription timesPlayed pictureUrl active from db. You put them in an array. Then show if the active is true with the foreach function. You can use the constructPageIndex() function to create a page index. So your game link is like this ?action=multiplayer;sa=game;id=5. Then you call the "game" sub-template and get the information about the game which has the ID 5. And when in the "game" sub-template, you put the gameUrl as the "value" in parameters.

Believe me, trying to add hits to these codes are harder then coding the mod as I wrote above.
Former SMF Core Developer | My Mods | SimplePortal

Advertisement: