#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2006
    Posts
    168
    Rep Power
    22

    Need help with output the data to html


    Hi guys,

    I have stored the data in mysql database where I can ouput them in php using with this following code:

    Code:
    <?php
    session_start();
      define('DB_HOST', 'localhost');
      define('DB_USER', 'mydbusername');
      define('DB_PASSWORD', 'mydbpassword');
      define('DB_DATABASE', 'mydbname');    
    
      $errmsg_arr = array();
      $errflag = false;
      $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    
       if(!$link)
      {
        die('Failed to connect to server: ' . mysql_error());
      }
      $db = mysql_select_db(DB_DATABASE);
    
      if(!$db)
      {
        die("Unable to select database");
      }
    
    
      if($errflag)
      {
        $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
        echo implode('<br />',$errmsg_arr);
      }
      else
      {
        $qrytable1="SELECT id, channels FROM tvguide";
        $result1=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error());
    
         while ($row = mysql_fetch_array($result1))
        {
          echo "</br>";
          echo "<td>".$row['channels']."</td>";
          echo "</br>";
        }
      }
    ?>


    I want to know how I can output the data from php to html, do you know how?

    if so please can you help me.

    thanks in advance.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,571
    Rep Power
    595
    1) Enclose your code in [ PHP ] tags. See the sticky at the top of this forum.
    2) Do not use the deprecated MySQL extensions, switch to PDO.
    3) It appears you are on the right track. Repost your new code and explain what the problem is and/or what error you are getting.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2006
    Posts
    168
    Rep Power
    22
    I have enclose in php, so what is your problem?

    why could you not post the code of PDO?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,571
    Rep Power
    595
    1) No you used [ CODE ] tags when you posted not [ PHP ]. You obviously didn't bother to read the sticky.

    2) This is the PHP help forum not the hire a programmer forum. If you want someone to write the code for you, repost in that forum. Here you are expected to do the work and we help you over the humps and suggest better techniques.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.

IMN logo majestic logo threadwatch logo seochat tools logo