Jump to content


New Members
  • Posts

  • Joined

  • Last visited

Everything posted by britus

  1. Excellent. It worked great Barand. Thank you
  2. Thanks for that. I'll give it a go this evening. What did you mean by "I would also recommend using using valid column names"? I was trying to keep everything descriptive so I have a better understanding of what I am learning. Thanks
  3. I have two table - categories - cat-id, cat-title posts - post-id, post-cat-id, post-title I want to search through all rows in 'posts' and get the number of posts based on each category in 'categories', echo 'cat-title' - number of posts if no posts then echo 'cat-title' - "no posts". posts are assigned a post-cat-id relative to cat-id. I tried using joins WHERE cat-id = post-cat-id AND cat-title = 'a-category' but that only shows results when posts are assigned 'a-category'. If that category does not exist in 'posts' then nothing shows How, in your opinion, should I approach this? Thanks
  4. 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.
  5. 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)
  6. 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.
  7. 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.
  • Create New...

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.