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 (3h) : LaFleur looking like he had some weight. Coachin will do that lol
    Zero2Cool (5h) : Thanks Mucky and whomever created topcos for each pick!
    Zero2Cool (5h) : Insane about Kingsley
    dfosterf (8h) : Putring it here so Mucky sees it. He was our guy!
    dfosterf (8h) : Bowden long snapper Wisconsin. Consensus best LS in college.
    dfosterf (8h) : We got Peter Bowde
    dfosterf (8h) : I personally interpret that as a partial tear that can be recovered from with rehab
    dfosterf (9h) : MLF said Kingsley Enagbare did NOT tear his ACL and did NOT require surgery, and that he is "looking good" for the 2024 season!
    beast (20h) : T.O. son signs with the 49ers
    Mucky Tundra (21h) : damn those vikings
    beast (21h) : UDFA Vikings sign TE – Trey Knox, South Carolina
    beast (21h) : Kitchen was all high from Miami, he was more lucky than talented in 2022 and it showed in 2023
    beast (21h) : Reportedly Packers have UDFAs Jennings and Jones
    beast (21h) : OL – Donovan Jennings, USF OT – Trente Jones, Michigan
    TheKanataThrilla (21h) : Interesting draft. A bit shocked that we didn't select an early CB. Definitely have Safety help. Pretty happy overall.
    dhazer (27-Apr) : wow the last 2 picks are really stupid and probably will be special teams players Top 10 draft pick next year book it
    TheKanataThrilla (27-Apr) : I think he ended up with a terrible RAS score
    dhazer (27-Apr) : Anyone know what went on with Kitchens from Florida? At 1 point he was to be the Packers 1st round and he is way down the board now
    Martha Careful (27-Apr) : Z, could you please combine my thread with yours please. I obviously did not see it when I Created it
    Martha Careful (26-Apr) : Re: 'Kool-Aid' McKinstry. Other than Icky Woods, has there ever been a good NFLer with a childish nickname?
    Martha Careful (26-Apr) : Packers looking to trade up
    Martha Careful (26-Apr) : Flag?
    Martha Careful (26-Apr) : Sag?
    Nonstopdrivel (26-Apr) : It rhymes with "bag."
    beast (26-Apr) : Family? That's Deadpool's F word
    Nonstopdrivel (26-Apr) : Not THAT f-word.
    Zero2Cool (26-Apr) : fuck
    beast (25-Apr) : 49ers are Cap Tight
    beast (25-Apr) : Fuck
    Mucky Tundra (25-Apr) : Kanata, I will be when I'm on my lunch later
    TheKanataThrilla (25-Apr) : Love you NSD
    Nonstopdrivel (25-Apr) : Huh. I guess the F-word is censored in this fan shout.
    Nonstopdrivel (25-Apr) : Anyone who doesn't hang out in the chat probably smokes pole.
    TheKanataThrilla (25-Apr) : GoPackGo Thinking CB is the pick tonight
    TheKanataThrilla (25-Apr) : Anyone hanging out in the chat tonight?
    Zero2Cool (25-Apr) : whoa...49ers have had trade conversations about both Deebo Samuel and Brandon Aiyuk
    Zero2Cool (25-Apr) : I hope they take a Punter at 9th overall. Be bold!
    Mucky Tundra (25-Apr) : I may end up eating those words but I think they need a lot more talent then their 4 picks can provide
    Mucky Tundra (25-Apr) : I really hope they stand pat and Draft a WR
    Mucky Tundra (25-Apr) : @DMRussini
    Mucky Tundra (25-Apr) : The Chicago Bears are very open for business at 9 and telling teams they are ready to move for the right price, per source
    buckeyepackfan (24-Apr) : Lions extend Penei Soul 4yrs - 112mil
    buckeyepackfan (24-Apr) : Lions extend St. Brown 4 years 120mil and
    Mucky Tundra (24-Apr) : Now look, trading up to 13 to take a TE might not seem like a good idea later but it will be later!
    dfosterf (24-Apr) : (Your trade up mock post)
    dfosterf (24-Apr) : Mucky- The only thing fun to watch would be me flipping the f out if Gute goes up to 13 and grabs Brock Bowers, lol
    beast (24-Apr) : DT Byron Murphy II, Texas... whom some believe is the next Aaron Donald (or the closest thing to Donald)
    Zero2Cool (24-Apr) : What? And who?
    Mucky Tundra (24-Apr) : *sad Mucky noises*
    Mucky Tundra (24-Apr) : @JoeJHoyt Murphy said he’s been told he won’t slide past pick No. 16.
    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
    37m / Green Bay Packers Talk / beast

    2h / Feedback, Suggestions and Issues / Zero2Cool

    3h / Green Bay Packers Talk / Mucky Tundra

    3h / Green Bay Packers Talk / Martha Careful

    3h / Green Bay Packers Talk / Martha Careful

    3h / Green Bay Packers Talk / Martha Careful

    3h / Green Bay Packers Talk / Martha Careful

    3h / Green Bay Packers Talk / Martha Careful

    3h / Green Bay Packers Talk / Martha Careful

    4h / Green Bay Packers Talk / Zero2Cool

    4h / Green Bay Packers Talk / greengold

    9h / Green Bay Packers Talk / bboystyle

    16h / Green Bay Packers Talk / Mucky Tundra

    27-Apr / Green Bay Packers Talk / beast

    27-Apr / Green Bay Packers Talk / Mucky Tundra

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