Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9052575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:12:29+00:00 2026-06-16T13:12:29+00:00

Currently I am able to achieve the desired affect showing products based on their

  • 0

Currently I am able to achieve the desired affect showing products based on their category. However I feel the way I have gone about it isn’t the best way. On the product page there are gaps between the products top and bottoms as HERE . I am presuming the gap is due to a error in my php code rather than the way I am laying out the html. Any help would be greatly appreciated.

So to clarify I am wondering if the code used is the correct way to achieve this and if anyone can spot why the gap is there that would be perfect.

Just to clarify it is defiantly not a problem with css. No margin is applied and I want the black line completely gone. It should be all white.

Thank you and have a great new year.

PHP code

<?php
function get_posts($id = null, $cat_id = null) {
    $posts = array();

    $query ="SELECT  `products`.`id` AS  `name` ,  `products_cat`.`id` AS  `category_id` , `products`.`name` AS `title` ,  `description` ,  `price` ,  `sale` ,  `picture` 
FROM  `products` 
INNER JOIN  `products_cat` ON  `products`.`prod_id` =  `products_cat`.`id` ";

    if ( isset($id) ) {
    $id = (int) $id;
    $query .= " WHERE `products`.`id` = {$id}";
    }

    if ( isset($cat_id) ) {
        $cat_id = (int) $cat_id;
        $query .= " WHERE `products_cat`.`id` = {$cat_id}";
}

    $query .= " ORDER BY `products`.`price` DESC";

    $query = mysql_query($query);
    echo mysql_error();
    while ( $row = mysql_fetch_assoc($query) ) {
        $posts[] = $row;
        }

    return $posts;
}

function category_exists($field, $value) {
    $field = mysql_real_escape_string($field);
    $value = mysql_real_escape_string($value);

    $query = mysql_query("SELECT COUNT(1) FROM `products_cat` WHERE `{$field}` = '{$value}'");

    echo mysql_error();

    return ( mysql_result($query, 0) == '0' ) ? false : true; 
}

?>

HTML CODE

<?php
include("../script/dbconnect.php");
include("../script/get_product.php");

$posts = get_posts(null, $_GET['id']);

?>

<div style="width:100%; height:150px; background-color:white;"><span style="font-family:saxMonoRegular; letter-spacing:2px; display:block; font-size:4.5em; text-align:center; padding-top:15px;"> Blog </span></div>

<div class="link" style="width:100%; background-color: white">
<?php
foreach ( $posts as $post ) {
    if ( ! category_exists('name', $post['name']) ) {
        $post['name'] = 'Uncategorised';
    }
    ?>      
    <ul class='featured'>

            <li class='headhighlight'><?php echo $post['title']; ?></li>  
            <li class='pricehigh'><?php echo $post['price']; ?></li>
            <li class='imagefeat'><img class='imagelink' src='<?php echo $post['picture']; ?>' alt='$name'></li>                
            </ul>   

    <?php
    }
?>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:12:30+00:00Added an answer on June 16, 2026 at 1:12 pm

    Iam not shure if iam understand right, but i would say its more a problem of CSS.

    Try:

    div.link {
      padding: 0px;
    

    }

    ul.featured {
      display: block;
      width: 200px;
      margin: 0px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, I have the following XAML code which is able to achieve the following
I currently have a form with inputs and name attributes. I'm able to get
Currently, I have: outByte.writeInt(0x49492a00); outByte.writeInt(0x08000000); But i want to be able to write all
I'm currently looking for a way to provide the user with being able to
I have an application I'm currently working on that requires Administrators to be able
I have seen a number of posts similar but wasn't able to achieve my
I am trying to achieve the following http://www.qksnap.com/i/3hunq/4ld0v/screenshot.png I am currently able to draw
I am currently able to export my MySQL query to a tab delimited text
Currently I am able to retrieve data from a MySQL db by using HTTP
Currently, I'm finding a lib able to stream video from multiple sources through one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.