dhpackr
14 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
14 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
14 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
14 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
14 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
14 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
14 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
14 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
14 years ago

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

"IronMan" wrote:



Ditto.
UserPostedImage
dhpackr
14 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
Users browsing this topic
    Fan Shout
    Zero2Cool (5h) : Boom. Student Loan. $0.00. Only took about 20 years.
    Zero2Cool (14-Apr) : Packers DT Kenny Clark: New defensive coordinator Jeff Hafley will 'allow us to be way more disruptive'
    Zero2Cool (12-Apr) : Saints have agreed to terms on a contract with former Packers wide receiver Equanimeous St. Brown.
    beast (12-Apr) : No, but of it's for legislation, then half of the country will find it evil, not good, whatever it says....
    Mucky Tundra (12-Apr) : Draft is still 2 weeks away. UGH
    dhazer (11-Apr) : Does anyone know of a good AI generator to create letters of Support for legislation?
    Zero2Cool (11-Apr) : Gordon "Red" Batty retires as equipment manager
    Zero2Cool (10-Apr) : Sounds like that's pretty certain now.
    Zero2Cool (10-Apr) : Packers "at" Eagles in Brazil. Week One
    dfosterf (10-Apr) : Va' Fazer As Malas Va' !
    Zero2Cool (9-Apr) : Mark Murphy tipping us off?
    Zero2Cool (9-Apr) : “We’re either the first- or second-most popular team in Brazil.”
    Zero2Cool (9-Apr) : Christian Watson got married. Wife better be careful with those hamstrings!! 😂😂
    dfosterf (9-Apr) : Those poor bastards
    Zero2Cool (8-Apr) : Falcons have signed former Packers CB Kevin King, who has been out of football since 2021.
    dfosterf (8-Apr) : Collectively, we need to spend more time in what we have, when analyzing ostendible needs and historical proclivities
    dfosterf (8-Apr) : I say he is better than so many of these draft picks
    dfosterf (8-Apr) : Question of the week for me: Has anyone besides me done any deep dive into the potential of Alex McGough, our 3rd string qb?
    Zero2Cool (8-Apr) : Or in Tunsil's case, something gets released day of draft or day before lol
    Zero2Cool (8-Apr) : Seems every year someone does something pre-draft.
    dfosterf (8-Apr) : Falling down drunk. The draft board
    dfosterf (8-Apr) : Allright! Potential character guy/f#×k up pickup in D'Vondre Sweat!
    Zero2Cool (7-Apr) : Go Badgers!!!
    Martha Careful (6-Apr) : Go Boilermakers!!!
    Martha Careful (5-Apr) : Diggs has not stepped up in the playoffs and has a high cost
    beast (5-Apr) : Probably not going to let Diggs walk away unless he's horrible... but according to reports he also might not be as good as he used to be.
    beast (5-Apr) : The 25th pick in the draft has been an offensive player since 2017, 2 TE, 2 WR, 1 RB, 1 OC
    Mucky Tundra (5-Apr) : Odd, why give up a 2025 2nd Rounder for him if you're just gonna let him walk?
    Zero2Cool (4-Apr) : Texans to let Diggs be free agent in '25
    buckeyepackfan (4-Apr) : 49r's aign RB Patrick Taylor.
    Martha Careful (4-Apr) : Reversion to the mean would indicate we will keep it
    Zero2Cool (4-Apr) : It's also been utilized in a trade in 14 of the past 20 years
    Zero2Cool (4-Apr) : The 25th pick in the draft hasn't been made by it's original holder since 2016.
    Mucky Tundra (4-Apr) : Gotta imagine that Green Bay vs Houston will be a primetime game this upcoming season
    Zero2Cool (3-Apr) : No. Kill QB. No worries. 😁
    Mucky Tundra (3-Apr) : Diggs, Collins, Dell and Schultz is gonna be tough to cover
    Zero2Cool (3-Apr) : Stefon Diggs' trade will not be processed as a post-June 1 designation, so that is just over $31 million in dead cap this year.
    Zero2Cool (3-Apr) : Bills trading WR Stefon Diggs to the Texans in exchange for a 2025 2nd-round pick. (via @rapsheet)
    beast (3-Apr) : Using Patterson as RB and RB/WR tweener... so I think they also signed Patterson as a 3rd down RB, not just a kick returner as articles are
    beast (3-Apr) : I think PFT missed the real Steelers/Patterson connection, Steelers new OC Arthur Smith has been Patterson's head coach the last 3 years
    wpr (2-Apr) : It has Martha. I was stunned when I was in HS to learn Iowa was still playing half court BB in the 70's.
    Martha Careful (2-Apr) : Caitlin Clark, Angel Reese...women's sports has come a long way. GREAT TO SEE!!
    Martha Careful (31-Mar) : Happy Easter everyone. I hope you all have a great day.
    dfosterf (28-Mar) : Maybe
    Mucky Tundra (28-Mar) : Yes
    Zero2Cool (28-Mar) : No.
    Mucky Tundra (28-Mar) : End of a Degu-era
    dhazer (28-Mar) : Steelers sign Patterson because of new kickoff rule interesting
    Zero2Cool (28-Mar) : Former #Packers TE Josiah Deguara is signing a 1-year deal with the Jaguars, per source.
    Zero2Cool (28-Mar) : They do not do it for "content sake".
    Please sign in to use Fan Shout
    2023 Packers Schedule
    Sunday, Sep 10 @ 3:25 PM
    Bears
    Sunday, Sep 17 @ 12:00 PM
    Falcons
    Sunday, Sep 24 @ 12:00 PM
    SAINTS
    Thursday, Sep 28 @ 7:15 PM
    LIONS
    Monday, Oct 9 @ 7:15 PM
    Raiders
    Sunday, Oct 22 @ 3:25 PM
    Broncos
    Sunday, Oct 29 @ 12:00 PM
    VIKINGS
    Sunday, Nov 5 @ 12:00 PM
    RAMS
    Sunday, Nov 12 @ 12:00 PM
    Steelers
    Sunday, Nov 19 @ 12:00 PM
    CHARGERS
    Thursday, Nov 23 @ 11:30 AM
    Lions
    Sunday, Dec 3 @ 7:20 PM
    CHIEFS
    Monday, Dec 11 @ 7:15 PM
    Giants
    Sunday, Dec 17 @ 12:00 PM
    BUCCANEERS
    Sunday, Dec 24 @ 12:00 PM
    Panthers
    Sunday, Dec 31 @ 7:20 PM
    Vikings
    Sunday, Jan 7 @ 3:25 PM
    BEARS
    Sunday, Jan 14 @ 3:30 PM
    Cowboys
    Saturday, Jan 20 @ 7:15 PM
    49ers
    Recent Topics
    29m / Green Bay Packers Talk / Martha Careful

    11h / Green Bay Packers Talk / Mucky Tundra

    18h / Random Babble / Martha Careful

    22h / Green Bay Packers Talk / dfosterf

    15-Apr / Green Bay Packers Talk / dfosterf

    12-Apr / Random Babble / Nonstopdrivel

    12-Apr / Green Bay Packers Talk / Martha Careful

    11-Apr / Green Bay Packers Talk / Zero2Cool

    10-Apr / Green Bay Packers Talk / dfosterf

    8-Apr / Green Bay Packers Talk / Zero2Cool

    5-Apr / Green Bay Packers Talk / Martha Careful

    5-Apr / Green Bay Packers Talk / bboystyle

    4-Apr / Green Bay Packers Talk / Zero2Cool

    4-Apr / Green Bay Packers Talk / buckeyepackfan

    4-Apr / Green Bay Packers Talk / Mucky Tundra

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