Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db_user = "chef";
- $db_pass = "souflet";
- $db_host = "localhost";
- $db_name = "mhabrowa_connusers";
- $dsn = "mysql:dbname=$db_name;host=$db_host";
- try{
- $db = new PDO($dsn, $db_user, $db_pass);
- }catch(PDOException $e){
- die("Could not connect to the database\n");
- }
- echo "\$db created.<br>";
- ?>
- <?php
- require ("dblogin.php");
- echo "dblogin.php loaded.<br>";
- $selection = $db -> prepare("SELECT ? FROM ? WHERE ? = ?");
- echo "wild select prepared<br>";
- $sql="UPDATE `info` SET ? = ? WHERE `info`.`primarykey` = ?";
- $insertInfo = $db -> prepare($sql);
- echo "info insert prepared<br>";
- ?>
- <?php
- require("../funct/dbstatements.php");
- /*Listings*/
- $phpList=array(
- //Note: $_GET may be better for security reasons. $_POST may work
- 0 => $_REQUEST['abuse'],
- ...
- 52=> $_REQUEST['veterans']
- );
- $sqlList=array(
- //Note: $_GET may be better for security reasons. $_POST may work
- 0 => 'abuse',
- ...
- 52=> 'veterans'
- );
- $user = "cat";
- echo "<pre>";
- foreach($phpList as $key => $var){
- echo $key;
- echo ": ";
- echo $sqlList[$key];
- if (isset($phpList[$key]) && $phpList[$key] =='1'){
- $myCheckbox = 1;
- }else{
- $myCheckbox = 0;
- }
- echo " = ";
- echo $myCheckbox;
- $insertInfo -> execute(array($sqlList[$key], $myCheckbox, $user));
- print_r($insertInfo -> errorInfo());
- }
- echo "</pre>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement