Results 1 to 3 of 3

Thread: ping mysql query result

  1. #1
    Join Date
    Jan 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb ping mysql query result

    deal gurus,
    I am new in PHP and mysql, my question have three parts,
    Q1- i have php script to show ip from mysql database field "IPaddress" and its working fine.
    script is:
    <?PHP

    $user_name = "root";
    $password = "";
    $database = "gfghoipmac";
    $server = "127.0.0.1";
    $db_handle = mysql_connect($server, $user_name, $password);
    $db_found = mysql_select_db($database, $db_handle);

    if ($db_found) {

    $SQL = "SELECT * FROM `ip` LIMIT 353, 1 ";
    $result = mysql_query($SQL);

    while ($db_field = mysql_fetch_assoc($result)) {
    print $db_field['IPaddress'] ;
    }
    mysql_close($db_handle);

    }
    else {
    print "Database NOT Found ";
    mysql_close($db_handle);
    }
    ?>

    Q2- second I have php script to ping an IP address and show "green.png file if ping successfuly" or "red.png if ping unsuccessfully" and this working fine.
    script is:
    <?php
    $str = exec("ping -n 1 -w 2000 8.8.8.8", $input, $result);
    if ($result == 0){
    echo "<img src=\"green.png\">";
    }else{
    echo "<img src=\"red.png\">";
    }
    ?>

    my main question is 3rd.
    Q3- I want to use mysql result IP address in php ping script plzz help me in this, I have tried alot, took too much GOOGLE but still unsuccessful.

    please help.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Have you looked into PHP's curl functions? They will help, I think.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Oct 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi
    Have you able to solved this matter,im also trying to achieve the same thing ,it will be great help if can help

    Thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •