The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MYSQL not returning Data when using PHP

Discussion in 'cPanel Developers' started by SetLar8, Nov 30, 2010.

  1. SetLar8

    SetLar8 Well-Known Member

    Joined:
    Mar 5, 2004
    Messages:
    60
    Likes Received:
    0
    Trophy Points:
    6
    [SOLVED] MYSQL not returning Data when using PHP

    Using the below code i cannot for the life of me see why im getting nothing returned or even an error. When i copy and run this query exactly in navicat i get 1 result returned yet here i get nothing. Im on a VPS with the lastest versions of Apache, MYSQL and PHP. Does anyone know why this would be the case or any extensions that could be cauing this?

    Any help in resolving this would be much apreciated.

    PHP:
    <?php

    error_reporting
    (-1);

    include(
    'inc/config.php');

    $connection  mysql_connect($sqlhost$sqluser$sqlpass) or die('Unable to connect to MYSQL Server.');
    $db             mysql_select_db($sqldb$connection) or die('Unable to connect to MYSQL Database');

    $sql         "SELECT * FROM `tblpage`;";
    $sql_query   mysql_query($sql$connection) or die('Unable to execute query: ' $sql);

    echo 
    mysql_error();

    if (!
    $sql_query) {
        die(
    "Query error! query: $sql<br />Error: " mysql_error());
    }


    $row          mysql_fetch_assoc($sql_query);

    print_r($row);

    ?>
     
    #1 SetLar8, Nov 30, 2010
    Last edited: Nov 30, 2010
Loading...

Share This Page