Reputation: 1335
I'm new here, so do not be angry if I ask something that is already answered.
I connected sql database: connect.php
<?php
$connect = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("mobilni", $connect) or die(mysql_error());
?>
displaydata.php
<?php
include "connection.php";
$sql= "SELECT * FROM imena WHERE Okrug='Beogradski'";
$query=mysql_query($sql) or die (mysql_error());
?>
<div class="beyondheader"></div>
<div class="header">
<div id='cssmenu'>
<ul>
<li class='active'><a href='index.html'>Početna</a></li>
<li><a href='proizvodjaci.html'>Proizvodjači</a></li>
<li><a href='oglasi.html'>Oglasi</a></li>
<li><a href='about.html'>O nama</a></li>
</ul>
</div>
</div>
<div class="middle">
<div class="leftmiddle">ss
</div>
<div class="rightmiddle">
<?php
while ($row = mysql_fetch_array($query)){
?>
<div class="divmobilni">
Ime:<div class="mobilniime"><?php echo $row['Ime'];?></div>
Okrug:<?php echo $row['Okrug'];?>
</div>
<?php } ?>
</div>
</div>
And everything is working fine. Now I want to put every result in the other <div>
automatically?
How to do that?
Sorry if I wasn't clear enough. I want to sort results to be like this, in one <div>
goes: Ime:
Okrug:
[that is data for one person]
Now, I want to make that all data from my SQL table display on this page, but every Person separately from this <div>
.
To be something like this, with data from table: (This is just example drawn in Paint)
I fixed this with adding only break to the end of PHP. Thanks in any case!
Upvotes: 0
Views: 2597
Reputation: 697
Exactly the same as you would with php open and close <?php
?>
Use this inside the divs you would like or just use echo with the div inside
Upvotes: 2