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 (10m) : I would think it would hurt the home team because people would have to cancel last minute maybe? i dunno
beast (19m) : I agree that it's BS for fans planning on going to the game. But how does it bring in more money? I'm guessing indirectly?
packerfanoutwest (30m) : bs on flexing the game....they do it for the $$league$$, not the hometown fans
Zero2Cool (1h) : I see what you did there Mucky
Zero2Cool (1h) : dammit. 3:25pm
Zero2Cool (1h) : Packers Vikings flexed to 3:35pm
Mucky Tundra (1h) : Upon receiving the news about Luke Musgrave, I immediately fell to the ground
Mucky Tundra (1h) : Yeah baby!
Zero2Cool (1h) : LUKE MUSGRAVE PLAYING TONIGHT~!~~~~WOWHOAAOHAOAA yah
Zero2Cool (2h) : I wanna kill new QB's ... blitz the crap out of them.
beast (2h) : Barry seemed to get too conservative against new QBs, Hafley doesn't have that issue
Zero2Cool (3h) : However, we seem to struggle vs new QB's
Zero2Cool (3h) : Should be moot point, cuz Packers should win tonight.
packerfanoutwest (4h) : ok I stand corrected
Zero2Cool (4h) : Ok, yes, you are right. I see that now how they get 7th
Zero2Cool (4h) : 5th - Packers win out, Vikings lose out. Maybe?
beast (4h) : Saying no to the 6th lock.
beast (4h) : No, with the Commanders beating the Eagles, Packers could have a good chance of 6th or 7th unless the win out
Zero2Cool (4h) : I think if Packers win, they are locked 6th with chance for 5th.
beast (4h) : But it doesn't matter, as the Packers win surely win one of their remaining games
beast (4h) : This is not complex, just someone doesn't want to believe reality
beast (4h) : We already have told you... if Packers lose all their games (they won't, but if they did), and Buccaneers and Falcons win all theirs
Zero2Cool (4h) : I posted it in that Packers and 1 seed thread
Zero2Cool (4h) : I literally just said it.
packerfanoutwest (4h) : show us a scenario where Pack don't get in? bet you can't
Zero2Cool (4h) : Falcons, Buccaneers would need to win final two games.
Zero2Cool (4h) : Yes, if they win one of three, they are lock. If they lose out, they can be eliminated.
packerfanoutwest (4h) : as I just said,,gtheyh are in no matter what
Zero2Cool (4h) : Packers should get in. I just hope it's not 7th seed. Feels dirty.
packerfanoutwest (4h) : If packers lose out, no matter what, they are in
packerfanoutwest (4h) : both teams can not male the playoffs....falcon hold the tie breaker
packerfanoutwest (4h) : if bucs win out they win their division
beast (4h) : Fine, Buccaneers and Falcons can get ahead of us
packerfanoutwest (4h) : falcons are already ahead of us
beast (5h) : Packers will get in
beast (5h) : If Packers lose the rest of their games and Falcons win the rest of theirs, they could pass us... but not gonna happen
packerfanoutwest (5h) : they still are in the playoffs
packerfanoutwest (5h) : If Packers lose the remaining games,,,,at 10-7
Zero2Cool (6h) : We can say it. We don't play.
Mucky Tundra (8h) : But to say they are in is looking past the Saints
Mucky Tundra (8h) : That said, their odds are very favorable with a >99% chance of making the playoffs entering this week's games
Mucky Tundra (8h) : Packers are not in and have not clinched a playoff spot.
buckeyepackfan (8h) : Packers are in, they need to keep winning to improve their seed#.
Mucky Tundra (17h) : Getting help would have been nice, but helping ourselves should always be the plan
beast (18h) : Too bad Seahawks couldn't beat Vikings
bboystyle (18h) : We just need to win Monday night and were in
Mucky Tundra (21h) : Or ties, but let's be real here
Mucky Tundra (21h) : Other scenario was Falcons+Rams losses
Mucky Tundra (21h) : Needed a Falcons loss for a Seahawk loss to clinch
buckeyepackfan (21h) : Am I wring in saying if Tge Vikings beat The Seahawks, The Packers clinch?
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 @ 3:25 PM
Vikings
Saturday, Jan 4 @ 11:00 PM
BEARS
Recent Topics
7m / Green Bay Packers Talk / beast

2h / Green Bay Packers Talk / Zero2Cool

3h / Random Babble / Martha Careful

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

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