Jump to content

echo many same id numbers from mysql database


sungpeng

Recommended Posts

You could give it a shot

<?php
$sql = mysql_query("SELECT * FROM database where id=$id");
while($do=mysql_fetch_array($sql)){
    echo "<div>{$do['id']}</div>";
}
?>
 
Note that I added a semi-colon after the call to mysql_query().
 
 
And in case you are not aware, the mysql_* functions have been removed from the newest version of PHP. You need to switch to PDO or MySQLi soon. More information can be found here:
Link to comment
Share on other sites

I have to assume this query is gibberish pseudo-code. The name of your table isn't 'database', and if you've got duplicate values in the ID column, you're using IDs incorrectly. Give us the actual query and we may be able to help you figure out why you're getting a MySQL error.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.