Jump to content

britus

New Members
  • Content count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About britus

  • Rank
    Newbie

Profile Information

  • Gender
    Male
  • Location
    Texas
  • Interests
    Learning anything that's worth learning
  1. britus

    while loop returns NULL

    Hi Barand, Now I feel like an idiot. I had (now deleted) a couple of very similarly named db,s. I was connected to the wrong one. PDO, yes definitely I want to do that but as this course is using mysqli, I want to get the thing running first then I will use that to figure out PDO. Trying to not over complicate myself. Thanks for putting me right.
  2. britus

    Please, look at design of my site

    In terms of design, it needs to be responsive. Try Bootstrap for ready-made code or use Flexbox for your css if you roll your own. As you will be holding personal information (Login and other forms) it needs to be secured with an SSL certificate.Your host will set you up. If your host provides LetsEncrypt for SSL, use it. It's free. For the backend, if it functions as you want, then its ok. (depending on who has access to it)
  3. britus

    while loop returns NULL

    Hi, I am trying to expand my very limited PHP by building a CMS. It's all new to me so please be courteous with your replies 😊 I little history of my problem. I am running xampp on a windows 10 running php 5.6.38 I have taken two video courses and on each I got stumped halfway through with a very similar problem. The first was using mysql which I was converting to mysqli until I run into a problem. I then started a new course which used mysqli but it was from 2014 so not sure which version of PHP or if it would even matter. I am copying everything word for word and even downloaded the course file on the first one and still got the same problem so I'm wondering if there is something wrong with my setup - config?. The problem. I am trying to pull data from the database using a while loop. Each time it returns NULL. This is the code: <?php error_reporting(E_ALL); ini_set('display_errors',1); include("includes/database.php"); include("includes/header.php"); if ($connection) { echo "Great, we're connected to the database<br><br>"; }else { echo "Bummer, it didn't connect to the database!"; } $query = "SELECT * FROM categories"; $result_set = mysqli_query($connection, $query) ; if (!$result_set) { die("Query Failed".msqli_error($connection)); } while ($row = mysqli_fetch_array($result_set)) { echo $row['cat_title']; } var_dump($result_set); ?> This is the response: Great, we're connected to the database object(mysqli_result)#3 (5) { ["current_field"]=> int(0) ["field_count"]=> int(2) ["lengths"]=> NULL ["num_rows"]=> int(0) ["type"]=> int(0) } Question: the database table (categories) is populated with two rows (id & cat_title) and there is data in there. So why does it not retrieve the data? Thanks for your help.
  4. britus

    Hi everyone

    thanks mate 👍
  5. britus

    Hi everyone

    Hello, I'm Britus. as the name suggests, a Brit in the US for the last quarter century. Trying to expand my minuscule knowledge of PHP. I'm here to learn and hopefully become adept enough to give back what I do learn.
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.