Jump to content

dodgeitorelse3

Members
  • Content count

    108
  • Joined

  • Last visited

  • Days Won

    2

dodgeitorelse3 last won the day on January 29

dodgeitorelse3 had the most liked content!

Community Reputation

4 Neutral

About dodgeitorelse3

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  • Location
    Massena, NY
  1. dodgeitorelse3

    sort multi-dimensional array by name

    Ok, thank you
  2. dodgeitorelse3

    sort multi-dimensional array by name

    Grrrrrr..... Just when I think I have it figured out you folks throw out such sweet, short and simple solutions! Thank you very much I can't find where to mark this thread as solved, please mark it for me, thank you
  3. dodgeitorelse3

    sort multi-dimensional array by name

    Thank you, I will look into that. It may be easier than this. I went back to the php page I linked to and tried a sample that was there and got the result I was looking for. Now I have a headache $mapname='mapname1'; $type="pvp"; $beta="y"; $final="n"; $modded="n"; $classification="land"; $sf="n"; $tod="dawn"; $weather="fog"; $es2="y"; $mapname2='mapname2'; $type2="pvp"; $beta2="n"; $final2="y"; $modded2="n"; $classification2="sea"; $sf2="n"; $tod2="night"; $weather2="clear"; $es22="n"; $mapname3='mapname3'; $type3="pvp"; $beta3="y"; $final3="n"; $modded3="y"; $classification3="air"; $sf3="y"; $tod3="day"; $weather3="rain"; $es23="n"; $tadminlist["pvp"] = array ( ); array_push($tadminlist["pvp"], array ("name" => $mapname, "type" => $type, "beta" => $beta, "final" => $final, "modded" => $modded, "classification" => $classification, "sf" => $sf, "tod" => $tod, "weather" => $weather, "es2" => $es2)); array_push($tadminlist["pvp"], array ("name" => $mapname2, "type" => $type2, "beta" => $beta2, "final" => $final2, "modded" => $modded2, "classification" => $classification2, "sf" => $sf2, "tod" => $tod2, "weather" => $weather2, "es2" => $es22)); array_push($tadminlist["pvp"], array ("name" => $mapname3, "type" => $type3, "beta" => $beta3, "final" => $final3, "modded" => $modded3, "classification" => $classification3, "sf" => $sf3, "tod" => $tod3, "weather" => $weather3, "es2" => $es23)); echo "<pre>"; print_r($tadminlist); echo "</pre>"; echo "line = mapname, type, beta, final, modded, classification, sf, tod, weather, es2<br /><br />"; $i =0; foreach($tadminlist["pvp"] as $tlist) { echo $tadminlist['pvp'][$i]['name'].", ". $tadminlist['pvp'][$i]['type'].", ". $tadminlist['pvp'][$i]['beta'].", ". $tadminlist['pvp'][$i]['final'].", ". $tadminlist['pvp'][$i]['modded'].", ". $tadminlist['pvp'][$i]['classification'].", ". $tadminlist['pvp'][$i]['sf'].", ". $tadminlist['pvp'][$i]['tod'].", ". $tadminlist['pvp'][$i]['weather'].", ". $tadminlist['pvp'][$i]['es2']."<br /><br />"; $i++; } echo "sort test<br />"; $data = $tadminlist["pvp"]; function array_orderby() { $args = func_get_args(); $data = array_shift($args); foreach ($args as $n => $field) { if (is_string($field)) { $tmp = array(); foreach ($data as $key => $row) $tmp[$key] = $row[$field]; $args[$n] = $tmp; } } $args[] = &$data; call_user_func_array('array_multisort', $args); return array_pop($args); } // Pass the array, followed by the column names and sort flags $sorted = array_orderby($data, 'name', SORT_DESC); $a=0; foreach($sorted as $tlist) { echo $sorted[$a]['name'].", ". $sorted[$a]['type'].", ". $sorted[$a]['beta'].", ". $sorted[$a]['final'].", ". $sorted[$a]['modded'].", ". $sorted[$a]['classification'].", ". $sorted[$a]['sf'].", ". $sorted[$a]['tod'].", ". $sorted[$a]['weather'].", ". $sorted[$a]['es2']."<br /><br />"; $a++; } echo "<pre>"; print_r($sorted); echo "</pre>"; and my output is Array ( [pvp] => Array ( [0] => Array ( [name] => mapname1 [type] => pvp [beta] => y [final] => n [modded] => n [classification] => land [sf] => n [tod] => dawn [weather] => fog [es2] => y ) [1] => Array ( [name] => mapname2 [type] => pvp [beta] => n [final] => y [modded] => n [classification] => sea [sf] => n [tod] => night [weather] => clear [es2] => n ) [2] => Array ( [name] => mapname3 [type] => pvp [beta] => y [final] => n [modded] => y [classification] => air [sf] => y [tod] => day [weather] => rain [es2] => n ) ) ) line = mapname, type, beta, final, modded, classification, sf, tod, weather, es2 mapname1, pvp, y, n, n, land, n, dawn, fog, y mapname2, pvp, n, y, n, sea, n, night, clear, n mapname3, pvp, y, n, y, air, y, day, rain, n sort test mapname3, pvp, y, n, y, air, y, day, rain, n mapname2, pvp, n, y, n, sea, n, night, clear, n mapname1, pvp, y, n, n, land, n, dawn, fog, y Array ( [0] => Array ( [name] => mapname3 [type] => pvp [beta] => y [final] => n [modded] => y [classification] => air [sf] => y [tod] => day [weather] => rain [es2] => n ) [1] => Array ( [name] => mapname2 [type] => pvp [beta] => n [final] => y [modded] => n [classification] => sea [sf] => n [tod] => night [weather] => clear [es2] => n ) [2] => Array ( [name] => mapname1 [type] => pvp [beta] => y [final] => n [modded] => n [classification] => land [sf] => n [tod] => dawn [weather] => fog [es2] => y ) ) Now to take what I need and put it into my actual page of code where it is to be used. I will post back when I test what you suggested. Thank you for the direction (and hint) as well as your time.
  4. dodgeitorelse3

    sort multi-dimensional array by name

    I have an array that is created using the following code: $mapname='mapname1'; $type="pvp"; $beta="y"; $final="n"; $modded="n"; $classification="land"; $sf="n"; $tod="dawn"; $weather="fog"; $es2="y"; $mapname2='mapname2'; $type2="pvp"; $beta2="n"; $final2="y"; $modded2="n"; $classification2="sea"; $sf2="n"; $tod2="night"; $weather2="clear"; $es22="n"; $mapname3='mapname3'; $type3="pvp"; $beta3="y"; $final3="n"; $modded3="y"; $classification3="air"; $sf3="y"; $tod3="day"; $weather3="rain"; $es23="n"; $tadminlist["pvp"] = array ( ); array_push($tadminlist["pvp"], array ("name" => $mapname, "type" => $type, "beta" => $beta, "final" => $final, "modded" => $modded, "classification" => $classification, "sf" => $sf, "tod" => $tod, "weather" => $weather, "es2" => $es2)); array_push($tadminlist["pvp"], array ("name" => $mapname2, "type" => $type2, "beta" => $beta2, "final" => $final2, "modded" => $modded2, "classification" => $classification2, "sf" => $sf2, "tod" => $tod2, "weather" => $weather2, "es2" => $es22)); array_push($tadminlist["pvp"], array ("name" => $mapname3, "type" => $type3, "beta" => $beta3, "final" => $final3, "modded" => $modded3, "classification" => $classification3, "sf" => $sf3, "tod" => $tod3, "weather" => $weather3, "es2" => $es23)); echo "<pre>"; print_r($tadminlist); echo "</pre>"; echo "line = mapname, type, beta, final, modded, classification, sf, tod, weather, es2<br /><br />"; $i =0; foreach($tadminlist["pvp"] as $key => $tlist) { echo $tadminlist['pvp'][$i]['name'].", ". $tadminlist['pvp'][$i]['type'].", ". $tadminlist['pvp'][$i]['beta'].", ". $tadminlist['pvp'][$i]['final'].", ". $tadminlist['pvp'][$i]['modded'].", ". $tadminlist['pvp'][$i]['classification'].", ". $tadminlist['pvp'][$i]['sf'].", ". $tadminlist['pvp'][$i]['tod'].", ". $tadminlist['pvp'][$i]['weather'].", ". $tadminlist['pvp'][$i]['es2']."<br /><br />"; $i++; } The output is: Array ( [pvp] => Array ( [0] => Array ( [name] => mapname1 [type] => pvp [beta] => y [final] => n [modded] => n [classification] => land [sf] => n [tod] => dawn [weather] => fog [es2] => y ) [1] => Array ( [name] => mapname2 [type] => pvp [beta] => n [final] => y [modded] => n [classification] => sea [sf] => n [tod] => night [weather] => clear [es2] => n ) [2] => Array ( [name] => mapname3 [type] => pvp [beta] => y [final] => n [modded] => y [classification] => air [sf] => y [tod] => day [weather] => rain [es2] => n ) ) ) line = mapname, type, beta, final, modded, classification, sf, tod, weather, es2 mapname1, pvp, y, n, n, land, n, dawn, fog, y mapname2, pvp, n, y, n, sea, n, night, clear, n mapname3, pvp, y, n, y, air, y, day, rain, n I would like to sort the foreach loop by name in descending order. I read the page at http://php.net/manual/en/function.array-multisort.php but was unable to figure it out. Could someone give me some direction please?
  5. Student was given assignment to RTFM. Student was graded on assignment using a simple question/answer sheet. Teacher graded students question/answer sheet and put grade into a variable called $student_grade < if($student_grade === "Passed"){ //student passed question/answer sheet so.... echo "Great job, you RTFM"; } else{ //student failed question/answer sheet so.... echo "You did not RTFM"; } >
  6. dodgeitorelse3

    Problems with line breaks in a multiplication table

    I stand corrected 😁
  7. dodgeitorelse3

    Problems with line breaks in a multiplication table

    Change the th to td
  8. dodgeitorelse3

    music fonts required

    You said you have been using inkscape so why not try it yourself to see if it opens the file you are questioning? You would have had an answer in the time it took you to post and wait for a reply. 😎
  9. dodgeitorelse3

    PHP code will not process form submission from website

    I think your require vendor file needs to have ../ instead of ./
  10. dodgeitorelse3

    Code for Year Count

    I have 64 bit computer but I failed a y2k38 test returned a date in 1969 lol, guess I'll be finding solution to this. Of course it is using $date = '2040-02-01'; $format = 'l d F Y H:i'; $mydate1 = strtotime($date); echo '<p>', date($format, $mydate1), '</p>'; but when I use $date = '2040-02-01'; $format = 'l j F Y H:i'; $mydate2 = new DateTime($date); echo '<p>', $mydate2->format($format), '</p>'; I get my expected future date
  11. dodgeitorelse3

    PHP code will not process form submission from website

    in original post you have action="submiiresults.php" is it really submiiresults or submitresults?
  12. dodgeitorelse3

    can't set width and height of logo in CSS but can in html

    ginerjm was asking you where you are calling the css from, yes you showed the css code but how is your page to know to use that css code
  13. dodgeitorelse3

    Not getting post count in my forum

    About all I can tell from the image is that you are correct, count is not showing. Maybe show us your code and we could possibly help figure it out.
  14. dodgeitorelse3

    Variable won’t set to GET variable?

    no need for semi colon at end of echo ?
  15. dodgeitorelse3

    FORM not posting - help me, please

    should mysql_connect really have quotes around variables?
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.