Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > Databases - MySQL, SQL, Oracle, Access and others
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-04-2007, 05:17 AM   #1 (permalink)
madristaa
Junior Member
 
Join Date: Nov 2007
Posts: 1
Default Problem in inserting in database......Plz help me Plz......

Hello friends i have created a indexer using form. It will accept .htm and .html or actual folders. It will display all the information of the .htm and .html files i.e. metatags and it will count the occurence of the words repeating in that file.

i will be very thankful if you help me

I want you to help me those information to put in database.

The database should contain four tables
1)files containing id_file,name,url -->2 columns
2)file_word containing id_file,id_word-->2 columns
3)words containing id_word,word --->2 columns
4)meta_info containing id_fil e,type,content-->3 columns

I am attaching my code for further queries.

<?PHP
function recursive_directory($dir)
{
$arr = array();
if ($hld = opendir($dir))
{
while (false !== ($file = readdir($hld)))
{
if ($file != "." && $file != "..")
{
if (is_dir($dir. "/" . $file))
{
$arr = array_merge($arr, recursive_directory($dir. "/" . $file));
}
else
{
if((ereg(".html" , $file)) || (ereg(".htm",$file)))
{
$path = $dir . "/" . $file;
$arr[] = realpath($path);
}
}
}
}
closedir($hld);
}
return $arr;
}
function superExplode($string,$st)
{
$i=0;
$arr[$i++]= strtok($string,$st);
while($tok = strtok($st))
$arr[$i++] = $tok;
return $arr;
}
function count_word($url)
{
if($file=file($url))
{
$tags = get_meta_tags($url);
echo "<h1>Meta Information</h1> ";
if(count($tags)!=0)
{
echo "Description: ".$tags['description']."<br>";
echo "Author: ".$tags['author']."<br>";
echo "Keywords: ".$tags['keywords']."<br>";
echo "Generator: ".$tags['generator']."<br>";
}
else
{
echo "No Meta Data<br>";
}

$fetch = implode('',$file);
$fetch = strtolower(strip_tags($fetch));
$arr_tok = superExplode($fetch,"\" ' : , ( ) { } [ ] ; # ? . ! \n -");
sort($arr_tok);

$temp = (array_count_values($arr_tok));
echo"<br>";
echo "<table border='0'><tr><th>Word</th><th>Count</th></tr>";
foreach($temp as $s => $r)
{
if($s!="")
echo "<tr><td>$s</td><td>$r</td></tr>";
}
echo "</table>";
}
else
{
echo "Try Again";
}

}
if(isset($_GET['path']))
{
$path=$_GET['path'];
$array = recursive_directory($path);
for($i=0;$i<count($array);$i++)
{
echo "</br>";
echo"Path&nbsp;&nbsp;:";
echo $array[$i]."<br>";
count_word($array[$i]);
}


}

echo "<html>";
echo "<body>";
echo "<form action=\"test.php\" method=\"get\">";
echo "</br>";
echo "Path of: <input type=\"text\" name=\"path\"/>";

echo "<input type=\"submit\" value=\"Enter\"/>";
echo " </form>";
echo "</body>";
echo "</html>";

?>
madristaa is offline   Reply With Quote
Sponsored Links
Old 12-02-2007, 04:00 AM   #2 (permalink)
websiterepairguys
Junior Member
 
Join Date: Nov 2007
Posts: 8
Default Re: Problem in inserting in database......Plz help me Plz......

Just a matter of these four functions:

mysql_connect
mysql_query
mysql_last_insertid
mysql_close

Please read about them on php.net

Cheers,
Mark
__________________
Visit www.websiterepairguys.com for your website maintenance needs.
websiterepairguys is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 12:55 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums