Werd Error

Ask Page...

Moderators: JettJackson, Infinity, Page

Post Reply
Freon22
Beginner Spam Artist
Posts: 3278
Joined: Wed Apr 17, 2002 10:09 pm
Location: USA
Contact:

Werd Error

Post by Freon22 »

Had ploted a course and was following it. When I entered sector 504 I got this error.

Code: Select all

Query failed: SELECT * alliances WHERE alliance_id IN (3) AND game_id = 5 LIMIT 1
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 'alliances WHERE alliance_id IN (3) AND game_id = 5 LIMIT 1' at line 1
Tryed to finish following course and got this. Don't know if the two are connected. I did stop following the course to make this post before trying to finish the course.
Error: This link has expired!
In order to prevent cheating Az - Space Merchant Realms makes certain links available for only a certain period of time.

To prevent seeing this error in the future, don't use the back button excessively or try and click the link sooner once a page loads.

Also avoid using the refresh button. Instead, try clicking the link you want to have refreshed.

Debug Info: time=1187317802,pass=, val=, until=, idt=1187317802, dat=1187317544
Also once I got the Error: This link has expaired message it does not reset. I can click the Current Sector link and it is still there. You may want to add that to your ToDo: list
Freon22
Beginner Spam Artist
Posts: 3278
Joined: Wed Apr 17, 2002 10:09 pm
Location: USA
Contact:

Post by Freon22 »

Another question?

I like the list you have on the login page. What program are you using to get that infor. I can get my ToDo: list on each page in my editor and my lines are numbered so thats a given. But you have total lines of all pages I like that don't have to add each page total to find your total lines.

Also in your Number of Scource Files in SMR 1.5 is that just your Classes or a count of pages, images, and classes?
Azool
SMR Coder
Posts: 1736
Joined: Sat Feb 23, 2002 8:42 pm
Location: Colorado Springs, CO
Contact:

Post by Azool »

First error you posted is fixed. The second will occur after any SQL error, so they are linked and therefore it is fixed as well.
Freon22 wrote:Another question?

I like the list you have on the login page. What program are you using to get that infor. I can get my ToDo: list on each page in my editor and my lines are numbered so thats a given. But you have total lines of all pages I like that don't have to add each page total to find your total lines.

Also in your Number of Scource Files in SMR 1.5 is that just your Classes or a count of pages, images, and classes?
Its just PHP code I made. Here it is if you are interested.

Code: Select all

$scan_ext = array('inc','php','.js','css','tml','htm');
$scan[] = '../../game_files/';
$scan[] = '../game/';
$num_lines = 0;
$num_files = 0;
$mod = 0;
$todo = array();
while (sizeof($scan) > 0)
{
	$dir = array_shift($scan);
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false)
        {
			if ($file == '.' || $file == '..' || is_numeric($file)) continue;
			if (filetype($dir . $file) == 'dir') $scan[] = $dir . $file . '/';
            else $files[] = $dir . $file;
        }
        closedir($dh);
    }
}
foreach ($files as $fileName)
{
	if (!in_array(substr($fileName, -3),$scan_ext)) continue;
	$num_files++;
	$handle = fopen($fileName, "r");
	$contents = fread($handle, filesize($fileName));
	fclose($handle);
	$lines = preg_split('/[\n\r]+/',$contents);
	$num_lines += sizeof($lines);
	if (filemtime($fileName) >= (time() - 3600 * 24)) $mod++;
	foreach ($lines as $text)
	{
		if (substr($text,0,6) == '//TODO' || substr($text,0,7) == '// TODO')
		{
			$todo[] = str_replace('../','',$fileName) . ' : ' . $text;
		}
	}
}
echo '<table class="standard">';
echo '<tr><td colspan="2" class="center">Current Status: (Auto Generated Material Not Included)</td></tr>';
echo '<tr><td class="right">Number of Scource Files in SMR 1.5</td><td class="left">' . $num_files . '</td></tr>';
echo '<tr><td class="right">Number of Lines in SMR 1.5</td><td class="left">' . $num_lines . '</td></tr>';
echo '<tr><td class="right">Number of Files Modified/Created in the last 24 Hours</td><td class="left">' . $mod . '</td></tr>';
echo '<tr><td class="right">Number of "TODO" tasks.</td><td class="left">' . sizeof($todo) . '</td></tr>';
echo '</table>';
if (isset($_REQUEST['todo']))
{
	echo '<pre>';
	print_r($todo);
	echo '</pre>';
}
echo '</body></html>';
Basically $scan_ext tells the script what extensions (the last 3 letters of each extension really).
The script then scans all game directories ($scan[] = '../game/' and the other $scan[] = initiate the directories to look in) and puts the files into an array to be read later. It skips all folders with numeric names. This is because in my project anything with a numeric name means it is auto-generated and I didn't directly code it.

It then looks at every entry in the file array. It adds 1 to the file count (so the file count displayed is the count of the number of .php, .inc, .html, .htm, .css files). It opens the file, reads the number of lines and then goes through each line to determine if it has a TODO task.

It also has a nice function that only I see :) [Last 6 or so lines of code]
If you go to http://game.azool.us/login.php?todo it will show you all the TODO lines and the script they are on. It most likely won't mean anything to you, but it saves me a lot of time of searching scripts to make sure they are complete.
Men are born to succeed, not fail.
-Henry David Thoreau
Freon22
Beginner Spam Artist
Posts: 3278
Joined: Wed Apr 17, 2002 10:09 pm
Location: USA
Contact:

Post by Freon22 »

I love it :D . Going to recode that in vb. PHP syntax is alot like C# and I can read C# ok. I also like the ToDo: list, saves from having to go to each page to look at the ToDo's on those pages. More then once I have gone to a page and found a ToDo that I had forgotten about.

Nice work Azool /me got more respect for your coding ability.
Azool
SMR Coder
Posts: 1736
Joined: Sat Feb 23, 2002 8:42 pm
Location: Colorado Springs, CO
Contact:

Post by Azool »

Freon22 wrote:I also like the ToDo: list, saves from having to go to each page to look at the ToDo's on those pages. More then once I have gone to a page and found a ToDo that I had forgotten about.
Yeah, I was going through some pages I made last week and this was already happening :) thats why I made the script.
Men are born to succeed, not fail.
-Henry David Thoreau
Post Reply