also i would like to put this newdiv as an array so with a next button i can change to the next div
and the name of "div" i would like to do div + 1 but its not working atm a help would be appreciate too
last thing i would like to do is to put the path of the image from my upload2 table in each div with a for a while loop
ty to help me hope its clear ? if not well tell me :p
if u can at least help me out with the onload thing i will be very happy
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
div.test
{
background-color:#B9CDED;
width: 100px;
text-align: center;
height: 50px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
<!--
newDiv = new Array();
function test(t)
{
alert(t);
for (i=0;i<t;i++)
{
newdiv = document.createElement('div');
newdiv.className = 'test';
document.body.appendChild(newdiv);
}
}
-->
</SCRIPT>
</head>
<body onload="test($number);">
<?php
$connection = mysql_connect("localhost","root","") or die("impossible de se connecter au serveur mysql.<p>Veuillez réessayer plus tard");
$res = mysql_select_db("ilssontcons") or die("impossible de sélectionner la base de données <b>ecole</b>.<p>Veuillez réessayer plus tard");
$resultat = mysql_query("SELECT COUNT(*) AS num FROM upload2");
$result = mysql_fetch_array($resultat);
$number = $result['num'];
print "<input type='button' name='button' value='button' onClick=test('$number')>";
?>
</body>
</html>
this code is working atm with the path thing
but i would like to put it in the div that u saw in the other code
Code: Select all
<html>
<head>
<title>Download File From MySQL</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$array = array();
$connection = mysql_connect("localhost","root","") or die("impossible de se connecter au serveur mysql.<p>Veuillez réessayer plus tard");
$res = mysql_select_db("upload2") or die("impossible de sélectionner la base de données <b>ecole</b>.<p>Veuillez réessayer plus tard");
$requeteStr = "SELECT path FROM upload2";
$resultatRequete = mysql_query($requeteStr) or die("la requete de sélection a échoué.<p>Veuillez réessayer plus tard");
$result=mysql_query($requeteStr);
if(mysql_num_rows($result) == 0)
{
echo "Database is empty <br>";
}
else
{
while ($row = mysql_fetch_array($result))
{
$array[$row['path']] = $row["path"];
?>
<img height="300" src=<?=$array[$row['path']];?>>
<?php
}
}
?>
</body>
</html>
p.s. im studying this at school, so im a bit noob to it
at the end i will add from my database some text into the div also so all these divs with a next button will show the next news all this dynamically