Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2013
    Posts
    125
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question echoing out datafield is blank?!

    Please help, in my database, I have 3 data fields in a table called 'sitesettings'

    SettingsID, SiteName, SiteTel


    I am trying to echo out SiteName, I have added a test value but it's not spurting it out, please help?!


    PHP Code:
    <?php 
    session_start
    ();
    mysql_connect("localhost""root""root");
    mysql_select_db("dhs_dhs");


    $settingsquery "SELECT * FROM sitesettings";
    $settingsresult mysql_query($settingsquery);

    ?>


    <?php echo $settingsresult['SiteName']; ?>

  • #2
    Regular Coder
    Join Date
    Apr 2013
    Posts
    125
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I have also tried:

    PHP Code:

    <?php
    $con
    =mysqli_connect("localhost","root","root","dhs_dhs");
    // Check connection
    if (mysqli_connect_errno())
      {
      echo 
    "Failed to connect to MySQL: " mysqli_connect_error();
      }

    $result mysqli_query($con,"SELECT * FROM sitesettings");

    while(
    $row5 mysqli_fetch_array($result))
      {
      
    $sitename $row5['SiteName'];
      }

    mysqli_close($con);
    ?> 

    <?php echo $sitename?>
    still nothing?!

    Also, would like to echo out errors so I can debug?

  • #3
    Regular Coder
    Join Date
    Apr 2013
    Posts
    125
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Thumbs up

    sorted!

  • #4
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    709
    Thanks
    20
    Thanked 84 Times in 84 Posts
    what do you get when you run

    SELECT * FROM sitesettings

    in PHPMYADMIN?
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month


  •  

    Posting Permissions

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