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 7507929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:35:02+00:00 2026-05-29T22:35:02+00:00

I have problem in my PHP code. I’m trying to make internet shop and

  • 0

I have problem in my PHP code. I’m trying to make internet shop and Im now in product listing step. My code is so long, so I will show only substantial part.

$result = mysql_query("SELECT name, category, describtion, value FROM products") or die(mysql_error());
if(mysql_num_rows($result) % 2 == 0)
{
    while($left = mysql_fetch_array($result, MYSQL_NUM) && $right = mysql_fetch_array($result, MYSQL_NUM))
    {
        echo '
        <div class="sub_items">
        <div class="sub_left">

                <div class="sub_items_header">
                <h1>'.$left[0].'</h1>
                <h2>'.$left[1].'</h2>
                </div>

                <div class="sub_items_image">
                <img src="images/'.$left[0].'.png" width="167" height="164" alt="'.$left[0].'" />
                </div>

                <div class="sub_items_text">
                    '.$left[2].'
                </div>

                <div class="sub_items_cartinfo">
                    <div class="price">
                    <h2>'.$left[3].'$</h2>
                    </div>

                    <div class="addtocart">
                    <a href="chart.php?name='.$left[0].'"><span>Add to Cart</span></a>
                    </div>

                    <div class="clearthis">&nbsp;</div>
                </div>

                <div class="clearthis">&nbsp;</div>

            </div>
            <div class="sub_right">

                <div class="sub_items_header">
                <h1>'.$right[0].'</h1>
                <h2>'.$right[1].'</h2>
                </div>

                <div class="sub_items_image">
                <img src="images/'.$right[0].'.png" width="175" height="170" alt="'.$right[0].'" />
                </div>

                <div class="sub_items_text">
                    '.$right[2].'
                </div>

                <div class="sub_items_cartinfo">
                    <div class="price">
                    <h2>'.$right[3].'$</h2>
                    </div>

                    <div class="addtocart">
                    <a href="chart.php?name='.$right[0].'"><span>Add to Cart</span></a>
                    </div>

                    <div class="clearthis">&nbsp;</div>
                </div>

                <div class="clearthis">&nbsp;</div>

            </div>

            <!-- End of Right Sub Item -->

            <div class="clearthis">&nbsp;</div>

        </div>
        <div class="h_divider">&nbsp;</div>
            ';
    }

In the while cycle I’m echoing data. Data is separated to left and right div. I’m not getting any error message, but I have bad output. Look.
...

The left side not loads, but right yes. Why? Anybody please help me.

  • 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-05-29T22:35:03+00:00Added an answer on May 29, 2026 at 10:35 pm

    = has a higher precedence thaN AND; use AND instead of && or parenthesize the assignments.

    Instead of

    $left = mysql_fetch_array($result, MYSQL_NUM) && $right = mysql_fetch_array($result, MYSQL_NUM)
    

    either

    $left = mysql_fetch_array($result, MYSQL_NUM) AND $right = mysql_fetch_array($result, MYSQL_NUM)
    

    or

    ($left = mysql_fetch_array($result, MYSQL_NUM)) && ($right = mysql_fetch_array($result, MYSQL_NUM))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem in php code inserting values into database (I use PHPMyAdmin).
I am using gettext in my PHP code, but I have a big problem.
I have a bizzare problem with php date function. code: $numDays = 8; $date
I have a problem with php header redirect. I already spent hours trying to
I have a bit of a problem with my PHP code, I am assigning
I have a problem with my code in php. I would like to delete
Here is a simple code I have problem with: <label id=label1> <?php echo Text
I have a problem regarding display PHP code (stored in a database) on a
I have a problem making a select tag in php code dynamic. I'm creating
I have a problem in implementing Mashups in PHP. Now I am using PHP

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.