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
beast (6m) : Fine, Buccaneers and Falcons can get ahead of us
packerfanoutwest (12m) : falcons are already ahead of us
beast (16m) : Packers will get in
beast (16m) : If Packers lose the rest of their games and Falcons win the rest of theirs, they could pass us... but not gonna happen
packerfanoutwest (22m) : they still are in the playoffs
packerfanoutwest (22m) : If Packers lose the remaining games,,,,at 10-7
Zero2Cool (2h) : We can say it. We don't play.
Mucky Tundra (3h) : But to say they are in is looking past the Saints
Mucky Tundra (3h) : That said, their odds are very favorable with a >99% chance of making the playoffs entering this week's games
Mucky Tundra (3h) : Packers are not in and have not clinched a playoff spot.
buckeyepackfan (4h) : Packers are in, they need to keep winning to improve their seed#.
Mucky Tundra (13h) : Getting help would have been nice, but helping ourselves should always be the plan
beast (13h) : Too bad Seahawks couldn't beat Vikings
bboystyle (13h) : We just need to win Monday night and were in
Mucky Tundra (16h) : Or ties, but let's be real here
Mucky Tundra (16h) : Other scenario was Falcons+Rams losses
Mucky Tundra (16h) : Needed a Falcons loss for a Seahawk loss to clinch
buckeyepackfan (17h) : Am I wring in saying if Tge Vikings beat The Seahawks, The Packers clinch?
Mucky Tundra (21-Dec) : Agreed; you stinks
Zero2Cool (21-Dec) : I'm not beating anyone. I stinks.
Mucky Tundra (21-Dec) : rough injury for tank dell. guy can't catch abreak
beast (21-Dec) : So far the college playoffs have sucked... One team absolutely dominates the other
beast (21-Dec) : Well even if you weren't positive towards a guy, you wouldn't nessarily want to tell the media that (if they don't know about it)
Martha Careful (21-Dec) : I think MLF want Love to look past the end half issues, and feel good about his play. Our coaches generally keep a very positive tone.
beast (21-Dec) : I think a great running game will do that for most QBs
packerfanoutwest (21-Dec) : Coach Matt LaFleur has said quarterback Jordan Love is playing the best football of his career.
beast (21-Dec) : Oh, that's how you keep beating buckeye, with cheating
Zero2Cool (20-Dec) : There is a rule that if your name starts with 'b' you lose 15 points. Hey, I don't make the rules, I just enforce them!
wpr (20-Dec) : and then there is Beast. Running away with it all.
beast (20-Dec) : As of tonight, 3 way tie for 2nd in Pick'em, that battle is interesting!
beast (20-Dec) : Lions vs Vikings could be the main last game as it could determine division winners or #1 vs #2 seed
Mucky Tundra (20-Dec) : Or if KC needs to win for the #1 seed
Mucky Tundra (20-Dec) : Right now it looks like the only prime worthy games are Det-Minny and KC-Denver (if Denver can clinch a wild card spot)
Mucky Tundra (20-Dec) : The entirety of week 18 being listed as flex is weird
Zero2Cool (19-Dec) : Matt LaFleur today says unequivocally "Ted Thompson had nothing to do with the drafting of Jordan Love."
Zero2Cool (19-Dec) : Apparently, the editing is what pieces comments together. That Ted thing ... fake news.
Zero2Cool (19-Dec) : LaFleur "opportunity that Ted Thompson thought was too good to pass up"
Zero2Cool (19-Dec) : Jordan Love pick was Ted Thompson's idea.
Mucky Tundra (19-Dec) : Kyle Shanahan on signing De'Vondre Campbell as a FA last offseason: “We obviously made a mistake.”
packerfanoutwest (19-Dec) : Alexander’s last season with GB
Martha Careful (18-Dec) : if I were a professional athlete, I would probably look to see who the agent is for Kirk Cousins and then use him
beast (18-Dec) : $100 million fully guaranteed Kirk Cousins gets benched for rookie
Mucky Tundra (18-Dec) : a lower case b
Mucky Tundra (18-Dec) : The real lie is how beast capitalized his name in his message while it's normally spelled with
packerfanoutwest (18-Dec) : haha that's a lie
beast (17-Dec) : Despite what lies other might tell, Beast didn't hate the Winter Warnings, it felt refreshing to Beast for some reason.
Zero2Cool (17-Dec) : whiteout uniforms in general are pretty lame and weak. NFL greed at it's worst
Martha Careful (17-Dec) : The Viking uniforms, the whiteout uniforms specifically absolutely suck
beast (17-Dec) : Thanks Zero2Cool, looks a lot better now
beast (17-Dec) : Seems like someone has a crush on me, can't stop talking about me
Please sign in to use Fan Shout
2024 Packers Schedule
Friday, Sep 6 @ 7:15 PM
Eagles
Sunday, Sep 15 @ 12:00 PM
COLTS
Sunday, Sep 22 @ 12:00 PM
Titans
Sunday, Sep 29 @ 12:00 PM
VIKINGS
Sunday, Oct 6 @ 3:25 PM
Rams
Sunday, Oct 13 @ 12:00 PM
CARDINALS
Sunday, Oct 20 @ 12:00 PM
TEXANS
Sunday, Oct 27 @ 12:00 PM
Jaguars
Sunday, Nov 3 @ 3:25 PM
LIONS
Sunday, Nov 17 @ 12:00 PM
Bears
Sunday, Nov 24 @ 3:25 PM
49ERS
Thursday, Nov 28 @ 7:20 PM
DOLPHINS
Thursday, Dec 5 @ 7:15 PM
Lions
Sunday, Dec 15 @ 7:20 PM
Seahawks
Monday, Dec 23 @ 7:15 PM
SAINTS
Sunday, Dec 29 @ 12:00 PM
Vikings
Saturday, Jan 4 @ 11:00 PM
BEARS
Recent Topics
2h / Green Bay Packers Talk / Zero2Cool

12h / Green Bay Packers Talk / Mucky Tundra

22-Dec / Green Bay Packers Talk / packerfanoutwest

19-Dec / Green Bay Packers Talk / Zero2Cool

19-Dec / Random Babble / Zero2Cool

18-Dec / Green Bay Packers Talk / beast

17-Dec / Green Bay Packers Talk / wpr

17-Dec / Featured Content / Zero2Cool

16-Dec / Green Bay Packers Talk / beast

16-Dec / Green Bay Packers Talk / Martha Careful

16-Dec / Green Bay Packers Talk / beast

16-Dec / Feedback, Suggestions and Issues / Mucky Tundra

16-Dec / Green Bay Packers Talk / Zero2Cool

16-Dec / Green Bay Packers Talk / Zero2Cool

16-Dec / Green Bay Packers Talk / Zero2Cool

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