Jump to content

Recommended Posts

Hello guys!I'm building a video search engine and i need to create a separate div for every MySQL result.But instead,i get all the result into one single div.

<?php
$sql=mysql_query("SELECT*FROM videos WHERE User='$nemo'");
while($row=mysql_fetch_array($sql,MYSQL_ASSOC)){
$name=$row['Name'];
echo '<div id="found"><h1>'.$name.'</div></h1>';
}?>

Thanks

 

 


<?php

$sql=mysql_query("SELECT*FROM videos WHERE User='$nemo'");
 
$name = array();


while($row=mysql_fetch_array($sql,MYSQL_ASSOC)){

$name[]=$row['Name'];

}
// you can use a loop to find all indexes in that array
// example
echo '<div id="found"><h1>'.$name[0].'</div></h1>';
echo '<div id="found"><h1>'.$name[1].'</div></h1>';
?>
 
Edited by jazzman1

Hello guys!I'm building a video search engine and i need to create a separate div for every MySQL result.But instead,i get all the result into one single div.

 

<?php
$sql=mysql_query("SELECT*FROM videos WHERE User='$nemo'");
while($row=mysql_fetch_array($sql,MYSQL_ASSOC)){
$name=$row['Name'];
echo '<div id="found"><h1>'.$name.'</div></h1>';
}?>
Thanks

Correctly nesting your HTML elements may help. The h1 element should be inside the div, not overlapping.

You should also have unique id names.  If you are only using the id for styling, then use a class.  If you are using it for an anchor or other location sourcing, make the names unique.

 

http://www.w3.org/TR/html401/struct/global.html#h-7.5.2

 

id = name[CS]

This attribute assigns a name to an element. This name must be unique in a document.
class = ctype-data[CS]
This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters.
 

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.