Front Office Football Central  

Go Back   Front Office Football Central > Main Forums > FOF9, FOF8, and TCY Discussion
Register FAQ Members List Calendar Mark Forums Read Statistics

Reply
 
Thread Tools
Old 01-17-2008, 12:22 PM   #1
3ric
College Starter
 
Join Date: Dec 2000
Location: Sweden
Basic draft utility (originally by VPI, modified by Lonnie):
http://www.hfl-football.net/draft.zip
http://www.hfl-football.net/draft_database.zip
Installation instructions:
http://www.hfl-football.net/Draft%20Setup.doc
__________________
San Diego Chargers (HFL) - Lappland Reindeers (WOOF) - Gothenburg Giants (IHOF)
Indiana: A TCY VC - year 2044 - the longest running dynasty ever on FOFC!


Last edited by 3ric : 01-17-2008 at 12:31 PM.
3ric is offline   Reply With Quote
Old 01-24-2008, 03:58 AM   #2
Ben E Lou
Morgado's Favorite Forum Fascist
 
Join Date: Oct 2000
Location: Greensboro, NC
Bump. Giving this its own thread and linking in the new reference thread.
__________________
The media don't understand the kinds of problems and pressures 54 million come wit'!
Ben E Lou is offline   Reply With Quote
Old 02-21-2008, 12:14 PM   #3
danimal
n00b
 
Join Date: Nov 2007
Is there anyone who'd be willing to help me set up this draft utility for my office league?

I think I am 80% of the way there, but I can't seem to figure out the last bit. The mysql database and the web pages are set up, but whenever I try to do something through the draft board web page (e.g., trade a pick, change my preference list, etc.), my action doesn't get updated in the mysql database.

I'd be happy to send you the php files. I'm very very new to php, so I could be missing something obvious. Any help you're willing to offer would be much appreciated.

Thanks!
Dan
danimal is offline   Reply With Quote
Old 02-21-2008, 12:51 PM   #4
3ric
College Starter
 
Join Date: Dec 2000
Location: Sweden
Have you updated the index.php file with your login info and the mysql server your database is on?
__________________
San Diego Chargers (HFL) - Lappland Reindeers (WOOF) - Gothenburg Giants (IHOF)
Indiana: A TCY VC - year 2044 - the longest running dynasty ever on FOFC!
3ric is offline   Reply With Quote
Old 02-21-2008, 12:56 PM   #5
danimal
n00b
 
Join Date: Nov 2007
Yes, I am able to log in with my phpBB username and password, and the draftboard.php and other informational pages are pulling data from the mysql database.

http://www.frontofficenfl.com/draft/draftboard.php

The problem seems to be when I try doing something on the index.php page. Whatever action I take doesn't seem to getting updated on the database.

I actually had to make some adjustments to the login portion of the index.php file to get that to work. The biggest change I made was initializing the $uid and $pwd variables using $_POST[]. That seemed to do the trick.

But I don't know how to get the rest of index.php to work.

Last edited by danimal : 02-21-2008 at 12:56 PM.
danimal is offline   Reply With Quote
Old 02-21-2008, 02:44 PM   #6
3ric
College Starter
 
Join Date: Dec 2000
Location: Sweden
Maybe there's a variable you've missed to initialize?
I have this section in my code:
$current_url = $_SERVER['PHP_SELF'];
$uid = $_POST['uid'];
$pwd = $_POST['pwd'];
$edittype = $_POST['edittype'];
$spick = $_POST['spick'];
$tradeteam = $_POST['tradeteam'];
$playerselection = $_POST['playerselection'];
$ptrade = $_POST['ptrade'];
$pref = $_POST['pref'];
$tid = $_POST['tid'];
$usage = $_POST['usage'];
$sortopt = $_POST['sortopt'];
__________________
San Diego Chargers (HFL) - Lappland Reindeers (WOOF) - Gothenburg Giants (IHOF)
Indiana: A TCY VC - year 2044 - the longest running dynasty ever on FOFC!
3ric is offline   Reply With Quote
Old 02-21-2008, 02:54 PM   #7
gottimd
Dearly Missed
(9/25/77-12/23/08)
 
Join Date: Nov 2003
Location: DC Suburbs
Isn't there somewhere to "Start" the clock?
__________________
NAFL New Orleans Saints GM/Co-Commish
MP Career Record: 114-85
NAFL Super Bowl XI Champs
In memory of Gavin Anthony: 7/22/08-7/26/08
gottimd is offline   Reply With Quote
Old 02-21-2008, 02:56 PM   #8
danimal
n00b
 
Join Date: Nov 2007
Wow, there were definitely a few variables in that list I hadn't initialized.

That seems to have fixed part of the problem - I can now trade picks to other teams.

Any changes to the preference list, however, don't seem to be working. Are there other variables I'm missing? Perhaps it's the java script that's not working? I know nothing about java scripts, so I'm screwed if that's the case.

Here is the code I used to initialize the variables.

$uid = !isset($_POST['uid'])? "" : $_POST['uid'];
$pwd = !isset($_POST['pwd'])? "" : $_POST['pwd'];
$edittype = !isset($_POST['edittype'])? "" : $_POST['edittype'];
$spick = !isset($_POST['spick'])? NULL : $_POST['spick'];
$tradeteam = !isset($_POST['tradeteam'])? NULL : $_POST['tradeteam'];
$playerselection = !isset($_POST['playerselection'])? NULL : $_POST['playerselection'];
$ptrade = !isset($_POST['ptrade'])? NULL : $_POST['ptrade'];
$pref = !isset($_POST['pref'])? NULL : $_POST['pref'];
$tid = !isset($_POST['tid'])? NULL : $_POST['tid'];
$usage = !isset($_POST['usage'])? NULL : $_POST['usage'];
$sortopt = !isset($_POST['sortopt'])? NULL : $_POST['sortopt'];
$url = $_SERVER['PHP_SELF'];
danimal is offline   Reply With Quote
Old 02-21-2008, 03:11 PM   #9
marcmoustache
H.S. Freshman Team
 
Join Date: Jun 2005
Have you made sure that the selectbox.js file is in the draft directory? You need that to update the pref lists.
marcmoustache is offline   Reply With Quote
Old 02-21-2008, 03:12 PM   #10
danimal
n00b
 
Join Date: Nov 2007
Yup, selectbox.js is in the draft directory.
danimal is offline   Reply With Quote
Old 02-21-2008, 03:21 PM   #11
3ric
College Starter
 
Join Date: Dec 2000
Location: Sweden
Quote:
Originally Posted by gottimd View Post
Isn't there somewhere to "Start" the clock?

// Set $draftstatus to live or standby
$draftstatus = "live";

Not sure if that's what you mean?
__________________
San Diego Chargers (HFL) - Lappland Reindeers (WOOF) - Gothenburg Giants (IHOF)
Indiana: A TCY VC - year 2044 - the longest running dynasty ever on FOFC!
3ric is offline   Reply With Quote
Old 02-21-2008, 03:23 PM   #12
danimal
n00b
 
Join Date: Nov 2007
Quote:
Originally Posted by 3ric View Post
// Set $draftstatus to live or standby
$draftstatus = "live";

Not sure if that's what you mean?

Yes, but the preference list should work even if the draft is on standby, right?
danimal is offline   Reply With Quote
Old 02-21-2008, 03:27 PM   #13
3ric
College Starter
 
Join Date: Dec 2000
Location: Sweden
Quote:
Originally Posted by danimal View Post
Any changes to the preference list, however, don't seem to be working.

Have you double-checked all update queries and they are using the correct database tables?
for example:
$sql = "Update hfl_dutil_list set dclassid = $p where teamid = $tid and listorder = $cnt";

updates the preference list, but there are several more such lines
__________________
San Diego Chargers (HFL) - Lappland Reindeers (WOOF) - Gothenburg Giants (IHOF)
Indiana: A TCY VC - year 2044 - the longest running dynasty ever on FOFC!

Last edited by 3ric : 02-21-2008 at 03:29 PM.
3ric is offline   Reply With Quote
Old 02-21-2008, 03:47 PM   #14
danimal
n00b
 
Join Date: Nov 2007
Quote:
Originally Posted by 3ric View Post
Have you double-checked all update queries and they are using the correct database tables?
for example:
$sql = "Update hfl_dutil_list set dclassid = $p where teamid = $tid and listorder = $cnt";

updates the preference list, but there are several more such lines

It looks like all update queries are using the correct database tables:

$sql = "Update hfl_dutil_list set dclassid = $p where teamid = $tid and 'order' = $cnt";
$sql = "Update hfl_dutil_list set dclassid = '-1' where teamid = $tid and 'order' = $cnt";
$sql = "Update hfl_dutil_list set dclassid = '-1' where teamid = $tid and 'order' = $cnt";
$sql = "Update hfl_dutil_list set apply = 1 where teamid = $tid";
$sql = "Update hfl_dutil_list set apply = 2 where teamid = $tid";
$sql = "Update hfl_dutil_list set apply = 0 where teamid = $tid";
$sql = "Update hfl_dutil_list set sortvar = 1 where teamid = $tid";
$sql = "Update hfl_dutil_list set sortvar = 0 where teamid = $tid";
danimal is offline   Reply With Quote
Old 02-21-2008, 03:56 PM   #15
danimal
n00b
 
Join Date: Nov 2007
Just to be clear, I am able to change the way I sort through players (position vs. rating), and I am able to turn the preference list to on, off, or once.

The part that doesn't seem to be working is adding or removing players from the preference list. I'm looking through the code right now, but given my inexperience with php I could be missing something.

Would one of you be willing to take a look at my index.php file?
danimal is offline   Reply With Quote
Old 02-21-2008, 04:06 PM   #16
danimal
n00b
 
Join Date: Nov 2007
This seems to be the piece that should be taking preference list changes on index.php and putting them into the hfl_dutil_list database table.

Is there something wrong with the code here?


case "3":
$cnt = 0;
if( isset($pref) ){
foreach($pref as $p) {
$cnt++;
if ( $cnt <= 32 ) {
$sql = "Update hfl_dutil_list set dclassid = $p where teamid = $tid and 'order' = $cnt";
$result = mysql_query($sql,$db)or die("Bad query: ".mysql_error());
}
}
while ( $cnt <= 31 ) {
$cnt++;
$sql = "Update hfl_dutil_list set dclassid = '-1' where teamid = $tid and 'order' = $cnt";
$result = mysql_query($sql,$db)or die("Bad query: ".mysql_error());
}
}
else {
// If there are 0 players in the list, loop through slots 0-32 and put -1 in the slot.
while ( $cnt <= 31 ) {
$cnt++;
$sql = "Update hfl_dutil_list set dclassid = '-1' where teamid = $tid and 'order' = $cnt";
$result = mysql_query($sql,$db)or die("Bad query: ".mysql_error());
}
}
danimal is offline   Reply With Quote
Old 02-21-2008, 06:02 PM   #17
danimal
n00b
 
Join Date: Nov 2007
Ugh, I'm stumped.

I ran a quick test and it looks like the pref array is properly storing player id numbers. So the problem seems to be that the script isn't properly updating the database table with the player id numbers stored in the pref array.

I tried playing with the mysql query syntax, but that doesn't seem to be doing anything either.

$sql = "UPDATE hfl_dutil_list SET dclassid = $p WHERE ((teamid = $tid) AND ('order' = $cnt))";

Anyone have ideas about why this isn't working?
danimal is offline   Reply With Quote
Old 02-21-2008, 06:36 PM   #18
danimal
n00b
 
Join Date: Nov 2007
I tried to run the sql query directly through phpMyAdmin, and it's not working.

UPDATE hfl_dutil_list SET dclassid='84' WHERE ((teamid='2') AND ('order'='1'))
Affected rows: 0 (Query took 0.0004 sec)


By the way, why doesn't that query work if you don't have the quotes around 'order'? If i remove the quotes, I get the following error:

#1064 - 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 'order='1'))' at line 1

So I'm guessing this is a syntax error? The query isn't doing what I want it to do.
danimal is offline   Reply With Quote
Old 02-21-2008, 06:49 PM   #19
Skolleck
n00b
 
Join Date: May 2005
send me an AIM message at swkolleck and I will help you.

Last edited by Skolleck : 02-21-2008 at 06:50 PM.
Skolleck is offline   Reply With Quote
Old 02-21-2008, 09:05 PM   #20
danimal
n00b
 
Join Date: Nov 2007
Ok, I am an idiot. I figured it out. It's so obvious now in hindsight.

I had to change the database table field name "order" to "listorder" because ORDER BY is a mysql clause.

Thanks guys for your help and your patience.
danimal is offline   Reply With Quote
Old 02-23-2008, 12:13 AM   #21
Lonnie
High School Varsity
 
Join Date: Dec 2004
Location: Midlothian, TX
Sorry so late in seeing this, but yep order is a reserved word in MySQL. If you use the single quotes it works fine. If you look at your error message, you see that you missed the trailing ' after order. I should have changed the field name when I first converted it, but at that time I didn't think it would get as widespread as it is now. I was just trying to get something to work.

If you have any other problems, PM me.
__________________
Lonnie
Lonnie is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump


All times are GMT -5. The time now is 08:02 PM.



Powered by vBulletin Version 3.6.0
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.