BrainMeta'   Connectomics'  

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> help
Haji
post Oct 05, 2007, 03:05 AM
Post #1


Newbie
*

Group: Basic Member
Posts: 7
Joined: Oct 05, 2007
Member No.: 13259



can someone tell me if this code is right?

<?php
include("config.php");
?>

<?
mysql_query("update players set energy=max_energy");
mysql_query("update players set hp=max_hp");
mysql_query("update outposts set turns=5");
mysql_query("update outposts set tokens=tokens+100");
mysql_query("update players set ap=ap+3");


mysql_query("update players set age=age+1");
?>

or should it be

<?php
include("config.php");

mysql_query("update players set energy=max_energy");
mysql_query("update players set hp=max_hp");
mysql_query("update outposts set turns=5");
mysql_query("update outposts set tokens=tokens+100");
mysql_query("update players set ap=ap+3");


mysql_query("update players set age=age+1");
?>
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
maximus242
post Oct 05, 2007, 10:26 AM
Post #2


God
******

Group: Basic Member
Posts: 1755
Joined: Jan 24, 2006
Member No.: 4768



Well the easiest way to tell is just to test them both and see which one works.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
lucid_dream
post Oct 05, 2007, 12:24 PM
Post #3


God
******

Group: Admin
Posts: 1711
Joined: Jan 20, 2004
Member No.: 956



both codes do the exact same thing. It doesn't matter if you break it up using <? and ?>. However, your code will not work as is. For starters, you need mysql_connect and to use quotes around strings in your mysql queries.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
maximus242
post Oct 06, 2007, 12:03 AM
Post #4


God
******

Group: Basic Member
Posts: 1755
Joined: Jan 24, 2006
Member No.: 4768



Ah yea thats right. Its been a very long time since ive programmed in php.

He has a config file included they're so I wonder if he just put the mysql connect in the config file. Usually you have your config file and your file to open the db connection.

If you havent opened your connection to the database in your code yet, its relatively simple to do.

Heres some example code

<?php
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
?>

Just save that as a php file, like I dono, openconnect or dbconn then include it when you want to open your connection to the database
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Haji
post Oct 06, 2007, 12:44 AM
Post #5


Newbie
*

Group: Basic Member
Posts: 7
Joined: Oct 05, 2007
Member No.: 13259



ok the script works but only when I manually open the page myself.

when I try and use a cron job i get this error.

/home/rseclan/public_html/linkway/reset.php: line 1: ?php: No such file or directory
/home/rseclan/public_html/linkway/reset.php: line 2: syntax error near unexpected token `"config.php"'/home/rseclan/public_html/linkway/reset.php: line 2: `include("config.php");'

I put /home/rseclan/public_html/linkway/reset.php in because thats the path the file manger gives me.

also I have asked the host themsevles and they said thats the correct path.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 21st November 2017 - 11:24 PM


Home     |     About     |    Research     |    Forum     |    Feedback  


Copyright BrainMeta. All rights reserved.
Terms of Use  |  Last Modified Tue Jan 17 2006 12:39 am

Consciousness Expansion · Brain Mapping · Neural Circuits · Connectomics  ·  Neuroscience Forum  ·  Brain Maps Blog
 · Connectomics · Connectomics  ·  shawn mikula  ·  shawn mikula  ·  articles