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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:08:51+00:00 2026-05-28T20:08:51+00:00

Will someone PLEASE show me what I’m doing wrong? I’m new to using phpMyAdmin

  • 0

Will someone PLEASE show me what I’m doing wrong? I’m new to using phpMyAdmin and db.

I have a db table with 4 items. Looks fine on a plain php page – I get all four items in correct order.

But if I use coding <ul class="column"><li><div class="imgblock"> like shown below, I get 4 duplicates of my last entry in the db table. I think I have to rearrange how I use “, ‘, and ), etc.? Not sure how though…

<?php
// Make a MySQL Connection
mysql_connect("localhost", "....", "....") or die(mysql_error());
mysql_select_db("....") or die(mysql_error());

$show = "SELECT pn, pgname, img, name, price FROM prodshort";
$result = mysql_query ($show);
while ($show = mysql_fetch_array ($result))
{
$field2= $show['pn'];
$field3= $show['pgname'];
$field4= $show['img'];
$field5= $show['name'];
$field6= $show['price'];
$field7= $show['specs'];
}
?>

<!-- start -->
<ul class="column"><li><div class="imgblock">
<a href="<?echo "$field3";?>">
<img src="<?echo "$field4";?>" width="320" height="240" alt="<?echo "$field5";?>" /></a></div><br />
<a href="<?echo "$field3";?>"><?echo "$field5";?></a>
<ul class="specs">
<?echo "$field7";?></ul>
<div class="price">
#<?echo "$field2";?>&nbsp;&nbsp;&nbsp;$<?echo "$field6";?>
</div></li></ul>
<!-- end -->
  • 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-28T20:08:52+00:00Added an answer on May 28, 2026 at 8:08 pm

    The above is probably not the code from the example, as the while loop is outside your items.

    It should be more like this:

    while ($show = mysql_fetch_array ($result)) {
        $field2= $show['pn'];
        $field3= $show['pgname'];
        $field4= $show['img'];
        $field5= $show['name'];
        $field6= $show['price'];
        $field7= $show['specs'];
    ?>
    <!-- start -->
    <ul class="column">
        <li>
            <div class="imgblock">
                <a href="<?echo "$field3";?>">
                    <img src="<?echo "$field4";?>" width="320" height="240" alt="<?echo "$field5";?>" />
                </a>
            </div>
            <br />
            <a href="<?echo "$field3";?>"><?echo "$field5";?></a>
            <ul class="specs">
                <?echo "$field7";?>
            </ul>
            <div class="price">
            #<?echo "$field2";?>&nbsp;&nbsp;&nbsp;$<?echo "$field6";?>
            </div>
        </li>
    </ul>
    <!-- end -->
    <?
    // end of while loop
    }
    ?>
    

    (You might find it easier to debug if you indent your code correctly, most editors do that for free 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone please show me a MySQL statement that will get the value of
Can someone share how to make items in a ListViewer scrollable? Source code will
Can someone enlighthen me with regards to Linq please? I have a dataset that
Can someone please point to some docs or links which show how to create
Can someone please show me how i can preg_match this so that it just
Could someone please be kind enough to confirm if I have understood the Async
I know the code is missing (Someone will give negative numbers). But I only
I recently found out about livecoding where someone will program something on the fly
I need to create a script where someone will post an opening for a
I got great help in my first question n hopefully someone will tell me

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.