This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$username="root"; $password=""; $database="exam_codes"; | |
$con = mysql_connect("localhost",$username,$password) or die( "Unable to Connect database"); | |
mysql_select_db($database,$con) or die( "Unable to select database"); | |
$ShowTable = "blogs"; | |
$sql = mysql_query("SELECT * FROM `$ShowTable` LIMIT 11"); | |
$row = mysql_fetch_assoc($sql); | |
// show headings alon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_POST['submitcsv'])){ | |
$file = $_FILES['file']['tmp_name']; | |
$handle = fopen($file,"r"); | |
while($file = fgetcsv($handle,1000, ",")){ | |
$sql = mysql_query("INSERT INTO `table`(`value-1`, `value-2`) VALUES ('$file[0]','$file[1]')"); | |
}; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ar = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); | |
$ar_key = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); | |
//URLs | |
$wer=5; //How Many Parts? | |
$count=count($ar); //Count Values | |
$prts=$count/$wer; //How many values comes in every Part | |
$i = 0; | |
$plus=$prts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$file = fopen("_file.csv","w"); | |
foreach ($vals as $val) | |
{ | |
$result = array($val[0],$val[1],$val[2]); | |
fputcsv($file,$result); | |
} | |
fclose($file); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$username="root"; $password=""; $database="exam_codes"; | |
$con = mysql_connect("localhost",$username,$password) or die( "Unable to Connect database"); | |
mysql_select_db($database,$con) or die( "Unable to select database"); | |
// Table Name that you want | |
// to export in csv | |
$ShowTable = "blogs"; | |
$FileName = "_export.csv"; | |
$file = fopen($FileName,"w"); |