SHARE
TWEET

Untitled

a guest Jun 15th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     $db_user = "chef";
  3.     $db_pass = "souflet";
  4.     $db_host = "localhost";
  5.     $db_name = "mhabrowa_connusers";
  6.     $dsn = "mysql:dbname=$db_name;host=$db_host";
  7.     try{
  8.             $db = new PDO($dsn, $db_user, $db_pass);
  9.         }catch(PDOException $e){
  10.             die("Could not connect to the database\n");
  11.         }
  12.     echo "\$db created.<br>";
  13. ?>
  14.  
  15. <?php
  16.     require ("dblogin.php");
  17.     echo "dblogin.php loaded.<br>";
  18.     $selection = $db -> prepare("SELECT ? FROM ? WHERE ? = ?");
  19.     echo "wild select prepared<br>";
  20.         $sql="UPDATE `info` SET ? = ? WHERE `info`.`primarykey` = ?";
  21.     $insertInfo = $db -> prepare($sql);
  22.     echo "info insert prepared<br>";
  23. ?>
  24.  
  25. <?php
  26.     require("../funct/dbstatements.php");
  27.     /*Listings*/
  28.     $phpList=array(
  29.         //Note: $_GET may be better for security reasons. $_POST may work
  30.         0 => $_REQUEST['abuse'],
  31.         ...
  32.         52=> $_REQUEST['veterans']
  33.     );
  34.  
  35.     $sqlList=array(
  36.         //Note: $_GET may be better for security reasons. $_POST may work
  37.         0 => 'abuse',
  38.         ...
  39.         52=> 'veterans'
  40.     );
  41.     $user = "cat";
  42.     echo "<pre>";
  43.     foreach($phpList as $key => $var){
  44.             echo $key;
  45.             echo ": ";
  46.             echo $sqlList[$key];
  47.             if (isset($phpList[$key]) && $phpList[$key] =='1'){
  48.                 $myCheckbox = 1;
  49.             }else{
  50.                 $myCheckbox = 0;
  51.             }
  52.             echo " = ";
  53.             echo $myCheckbox;
  54.             $insertInfo -> execute(array($sqlList[$key], $myCheckbox, $user));
  55.             print_r($insertInfo -> errorInfo());
  56.     }
  57.     echo "</pre>";
  58. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top