/    Sign up×
Community /Pin to ProfileBookmark

table nor forming at phpmyadmin niether showing any error

[code=php]<?php
$rootpath=’C:Userstest’;
$fileinfos=new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($rootpath)
);
foreach($fileinfos as $pathname)
{
if (!$pathname->isfile()) continue;
if ( strrpos($pathname,’_’) == true)
{
$file = ‘C:Userspathname.txt’;
$f = @fopen($file, “r+”);
if ($f !== false) {
ftruncate($f, 0);
fclose($f);
}
$current = file_get_contents($file);
// Append a new person to the file
$current .= $pathname;
echo “file name is:”.$current;
// Write the contents back to the file
file_put_contents($file, $current);
//print ‘Copy not exists’.$pathname.'<br/>’; open
$file1=explode(“\”,$pathname);
$file2=explode(“.”,$file1[5]);
$tname=”CV_”.$file2[0];
echo “the table name is : “. $tname;
FillCVdatabase($pathname, $tname);
$plotfile = ‘C:xampphtdocscv.txt’;
$f1 = @fopen($plotfile, “r+”);
if ($f1 !== false) {
ftruncate($f1, 0);
fclose($f1);
}
$currentplotfile=file_get_contents($plotfile);
$plotfiledata=file_get_contents($pathname);
// Append a new person to the file
$currentplotfile .= $plotfiledata;
// Write the contents back to the file
file_put_contents($plotfile, $plotfiledata);
//echo “tablename:”.$tname; open

$filenameforhtmltable=$pathname;
//$plotdir=mkdir(“C:xampphtdocsplotsdirectory”, 0700);
$output = shell_exec(“root -l -q cv_root.C”);
echo “<pre>”.var_export($output, true).”</pre>”;
}
}
Function FillCVdatabase($filename, $tablename)
{
$db = new mysqli(“localhost”,””,””,”test”);
$handle = fopen($filename, ‘r’);
//————————————————-first row
$data = fgets($handle);
$fields = explode(“t” , $data);
//—————————————————————————second row
$data = fgets($handle);
$values = explode(“t” , $data);
$vc = count($values);
$vi=0;
$val=””;
while($vi < ($vc-1))
{
$val .= “‘”.$values[$vi].”‘,”;
$vi++;
}
$val .= “‘”.$values[$vi].”‘”;
//————————— database insert
//print “insert into exp_info values ($val);”;
$db->query( “insert into cv_info values (NULL,$val);”);

//———————————-3rd row
$data = fgets($handle);
$row = explode(“t” , $data);
$fc = count($row);
$fi=0;
$fname=””;
$fv=””;
while($fi < ($fc – 1))
{
//print $fi.”:”.$row[$fi]. “(“. strlen($row[$fi]).”)” .”t”;
$fname.= “f”.($fi).” varchar(50),”;
$fv.=”‘”.$row[$fi].”‘,”;
$fi++;
}
$fname.= “f”.($fi).” varchar(50)”;
$fv.=”‘”.$row[$fi].”‘”;

print “create table $tablename ($fname);”;
$db->query(“create table $tablename ($fname);”);
$db->query(“insert into $tablename values ($fv);”);

//—————————– 3rd row +
$i=1;
while (false === feof($handle) )
{

$data = fgets($handle);
$row = explode(“t” , $data);
$fc = count($row);
$fi=0;
$fv=””;

while($fi < ($fc – 1))
{

$fv.=”‘”.$row[$fi].”‘,”;
$fi++;
}

$fv.=”‘”.$row[$fi].”‘”;

$db->query(“insert into $tablename values ($fv);”);
$i++;

}
//—————————————

fclose($handle);
$db->close();
}

?>[/code]

the table with tablename is not showing at phpmyadmin, what can be the possible cause of this?
kindly avail a solution.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmFeb 11.2016 — Rather than try to understand your complex code, how about if you turn on php error checking and see if the script has any faults?
×

Success!

Help @rock24 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...