Jump to content

Help needed!


Magollo

Recommended Posts

Hey there. Ive got a problem with PHP/Mysql. I hope somebody could help me out.

I dont know pretty well MySQL, but I built a Query and tested in phpmyadmin and it worked fine.
But when I try to ejecute the query by PHP (mysql_query() function) it seems to be wrong and gets me the 1064 error.
Don´t know whats happening. Can somebody help me please?

This is the Query :
[sub]
SET @village = 1;
SET @segundos = (SELECT (( TO_DAYS( NOW() ) - 73000 ) * 86400 + TIME_TO_SEC( NOW() )) - (( TO_DAYS( `lastcheck` ) - 73000 ) * 86400 + TIME_TO_SEC( `lastcheck` )) FROM village WHERE `id` = @village);
SET @addwood = (SELECT (`addwood` * @segundos) FROM village WHERE `id` = @village);
SET @addstone= (SELECT (`addstone` * @segundos) FROM village WHERE `id` = @village);
SET @addiron = (SELECT (`addiron` * @segundos) FROM village WHERE `id` = @village);
SET @addgold= (SELECT (`addgold` * @segundos) FROM village WHERE `id` = @village);
UPDATE `village` SET wood = wood+@addwood,stone = stone+@addstone,iron = iron+@addiron,gold= gold+@addgold,lastcheck = NOW() WHERE `id` = @village;
SELECT @addwood as addwood, @addstone as addstone,@addiron as addiron,@addgold as addgold
[/sub]

Check it at [url=http://www.magollo.com.ar/test.php]www.magollo.com.ar/test.php[/url]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.