Forum Moderators: not2easy

Message Too Old, No Replies

Trying to show the personal data and photos of my friends

         

tirengarfio

7:32 pm on Nov 30, 2008 (gmt 0)

10+ Year Member



Hi,

i have a MySQL table. It contains the personal data of some friends of mine and their photo.

Now I want to create, a page that shows all that, something like this:

<snip>

But i can't get it..I have tried it, and i get this:

<snip>

These are my codes, can you help me?

#page-container {
background: grey;
margin: auto;
}

#parte-superior {
height: 200px;
background: green;
}

#contactos {
background: white;
margin: auto;
width: 700px;
}

#foto {
width: 300px;
float: left;
background: yellow;
}

#datos {
width: 400px;

background: red;
}


<html>
<head>
<style type="text/css" media="all">@import "css/master.css";</style>
</head>

<body>

<div id="page-container">

<div id="parte-superior">
Hola mundo
</div>

<div id="contactos">

<div id="foto">

<?php

// Nos conectamos al servidor mysql.
mysql_connect("localhost", "root", "") OR die(mysql_error());

// Seleccionamos la base de datos "red_social".
mysql_select_db("red_social") OR die(mysql_error());

// Visualizamos el contenido de la tabla "amigos".
$result = mysql_query("select * from amigos") OR die(mysql_error());

// Imprimimos las filas de la tabla "amigos".
while($row = mysql_fetch_array($result))

{

// Mostramos la imagen.
$pru=$row["avatar"];
echo "<img src='$pru'>";

?>

</div>

<div id="datos">

<?php

echo $row["nombre"];
echo "<br>";
echo $row["apellidos"];
echo "<br>";
echo $row["edad"];
echo "<br>";
echo $row["telefono"];
echo "<br>";
echo $row["email"];
echo "<br>";
echo $row["domicilio"];
echo "<br>";
echo $row["perfil"];
echo "<br>";

}
?>

</div>

</div>
</div>

</body>

</html>

Ciao

[edited by: swa66 at 9:52 pm (utc) on Nov. 30, 2008]
[edit reason] No personal URLs, please see forum charter [/edit]

tirengarfio

3:12 pm on Dec 3, 2008 (gmt 0)

10+ Year Member




System: The following 2 messages were spliced on to this thread from: http://www.webmasterworld.com/css/3799145.htm [webmasterworld.com] by swa66 - 1:25 am on Dec. 9, 2008 (utc 0)


Hi,

im startin with css and now i trying to know how the classes work.

I have a ccs file with two classes, and a html/php/mysql document where i'm trying to apply the
rules of the classes ( "class foto -> background: yellow;" and
"class datos -> background: color;") but I can't see put them into practice anywhere...

What am i doing wrong?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css" media="all">@import "css/master.css";</style>
</head>

<body>

<div id="page-container">

<div id="parte-superior">
Hola mundo
</div>

<div id="contactos">

<?php

// Nos conectamos al servidor mysql.
mysql_connect("localhost", "root", "") OR die(mysql_error());

// Seleccionamos la base de datos "red_social".
mysql_select_db("red_social") OR die(mysql_error());

// Visualizamos el contenido de la tabla "amigos".
$result = mysql_query("select * from amigos") OR die(mysql_error());

// Imprimimos las filas de la tabla "amigos".
while($row = mysql_fetch_array($result))

{

?>

<div class="foto">

<?php

// Mostramos la imagen.
$pru=$row["avatar"];
echo "<img src='$pru'>";

?>

</div>

<div class="datos">

<?php

echo $row["nombre"];
echo "<br>";
echo $row["apellidos"];
echo "<br>";
echo $row["edad"];
echo "<br>";
echo $row["telefono"];
echo "<br>";
echo $row["email"];
echo "<br>";
echo $row["domicilio"];
echo "<br>";
echo $row["perfil"];

}
?>

</div>

</div>
</div>

</body>

</html>


#page-container {
background: grey;
margin: auto;
}

#parte-superior {
height: 200px;
background: green;
}

#contactos {
background: white;
margin: auto;
width: 700px;
}

div.foto {
width: 300px;
float: left;
background: yellow;
}

div.datos {
width: 400px;

background: red;
}

swa66

1:19 am on Dec 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To set a background color, it's best not to use the shorthand "background", but to use background-color instead.

Aside of that, only the css and the html are given to the browser, so whatever you have in php or databases isn't that relevant, the generated html is all the more.

Make sure your generated code validates
[validator.w3.org...]
[jigsaw.w3.org...]

To get the generated html: view it in your browser and do a view source ...