dhpackr
15 years ago
try using the code i posted for a drop down list
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Zero2Cool
15 years ago

try using the code i posted for a drop down list

"dhpackr" wrote:



I tried, but it's over my head. I don't understand the variables. They have no real meaning. i, i02? That's confusing to simple minded folk like me. Remember, I'm a VB programmer, I need pictures!!! lol


Drop Down List won't work too great. If you scroll you could inadvertently select a different team. That's why I went with radio buttons.
UserPostedImage
dhpackr
15 years ago



I don't understand the variables. They have no real meaning. i, i02? That's confusing to simple minded folk like me. Remember, I'm a VB programmer, I need pictures!!! lol


Drop Down List won't work too great. If you scroll you could inadvertently select a different team. That's why I went with radio buttons.

"Zero2Cool" wrote:



remember, if u choose a radio button, all that will show up in ur database is a 1 or 0

let's break this down
***********************************************************
1st pick a drop down list where the user either picks packers or bengals
<?-----start php script

$01s = array("Packers","Bengals"); //here i am populating an array
//this is an array for a game.
//only two teams in this list are the packers and bengals
if (empty($01s[0])) {
echo '<input type="text" name="01" class="textbox" value="' . $01. '" maxlength="255" />' . "\n";
}
else {
?>
<select name="01" class="textbox">
<option value="">-- please select --</option>
<?
// Print out position options
for ($i = 0; $i < count($01s); $i++) {
echo '<option value="' . $01s[$i] . '"';
if($01s[$i]==$01){echo " selected ";}
echo ">" . $01s[$i] . "</option> \n";
}
?>

************************************************************

2nd pick a drop down list where the user either picks Vikings or Lions
<?-----start php script

$02s = array("Vikings","Lions"); //here i am populating an array
//this is an array for a different game.
//only two teams in this list are the Vikings and lions
if (empty($02s[0])) {
echo '<input type="text" name="02" class="textbox" value="' . $02. '" maxlength="255" />' . "\n";
}
else {
?>
<select name="02" class="textbox">
<option value="">-- please select --</option>
<?
// Print out position options
for ($i = 0; $i < count($02s); $i++) {
echo '<option value="' . $02s[$i] . '"';
if($02s[$i]==$02){echo " selected ";}
echo ">" . $02s[$i] . "</option> \n";
}
?>

*************************************************************
so now i have two drop down lists for two different games. this code will go into my template file. it doesn't matter what u call the variable. I used 01 and 02, you can use whatever you wish.

*************************************************************
now you want to write a function to add picks to database
function add_pick(memberid,$01=null,$02=null) {
$id = $this->get_new_id();
$values = array (
$this->memberid(), $this->01 = $01;
$this->02 = $02;
);

$query = 'INSERT INTO ' . $this->get_table('whateverthetableis') . ' VALUES(?, ?,?)';
$q = $this->db->prepare($query);
$result = $this->db->execute($q, $values);
$this->check_for_error($result);

unset($values, $query);
return $id;
}
*************************************************************

modify the picks

function mod_pick() {
$values = array (

$res->get_01(),
$res->get_02()
);

$query = 'UPDATE ' . $this->get_table('whateverthetableis')

. ' 01=?,'
. ' 02=?,'


$q = $this->db->prepare($query);
$result = $this->db->execute($q, $values);
$this->check_for_error($result);

unset($values, $query);
}
*************************************************************
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Zero2Cool
15 years ago

remember, if u choose a radio button, all that will show up in ur database is a 1 or 0

"dhpackr" wrote:



[php]
<input name='rdoGame14' type='radio' value='Bears' />Chicago Bears
<input name='rdoGame14' type='radio' value='Packers' />Green Bay Packers
[/php]

That gives me the 'Bears' or 'Packers' for the value instead of 1 or 0. I've wrote the team names to the database.

In fact, if you go to Special Features > NFL Picks > 1 and make some selections and hit submit, it'll go to the database with the team names.

I'm using Week02 as my test dummy for validation. 🙂


[php] //code above scans all rdoGame values ...

$varSelection = array($int => array($x, $strSelection));

$int++;
echo $int . " number. <br>";
}
}
//replace this with a check to see if $int = total games for that week.
//if yes, then use a for each loop through the $varSelection array and send
//each pick to the db, one by one.
/if no, exit and alert user to make all selections.

echo $varSelection[0][0] . " - " . $varSelection[0][1] . "<br>";
echo $varSelection[1][0] . " - " . $varSelection[1][1] . "<br>";
echo $varSelection[2][0] . " - " . $varSelection[2][1] . "<br>";
[/php]


Basically, once I get how to increment a multidimensional array's index dynamically, I could be set to go. I have most of this all written down on how to go about it. Except the incrementation of the index in my array. It's only storing the last set of data instead of an index.
UserPostedImage
Zero2Cool
15 years ago
Woohooo!! I figured it out!! Works like a freaking champ!!

I got the array to increment the element and also figured out how to use the for each array to cycle through each element. w00t!

Now to implement the check for all games selected and finish the template.

POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
UserPostedImage
Rockmolder
15 years ago

Woohooo!! I figured it out!! Works like a freaking champ!!

I got the array to increment the element and also figured out how to use the for each array to cycle through each element. w00t!

Now to implement the check for all games selected and finish the template.

POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER

"Zero2Cool" wrote:



[youtube]husjA7bfmug[/youtube]

I know, I know. Honeymooners for you old people.
dhpackr
15 years ago
GR8 Job!
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Zero2Cool
15 years ago

GR8 Job!

"dhpackr" wrote:



Thanks. Now I'm trying to find my pseudo code on how to tally up the numbers or think of how I was planning on it in the first place. lol
UserPostedImage
wpr
  • wpr
  • Preferred Member
15 years ago

I have no idea what you are talking about, but thanks for keeping this site running!

"IronMan" wrote:



Ditto.
UserPostedImage
dhpackr
15 years ago

GR8 Job!

"Zero2Cool" wrote:



Thanks. Now I'm trying to find my pseudo code on how to tally up the numbers or think of how I was planning on it in the first place. lol

"dhpackr" wrote:



i was wondering about that, i sent you an PM.
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Fan Shout
Zero2Cool (2h) : This page was generated in 0.135 seconds.
Mucky Tundra (2h) : Tbh, I can never tell the difference in speed unless it's completely shitting the bed
Zero2Cool (3h) : Sure does feel like site is more snappy
Zero2Cool (6h) : I thought that was the Lions OL
Mucky Tundra (7h) : Travis Glover placed on IR; seasons over for him
Zero2Cool (11h) : found bad sql in database, maybe site faster now?
dfosterf (5-Aug) : I'm going to call that a good move.
Zero2Cool (4-Aug) : Packers sign CB Corey Ballentine
Zero2Cool (4-Aug) : I'm not sure how to kill the draft order just yet so it's not so confusing.
Mucky Tundra (4-Aug) : *to be able
Mucky Tundra (4-Aug) : and because it's not a dynasty league (which makes a lot more sense to be ability to trade picks)
Mucky Tundra (4-Aug) : Oh I know; I was just exploring and it blew my mind that you could trade picks because of the whole reordering thing
Mucky Tundra (4-Aug) : Zero, I think I preferred my offer: your 1st for my 15th rounder
Zero2Cool (4-Aug) : Keep in mind, we do a draft reorder once all members locked in
Zero2Cool (4-Aug) : You can have my 12th Rd for your 2nd round
Mucky Tundra (4-Aug) : Hey i didn't know we could trade picks in fantasy
Mucky Tundra (3-Aug) : Update: Rock has tried a cheese curd, promises it's not his last
Zero2Cool (3-Aug) : watch it!! lol
Mucky Tundra (3-Aug) : you're right, we never did leave, the site just went down :P
Mucky Tundra (3-Aug) : Rock claims to have never eaten a cheese curd
Zero2Cool (3-Aug) : We did not leave.
Mucky Tundra (3-Aug) : Family Night! WE ARE SO BACK!
Mucky Tundra (2-Aug) : To this day, I'm still miffed about his 4 TD game against Dallas on Thanksgiving going to waste
Martha Careful (2-Aug) : Congratulations Sterling Sharpe. He was terrific and I loved watching him play.
beast (2-Aug) : I believe it's technically against the CBA rules, but Jerry just calls it a simple unofficial chat... and somehow gets away with it.
beast (2-Aug) : Jerry Jones is infamous for ̶n̶e̶g̶o̶t̶i̶a̶t̶i̶n̶g̶ chatting with players one on one... and going around the agent.
Mucky Tundra (1-Aug) : Oo just saw a blurb saying that Dallas negotiated directly with Parsons and not through his agent
Mucky Tundra (1-Aug) : I assumed that both guys will get paid, just a matter of when or how we get there
Zero2Cool (1-Aug) : McLaurin nor Micah going anywhere. They will get money
Mucky Tundra (1-Aug) : the Synder years or do they take care of one of their own?
Mucky Tundra (1-Aug) : Do the Commanders risk losing a top WR with an emerging QB just because he's turning 30 and potentially risk damaging the rebuild from
Mucky Tundra (1-Aug) : Turns 30 this September, plays at a high level and Washington has some cap space I believe
Mucky Tundra (1-Aug) : More interesting is Washington with Terry McLaurin
Mucky Tundra (1-Aug) : I would imagine Dallas will resolve this issue with a truckload of money
Zero2Cool (1-Aug) : Micah pulling a Myles with trade request
beast (1-Aug) : Packers should make some cheese forks
Mucky Tundra (31-Jul) : GRAB THE PITCHFORKS~
Zero2Cool (31-Jul) : CUT HIM
Mucky Tundra (31-Jul) : Socieltal collapse imminent
Mucky Tundra (31-Jul) : The West has fallen
Mucky Tundra (31-Jul) : After starting off camp with 25 straight made field goals, Brandon McManus has missed one
Zero2Cool (31-Jul) : But it should be stable
Zero2Cool (31-Jul) : It's probably gonna be slower.
Zero2Cool (31-Jul) : We're gonna just full go on to the new host.
Zero2Cool (31-Jul) : What crap. Site issues galore
Zero2Cool (30-Jul) : if PH dies, there is packerpeople com available
Zero2Cool (30-Jul) : database is on new host, eventually website will follow
Mucky Tundra (30-Jul) : Zero, regarding Ewers, you are correct.
Zero2Cool (30-Jul) : Sadly, this might be our life for awhile. I could put it on another host, but seems it was slower, although more stable
beast (30-Jul) : How long will it be down?
Please sign in to use Fan Shout
2025 Packers Schedule
Sunday, Sep 7 @ 3:25 PM
LIONS
Thursday, Sep 11 @ 7:15 PM
COMMANDERS
Sunday, Sep 21 @ 12:00 PM
Browns
Sunday, Sep 28 @ 7:20 PM
Cowboys
Sunday, Oct 12 @ 3:25 PM
BENGALS
Sunday, Oct 19 @ 3:25 PM
Cardinals
Sunday, Oct 26 @ 7:20 PM
Steelers
Sunday, Nov 2 @ 12:00 PM
PANTHERS
Monday, Nov 10 @ 7:15 PM
EAGLES
Sunday, Nov 16 @ 12:00 PM
Giants
Sunday, Nov 23 @ 12:00 PM
VIKINGS
Thursday, Nov 27 @ 12:00 PM
Lions
Sunday, Dec 7 @ 12:00 PM
BEARS
Sunday, Dec 14 @ 3:25 PM
Broncos
Friday, Dec 19 @ 11:00 PM
Bears
Friday, Dec 26 @ 11:00 PM
RAVENS
Saturday, Jan 3 @ 11:00 PM
Vikings
Recent Topics
5h / Fantasy Sports Talk / dfosterf

14h / Around The NFL / wpr

5-Aug / Green Bay Packers Talk / beast

5-Aug / Green Bay Packers Talk / wpr

4-Aug / Green Bay Packers Talk / bboystyle

3-Aug / Green Bay Packers Talk / Mucky Tundra

3-Aug / Green Bay Packers Talk / beast

3-Aug / Feedback, Suggestions and Issues / Zero2Cool

2-Aug / Green Bay Packers Talk / Mucky Tundra

2-Aug / Green Bay Packers Talk / wpr

28-Jul / Random Babble / Zero2Cool

28-Jul / Green Bay Packers Talk / Mucky Tundra

28-Jul / Green Bay Packers Talk / Mucky Tundra

27-Jul / Green Bay Packers Talk / Mucky Tundra

27-Jul / Green Bay Packers Talk / beast

Headlines
Copyright © 2006 - 2025 PackersHome.com™. All Rights Reserved.