Jump to content

Search the Community

Showing results for tags 'myslqi'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. I'm really sorry for the poor explanation, I am absolutely not familiar with PHP. I would like to get data from my phpmyadmins 2 table, so I can display how many posts have been submitted with the same category type. One is called "posts" and the other one is called "categories". I have attached a picture to see the how it looks like. What I want is to make the category tables "id" equal to the posts tables "catagory_id", and then display how many posts have bben uploaded of each category. Here is how far I went with the coding, which is nowhere close to my expectations: <div class="stats__div"> <p class="stats__text">Categories</p> <p> <?php $all_categories_query = "SELECT * FROM categories ORDER BY title ASC"; $all_categories = mysqli_query($connection, $all_categories_query); while ($category = mysqli_fetch_assoc($all_categories)) : ?> <p><?= $category['title'] ?> <?= $category['id'] ?></p> <?php endwhile ?> <?php $all_posts_query = "SELECT * FROM posts GROUP BY category_id"; $all_posts = mysqli_query($connection, $all_posts_query); while ($posts = mysqli_fetch_assoc($all_posts)) : ?> <p><?= $posts['category_id'] ?></p> <?php endwhile ?> </p> </p> </div> I know, the coding is at the edge of being horrible, I am really sorry for that. I have tried my best. Does anyone know how to do that? I have seen that the right solution is using "array_count_values", but all the examples I have seen were lists. Any kind of help is highly appreciated!
  2. After several attempts, I now have data displayed on my index.php page, but the data is from all rows. Luckily I have two rows. The page also has a menu - with two links. What I would like help with is: How to display index.php with just the data for it - i.e. home page data. How to display data if either the ‘home’ or ‘copyright’ links are clicked. I understand you can use $_GET[‘id’], and isset(), but I don’t know how to do that. I include the full html page code: <?php // database connection require_once('admin/databasecon.php'); ?> <!DOCTYPE html> <html> <?php include 'includes/headsection.php'; ?> <body> <?php // displaying data $table = "pages"; // table $sqli = "SELECT * FROM $table ORDER BY id ASC"; $result = $conn->query($sqli); ?> <!-- topMenu --> <table id="topMenu"> <tr> <td><h1 class="siteName">Scarab Beetle</h1></td> <?php if ($result = mysqli_query($conn, $sqli)) { while($row = $result->fetch_assoc()) { echo "<td class='navItem'>" . "<a href=index.php>" . $row["menuheader"] . "</a>" . "</td>"; } } ?> </tr> </table> <!-- topMenu end --> <!-- timeline menu --> Menu goes here <!-- timeline menu end --> <!-- page title --> <?php if ($result = mysqli_query($conn, $sqli)) { while($row = $result->fetch_assoc()) { echo "<h1 class='centered'>" . $row["pageheader"] . "</h1>"; } } ?> <hr> <!-- page content --> <?php if ($result = mysqli_query($conn, $sqli)) { while($row = $result->fetch_assoc()) { echo $row["pagetext"]; } } ?> <hr> <div class="clear"></div> <!-- footer content --> <?php include 'includes/footersection.php'; ?> <!-- footer content end --> </body> </html> Any help to achieve what I want will be appreciated. Thank you.
×
×
  • 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.