Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/01/2021 in all areas

  1. I don't see any PHP in there. I'm tempted to issue a warning for use of foul language 😀 Please use code button when posting code.
    1 point
  2. Rinse and repeat - exchanging u1 and u2 $new = []; foreach ($array as $a) { if (!isset($new[$a['u1']])) { $new[$a['u1']] = []; } $new[$a['u1']][] = $a['u2']; //repeat exchanging u1 and u2 if (!isset($new[$a['u2']])) { $new[$a['u2']] = []; } $new[$a['u2']][] = $a['u1']; } // // Output $new array // echo '<pre>'; foreach ($new as $u1 => $u2s) { printf('<br><b>%4d</b> | ', $u1); foreach ($u2s as $u) { printf('%4d &vellip;', $u); } }
    1 point
  3. Not necessarily... DATA +-------+-------+ | fruit | price | +-------+-------+ | grape | 5.00 | | melon | NULL | +-------+-------+ Code (PDO) $var = $db->query("select price from fruit where fruit = 'grape'")->fetch()['price'] ?? ''; echo '<br>Grape: ' . $var; $var = $db->query("select price from fruit where fruit = 'melon'")->fetch()['price'] ?? ''; echo '<br>Melon: ' . $var; $var = $db->query("select price from fruit where fruit = 'lemon'")->fetch()['price'] ?? ''; echo '<br>Lemon: ' . $var; Output (No exceptions were thrown during the running of this code) Grape: 5.00 Melon: (why no price?) Lemon: (why no price?)
    1 point
  4. Place your credentials in a file outside of DocRoot and read that file from the PHP connection script. Make sure you set permissions so only the user running httpd (usually 'apache' on Linux) can access that file.
    1 point
This leaderboard is set to New York/GMT-05:00
×
×
  • Create New...

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.