Problems with the table position ...

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

drimades
New php-forum User
New php-forum User
Posts: 39
Joined: Wed Oct 29, 2003 2:11 pm

Problems with the table position ...

Postby drimades » Fri Feb 04, 2005 3:50 am

---------------------------------------------------

I have a table with the results of a query.

The problem is that everything I do it appears always in the middle of the page. I try with DIV but no way ... 8-O

Someone can tell me why?

---------------------------------------------------

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Fri Feb 04, 2005 7:39 am

Please post your code and the HTML it outputs.

drimades
New php-forum User
New php-forum User
Posts: 39
Joined: Wed Oct 29, 2003 2:11 pm

Postby drimades » Fri Feb 04, 2005 8:35 am

---------------------------------------------------

I'm posting the file member.php and the html generated.

Thanks!


---------------------------------------------------


<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link rel="stylesheet" type="text/css" href="stile1.css">
</head>

<body>

<?php

function displaymembers($queryname, $querysurname)
{
$db_host='xyz';
$db_user='xyz';
$db_pass='xyz';
$db_name='xyz';

// Connect to DB



$link = @mysql_connect($db_host, $db_user, $db_pass);


// Select DB
@mysql_select_db($db_name, $link);

// Execute query
$result = @mysql_query("SELECT * FROM Members WHERE MemberName LIKE '$queryname' OR MemberSurname LIKE '$querysurname'", $link);

if($result)

{ // ---------------- blocco if

$fields = mysql_num_fields($result);

?>

<table class="purpletbl">
<tr align="center" style="font:bold;color:blue;font-size:11px;">
<td><img width="24" src="quadro.gif"></img></td><td>Emri</td><td>Mbiemri</td><td>Datelindja</td>
<td>Vendlindja</td><td>Adresa</td><td>Tesera</td>
<td>Kodi</td>
</tr>
<?
while ($array = mysql_fetch_array($result))
{ // --------------------- ciclo while

?>
<tr>
<?
for ($i=0; $i <= 7; $i++)
{

?>
<td class="purpletbl1">
<?
if ($i==0)
{
?>
<a href="members.php?action=display&MembId=<?=$array[$i]?>" onclick="window.open('members.php?action=display&MembId=<?=$array[$i]?>','Skeda e miqve','width=360,height=280'); return false;" target="_blank"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>
<?
}
else echo $array[$i];


if ( $i < 7 ) echo " ";
?>
</td>

<?
} // -----------fine ciclo for
?>
<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=<?=$array[0]?>"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<?
echo "<BR>\n";
}; // ------------------------- fine ciclo while

?>
</table>

<?
}; // ----------------------- fine ciclo if iniziale

return $result;
}

function displayall()
{
$db_host='xyz';
$db_user='xyz';
$db_pass='xyz';
$db_name='xyz';

// Connect to D;
$link = @mysql_connect($db_host, $db_user, $db_pass);

if ($link)

{ //--------------------------blocco if

@mysql_select_db($db_name, $link);



};



// Execute query

$result = @mysql_query("SELECT * FROM Members", $link);

$fields = mysql_num_fields($result);
?>

<table class="purpletbl">
<tr align="center" style="font:bold;color:blue;font-size:11px;">
<td><img width="24" src="quadro.gif"></img></td><td>Emri</td><td>Mbiemri</td><td>Datelindja</td>
<td>Vendlindja</td><td>Adresa</td><td>Tesera</td>
<td>Kodi</td>
</tr>
<?
while ($array = mysql_fetch_array($result))
{ //----------------------- blocco while

?>
<tr>
<?
for ($i=0; $i <= 7; $i++)
{ //-------------- ciclo for

?>

<td class="purpletbl1">
<?
if ($i==0)
{
?>
<a href="members.php?action=display&MembId=<?=$array[$i]?>"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>
<?
}
else echo $array[$i];


if ( $i < 7 ) echo " ";
?>
</td>

<?
} // -------------- ciclo for
?>
<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=<?=$array[0]?>"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<?
echo "<BR>";
}; // ---------------------- blocco while

?>
</table>

<?

return $result;

} // ------------------- end displayall function




// ------------------------------- Main window ----------------------------------

?>
<table width=100% style="border:none;background:lightblue;">
<tr>
<td> <img src="blue_arrow.gif"></img>&nbsp<font style="font-family:serif;font-color:blue;font-weight:bold; font-size:22px;letter-spacing:0.2em;"> Paneli i anëtarëve</font></td>
</tr>
</table>
<center>
<font style="font-family:serif; font-color:blue; font-weight:bold; font-size:18px;">
<br><a href="members.php?action=DisplayAll">Complete member list</a>
&nbsp&nbsp<a href="members.php?action=FindMember">Find a member</a>
&nbsp&nbsp<a href="members.php?action=MemberForm">New member</a>

</font>
</center>
<br>


<?
if (!$action)

{

print " ";
}

else

{ //blocco else


switch($action)

{ // switch block
case "FindMember":

//---- form per i dati del membro da trovare
?>

<div class="divclass">
<FORM action="members.php?action=DisplayMember" method="POST" ENCTYPE="multipart/form-data">
<TABLE>
<TR>
<TD><Font color="blue" size="2"><BR><BR><b>Emri i anëtarit&nbsp</b></Font><BR><BR></TD>
<TD><BR><BR><INPUT CLASS="bluefldclass" TYPE=TEXT Name="keyn" Value="" style="width: 120pt"><BR><BR></TD>
</TR>
<TR>
<TD><Font color="blue" size="2"><BR><BR><b>Mbiemri i anëtarit&nbsp</b><BR><BR></Font></TD>
<TD><BR><BR><INPUT CLASS="bluefldclass" TYPE=TEXT Name="keys" Value="" style="width: 120pt"><BR><BR></TD>
</TR>
<TR ALIGN="CENTER">
<TD colspan="2"><BR><BR><INPUT CLASS="bluefldclass" TYPE=SUBMIT Name="submit" Value="Kërko" style="width: 100pt"><BR><BR></TD>

</TR>
</TABLE>
</FORM>
</div>
<?

break;

case "DisplayAll":
//----- interrogazione database per visualizzare tutti i membri
displayall();
break;

case "DisplayMember":

//----- interrogazione database per trovare i membri
displaymembers($keyn,$keys);

break;
case "DisplayPigeon":
print "Visualizza piccioni";
break;
case "ModMember":
print "Modifica membro-Ok!";
break;
case "ModPigeon":
print "Modifica piccione!";
break;
case "DelMember":
print "Cancella membro";
break;
case "DelPigeon":
print "Cancella piccione";
break;
case "MemberForm":
// -------------------------- form per i dati del membro
?>
<div class="divclass">
<FORM action="members.php?action=InsMember" method="POST" ENCTYPE="multipart/form-data">

<font style="font-style:serif;letterspacing:2px;font-size:18px;"><b>Te dhenat per anetarin e ri</b></font>
<br><br>
<table style="border-style:solid;border-width:1px;border-color:blue">

<TR>
<TD><b>Emri i anëtarit&nbsp</b></TD>
<TD><INPUT CLASS="bluefldclass" TYPE=TEXT Name="name" Value="" style="width: 60pt"></TD>
<TD><b>Mbiemri i anëtarit&nbsp</b></TD>
<TD><INPUT CLASS="bluefldclass" TYPE=TEXT Name="surname" Value="" style="width: 60pt"></TD>
</TR>

<TR>
<TD><b>Datelindja&nbsp</b></TD>
<TD><INPUT CLASS="bluefldclass" TYPE=TEXT Name="birthdate" Value="" style="width: 60pt"></TD>
<TD><b>Vendndodhja&nbsp</b></TD>
<TD><INPUT CLASS="bluefldclass" TYPE=TEXT Name="memberplace" Value="" style="width: 60pt"></TD>
</TR>

<TR>
<TD colspan="2"><b>Adresa&nbsp</b></TD>
<TD colspan="2"><INPUT CLASS="bluefldclass" TYPE=TEXT Name="address" Value="" style="width: 200pt"></TD>
</TR>
<TR>
<TD colspan="2"><b>Numri i telefonit&nbsp</b></TD>
<TD colspan="2"><INPUT CLASS="bluefldclass" TYPE=TEXT Name="phone" Value="" style="width: 100pt"></TD>
</TR>
<TR>
<TD><b>Numri personal&nbsp</b></TD>
<TD><INPUT CLASS="bluefldclass" TYPE=TEXT Name="number" Value="" style="width: 60pt"></TD>
<TD><b>Tesera&nbsp</b></TD>
<TD><INPUT CLASS="bluefldclass" TYPE=TEXT Name="card" Value="" style="width: 60pt"></TD>
</TR>

<TR>
<TD><b>Data&nbsp</b></TD>
<TD><INPUT CLASS="bluefldclass" TYPE=TEXT Name="date" Value="" style="width: 60pt"></TD>
<TD><b>Pellumbat&nbsp</b></TD>
<TD><INPUT CLASS="bluefldclass" TYPE=TEXT Name="pigeonnr" Value="" style="width: 40pt"></TD>
</TR>

<TR>
<TD><b>Pellumborja&nbsp</b></TD>
<TD><INPUT CLASS="bluefldclass" TYPE=TEXT Name="pigeonplace" Value="" style="width: 60pt"></TD>
<TD><b>Shoqeria&nbsp</b></TD>
<TD><INPUT CLASS="bluefldclass" TYPE=TEXT Name="society" Value="" style="width: 40pt"></TD>
</TR>

<TR><td colspan="4" align="center"><br><INPUT CLASS="bluefldclass" TYPE=SUBMIT Name="submit" Value="Vazhdo" style="width: 100pt"><br><br></td></TR>
</table

</FORM>
</div>


<?

break;
case "InsMember":
// ------------------ ------- inserisci membro
$dbr = dbconnect();
@mysql_select_db('xyz', $dbr);

$insquery=mysql_query("INSERT INTO Members (MemberId , MemberName , MemberSurname , MemberBirth , MemberPlace , MemberAddr , MemberCard , MemberCode , MemberDate , MemberPigNum , MemberPigPlace , MemberSoc , MemberPhone) VALUES ('','$name', '$surname', '$birthdate', '$memberplace', '$address', '$number', '$card', '$date', '$pigeonnr', '$pigeonplace', '$society', '$phone')",$dbr) or die("Errore nell'inserimento in database: ".mysql_error()) or die("Errore: ".mysql_error());



print "Inserisci membro OK!";
break;
case "InsPigeon":
print "Inserisci piccione";
break;
case "display":
// ---------------------------------------- skeda e plote e anetarit

$dbr= dbconnect();
@mysql_select_db('xyz', $dbr);
$memberquery = mysql_query("SELECT * FROM Members WHERE MemberId='$MembId'", $dbr);
$data = mysql_fetch_array($memberquery);

?>

<table width="480" border="0" bordercolor="#0000FF"
style="font-style:serif;font-size:18px;">
<tr>
<td width="30%"> <br> <b>Emri: </b><?print $data['MemberName'];?>&nbsp<b><br>Mbiemri:
</b><?print $data['MemberSurname'];?><br> <br> </td>

<td width="30%" rowspan="2" align="center"><img src="genio.gif"
width="120"></img></td>
</tr>
<tr>
<td><br> <b>Kodi personal: </b> <?print $data['MemberCode'];?> <br><b>Tesera nr:
</b><?print $data['MemberCard'];?> <br> <br></td>

</tr>
<tr>
<td><br><b> Datëlindja: </b> <?print $data['MemberBirth'];?><br><br><b>
Vendndodhja: </b> <?print $data['MemberPlace'];?><br><br></td>

<td><br><b>Adresa: </b><br> <?print $data['MemberAddr'];?></td>
</tr>

<tr>
<td><br><b>Data: </b><?print $data['MemberDate'];?></td>

<td><br><b>Nr. i pellumbave: </b><?print $data['MemberPigNum'];?></td>
</tr>
<tr>
<td><br><b>Pellumborja: </b><?print $data['MemberPigPlace'];?></td>

<td><br><b>Shoqeria: </b><?print $data['MemberSoc'];?></td>
</tr>

<tr>
<td colspan="2"><br><b>Telefon: </b>&nbsp<?print $data['MemberPhone'];?></td>


</tr>
</table>

<?
break;

default:
print "Altro caso";
break;

} // switch block





}; //blocco else


?>



</body>
</html>


------------------------------------------------------------------

<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link rel="stylesheet" type="text/css" href="stile1.css">
</head>

<body>
<script language="JavaScript">
function Popup(url, window_name, window_width, window_height) {
settings= "toolbar=no,location=no,directories=no,"+ "status=no,menubar=no,scrollbars=yes,"+ "resizable=yes,width="+window_width+",height="+window_height;
NewWindow=window.open(url,window_name,settings);
}
</script>
<table width=100% style="border:none;background:lightblue;">
<tr>
<td> <img src="blue_arrow.gif"></img>&nbsp<font style="font-family:serif;font-color:blue;font-weight:bold; font-size:22px;letter-spacing:0.2em;"> Paneli i anëtarëve</font></td>
</tr>
</table>
<center>
<font style="font-family:serif; font-color:blue; font-weight:bold; font-size:18px;">
<br><a href="members.php?action=DisplayAll">Lista e plotë</a>
&nbsp&nbsp<a href="members.php?action=FindMember">Gjej një anëtar</a>
&nbsp&nbsp<a href="members.php?action=MemberForm">Anëtar i ri</a>

</font>
</center>
<br>



<table class="purpletbl">
<tr align="center" style="font:bold;color:blue;font-size:11px;">
<td><img width="24" src="quadro.gif"></img></td><td>Emri</td><td>Mbiemri</td><td>Datelindja</td>
<td>Vendlindja</td><td>Adresa</td><td>Tesera</td>
<td>Kodi</td>
</tr>
<tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=1"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
Hasan
</td>



<td class="purpletbl1">
Hasani
</td>



<td class="purpletbl1">
21/01/1966
</td>



<td class="purpletbl1">
Vlore
</td>



<td class="purpletbl1">
Rr. Naim Frasheri 123, Vlore Albania
</td>



<td class="purpletbl1">
002
</td>



<td class="purpletbl1">
1
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=1"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=2"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
Perlat
</td>



<td class="purpletbl1">
Rexhepi
</td>



<td class="purpletbl1">

</td>



<td class="purpletbl1">
Shkoder
</td>



<td class="purpletbl1">
Rr. Deshmoret 22, Tirane Albania
</td>



<td class="purpletbl1">
002
</td>



<td class="purpletbl1">
7
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=2"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=3"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
Isa
</td>



<td class="purpletbl1">
Boletini
</td>



<td class="purpletbl1">

</td>



<td class="purpletbl1">
Rubik
</td>



<td class="purpletbl1">
Rr. Pavaresia, pall. 1234, Mirdite Albania
</td>



<td class="purpletbl1">
005
</td>



<td class="purpletbl1">
3
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=3"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=4"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
Lefter
</td>



<td class="purpletbl1">
Lefteri
</td>



<td class="purpletbl1">

</td>



<td class="purpletbl1">
Lushnje
</td>



<td class="purpletbl1">
Rr. e Kavajes, 12 Lushnje Albania
</td>



<td class="purpletbl1">
007
</td>



<td class="purpletbl1">
C12-33
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=4"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=5"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
Lutfi
</td>



<td class="purpletbl1">
Koka
</td>



<td class="purpletbl1">

</td>



<td class="purpletbl1">
Vlore
</td>



<td class="purpletbl1">
Rr. Ismail Qemali, pall. 23 Vlore Albania
</td>



<td class="purpletbl1">
056
</td>



<td class="purpletbl1">
C00-57
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=5"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=6"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
Luftar
</td>



<td class="purpletbl1">
Resuli
</td>



<td class="purpletbl1">

</td>



<td class="purpletbl1">
Sarande
</td>



<td class="purpletbl1">
Rr. Flamurtari nr. 4 Sarande Albania
</td>



<td class="purpletbl1">
010
</td>



<td class="purpletbl1">
A12-09
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=6"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=7"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
asfd
</td>



<td class="purpletbl1">
asdfsa
</td>



<td class="purpletbl1">

</td>



<td class="purpletbl1">
sadf
</td>



<td class="purpletbl1">
asfasdfasfdsafdds
</td>



<td class="purpletbl1">
345
</td>



<td class="purpletbl1">
234
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=7"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=8"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
Buli
</td>



<td class="purpletbl1">
Zhupa
</td>



<td class="purpletbl1">
27/01/1977
</td>



<td class="purpletbl1">
Bari
</td>



<td class="purpletbl1">
Via Eritrea 25, Bari Italia
</td>



<td class="purpletbl1">
999
</td>



<td class="purpletbl1">
888
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=8"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=9"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
Tofik
</td>



<td class="purpletbl1">
Hasani
</td>



<td class="purpletbl1">
23/09/1967
</td>



<td class="purpletbl1">
Bari
</td>



<td class="purpletbl1">
Via C. Rosalba 55, 70124 Bari Italia
</td>



<td class="purpletbl1">
A12
</td>



<td class="purpletbl1">
AZX-12
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=9"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=10"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
asdf
</td>



<td class="purpletbl1">
safdasdf
</td>



<td class="purpletbl1">
asdfsad
</td>



<td class="purpletbl1">
sadfsadf
</td>



<td class="purpletbl1">
sadfsd
</td>



<td class="purpletbl1">
sdf
</td>



<td class="purpletbl1">
asd
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=10"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=11"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
asdf
</td>



<td class="purpletbl1">
sfd
</td>



<td class="purpletbl1">
asdf
</td>



<td class="purpletbl1">
sdf
</td>



<td class="purpletbl1">
asfd
</td>



<td class="purpletbl1">
sdf
</td>



<td class="purpletbl1">
ssdsfd
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=11"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> <tr>


<td class="purpletbl1">
<a href="members.php?action=display&MembId=12"><img src="skeda.gif" border="no" alt="Skeda e plote"></img></a>

</td>



<td class="purpletbl1">
asdf
</td>



<td class="purpletbl1">
sdf
</td>



<td class="purpletbl1">
sdf
</td>



<td class="purpletbl1">
sdf
</td>



<td class="purpletbl1">
sdf
</td>



<td class="purpletbl1">
sdf
</td>



<td class="purpletbl1">
sdf
</td>


<td><img src="laps.png"></img>&nbsp<img src="cross.png">&nbsp<a href="prova.php?action=searchpig&MembId=12"><img src="pig.jpg" width="35" border="no" alt="Pellumbat"></img></a></td>
</tr>
<BR> </table>




</body>
</html>

drimades
New php-forum User
New php-forum User
Posts: 39
Joined: Wed Oct 29, 2003 2:11 pm

Postby drimades » Sat Feb 05, 2005 4:33 am

----------------------------------------

Solved!

I noticed that the blank space was proportional to the number of records so:

it was the echo "<BR>" at the end of the while block! :)

Thank you!

----------------------------------------


Return to “HTML Basics”

Who is online

Users browsing this forum: No registered users and 1 guest