File "insert_db.php"

Full Path: /home/analogde/www/Outlook/Fusion/Picker02/insert_db.php
File size: 2.85 KB
MIME-type: text/x-php
Charset: utf-8

<?php

	include("database.php");
	
	$lili = db_connexion();
	
	//print_r($lili);

	//echo " ++++++ " .$conn;	
	
	// Read the JSON file  
	$json = file_get_contents('data.json'); 
  
	// Decode the JSON file 
	$json_data = json_decode($json,true); 
  
	// Display data 
	//echo "<pre>";
	//print_r($json_data); 
	//echo "</pre>";
  
	//print_r($lili);
	
	
	DBGetAllTables($lili);
	echo "<br>";
	echo "<br>";
	echo "<br>";

	$exists = "wp62_wfco_connectors";
	$exists = "aaa_table";
	table_exists($lili, $exists);
	
	
	CreateTable($lili);
	
	//Insert($lili, "aaaMyGuests");
	
	
	echo "TRACE1";
	echo "<br>";
	
	
	RecordExists($lili, "aaaMyGuests", "John");
	
	echo "TRACE2";
	echo "<br>";
	
	/*for ($i = 0; $i < count($json_data); $i++) 
	{
		echo $json_data[$i][0] ." ****** " .$json_data[$i][1] ;
		echo "<br>";
	}*/
/*
	$exists = "client";
	
echo "alpha";
	
$result = $conn->query("SHOW TABLES LIKE '$exists'");

echo $result;

echo "jhjjkhjkkjk";

if($result->num_rows == 1) {
  echo "Table exists";
} else {
  echo "Table does not exist";
}


*/

//	$exists = "wp62_wfco_connectors";

//	table_exists($exists);
/*
$result = $conn->query("SHOW TABLES LIKE '$exists'");

if($result->num_rows == 1) {
  echo "Table exists";
} else {
  echo "Table does not exist";
}

	
	//  sql = "INSERT INTO users (name, email, password) VALUES (?,?,?)";
	
/*
	$str_json = file_get_contents('php://input'); //($_POST doesn't work here)
	$response = json_decode($str_json, true); // decoding received JSON to array

	// json file name 
	//$filename = "transfert.json"; ???
	
	// Read the JSON file in PHP 
	//$data = file_get_contents($filename);  ???
	
	
	//$json = json_encode(array('data' => $array));

//write json to file
	if (file_put_contents("zzzzzdata.json", $str_json))
		echo "JSON file created successfully...";
	else 
		echo "Oops! Error creating json file...";
	
	//echo "----> " .count($response);

	// OK  ABC
	//echo " ----->>> "	.$response[0][0];
	
	// nombre de colonne dans $response[0]
	//echo " ----->>> "	.count($response[0]);
	
	// lecture 
	
	echo "PHP recoit un objet de type " .gettype($response), "</br>";
	
	echo "Nombre de colonne " .count($response), "</br>";
	
	for ($i = 0; $i < count($response); $i++) 
	{
		
	
		/*for ($j = 0; $j < count($response[$i]); $j++) 
		{
			//echo "Nombre de ligne par colonne " .count($response[$j]), "</br>";
		
			echo $response[$i][$j];
			echo "<br>";
		}*/
		
		/*if(empty($response[$i]))
		{ 
			echo "Empty string " .$response[$i]; 
		} 
		else 
		{ 
			echo "Not empty " .$response[$i]; 
		} */
		
	/*	
		
		
		echo $response[$i][0] ." ****** " .$response[$i][1] ;
		echo "<br>";

	}

		//var_dump($response);
	
	// https://www.w3docs.com/snippets/php/save-php-array-to-mysql.html
	
	// serialize
	*/

?>