Sourabh Kumar Sourabh Kumar - 1 year ago 79
PHP Question

How to make a HTML private chatting website?

Starting from beginning, I'm making a private chatting site, which is lightweight, simple with some or no animation. I'm making it for private chats (2 persons only) and I'm not understanding some topics.

Here are my questions:

1: Can we pick some value from existing files? Like character/word from file 'main.txt' on line number 10

2: How can we delete a table from database by SQL commands .. Like clicking a button on HTML form makes delete that table...

3: Displaying contents of 2 or more HTML files in a single index.html file... The

tag isn't working well with me...

Answer Source

You could use file function which reads entire file into an array

$filename = 'file.txt';
$data = file($filename);
foreach ($data as $line_num=>$line)
   echo 'Line # <b>'.$line_num.'</b>:'.$line.'<br/>;


The SQL DROP TABLE statement is used to remove a table definition and all data, indexes, triggers, constraints, and permission specifications for that table.

NOTE: You have to be careful while using this command because once a table is deleted then all the information available in the table would also be lost forever.

DROP TABLE table_name;

(UPDATE) If I understood correctly I believe you can follow this road for showing access to other links on your main site,using function below

function showHTMLNavigationMenu() {
    $menu = array(
        'index.php' => 'MAIN SITE',
        'site_1.php' => 'Link to site 1',
        'site_2.php' => 'Link to site 2',
        'site_3.php' => 'Link to site 3',
        'site_4.php' => 'Link to site 4'
    $links_arr = array();
    foreach ($menu as $link => $header) {
        $links_arr[] = '<a href="' . $link . '">' . $header . '</a>';

    echo h2('Izbornik');
    echo implode(' <br> ', $links_arr);
    echo '<hr/>';

You'll get something like this enter image description here

Hope it helps...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download