Jump to content

hi i found out the problem by myself without google.ca :p

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
13 replies to this topic

#1
nicnicnic

nicnicnic

    Newbie

  • Members
  • PipPip
  • 16 posts
<html>
<head>
<title>Download Image</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?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("upload2") or die("impossible de sélectionner la base de données <b>ecole</b>.<p>Veuillez réessayer plus tard");

$requeteStr = "SELECT name,texteNouvelle FROM upload2";
$resultatRequete = mysql_query($requeteStr) or die("la requete de sélection a échoué.<p>Veuillez réessayer plus tard");


while ($row = mysql_fetch_array($resultatRequete)) 
     {
?>
    <img height="300" src="<?echo $row['name']?>">
<?php           
    echo $row['texteNouvelle'];
    }
?>
</body>
</html>

the problem was that i was echoing out the path but what i need it to do was to echo the image name <img height="300" src="<?echo $row['name']?>">
but ty for these little tips it has help me out:)

and lol when i query the select results twice i laugh it too LOL

so just relax and have fun now :p

if you want i will show you how i will animate my news when it will be done

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Please use code tags when posting code. Nice work on solving the problem, is this in reference to another question you have already asked?

#3
nicnicnic

nicnicnic

    Newbie

  • Members
  • PipPip
  • 16 posts
yeah Jordan but the thread of before was " problem showing up an image " :p
has been locked thats why i start a new one so you guys can see it

anyway no big deal i dont like trouble

and sry about the tag i forgot to add it

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Can you post a link to the thread? Odd that it was locked and not resolved.

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It's this thread: http://forum.codecal...g-up-image.html

I couldn't get the merge to work for some reason.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
nicnicic, thanks for coming back and sharing your solution.

#7
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
I HATE your code, nicnicic.

Try this instead:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

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

<body>
<?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("upload2") or die("impossible de sélectionner la base de données <b>ecole</b>.<p>Veuillez réessayer plus tard");

$requeteStr = "SELECT name,texteNouvelle FROM upload2";
$resultatRequete = mysql_query($requeteStr) or die("la requete de sélection a échoué.<p>Veuillez réessayer plus tard");


while ($row = mysql_fetch_array($resultatRequete)) 
     {
?>
    <img height="300" src="<?echo $row['name']?>">
<?php           
    echo $row['texteNouvelle'];
    }
?>
</body>
</html>

Edited by John, 18 November 2008 - 03:46 PM.

Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#8
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Xav, use PHP tags when posting PHP -rep for you mister. And maybe he doesn't want his code to be xhtml strict. The top 5 most popular websites: yahoo, google, youtube, live, and facebook are not xhtml compliant.

#9
Guest_Jordan_*

Guest_Jordan_*
  • Guests

WingedPanther said:

It's this thread: http://forum.codecal...g-up-image.html

I couldn't get the merge to work for some reason.

Ahh, I see why it was closed. I've had problems getting Merge to work the way I want it as well.

#10
nicnicnic

nicnicnic

    Newbie

  • Members
  • PipPip
  • 16 posts
yeah lol that was funny

#11
nicnicnic

nicnicnic

    Newbie

  • Members
  • PipPip
  • 16 posts

<html>

<head>

<title>News</title>

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

<script type="text/javascript">

page_courante=1;

demarree = false;



function pagePrecedente()  // Previous 

 {

   if (page_courante!=1) 

     affichePage(page_courante-1);

 }



function pageSuivante() // Next

 {

   if (page_courante!=nombrePages) 

     affichePage(page_courante+1);

 }

 

 

function play()  

 {

   if (demarree==false)

	return;

   if (page_courante!=nombrePages) 

     affichePage(page_courante+1);

   timeOut = setTimeout('play()', 2000);

 }

 

 

function stop()

 {

  clearTimeout(timeOut);

 }

 

// display the news

function affichePage(page)

 {

   document.getElementById("page"+page_courante).style.display = "none";

   document.getElementById("page"+page).style.display = "block";

   page_courante=page;

 }

</script>

</head>



<body>




<button onClick="pagePrecedente()">Page précédente</button>

<button onClick="pageSuivante()">Page suivante</button>

<button onClick="if (!demarree) {demarree=true;play();}">Play</button>

<button onClick="demarree=false;">Stop</button>

<script type="text/javascript">

   nombrePages =<?php echo $nbpages;?>

</script>

</body>

</html>



<?php

//connection to database

$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");



//request select

$requeteStr = "SELECT path,name,texteNouvelle from upload2";

$resultat   = mysql_query($requeteStr);



//calcul

$cpt        = mysql_num_rows($resultat);//Number of result from request

$rpp        = 1;//number of results per page

$nbpages    = ceil($cpt / $rpp);//Count number of pages

$i          = 1; // id of the page


 

//show results

while ($ligne=mysql_fetch_array($resultat))

     {

         if ($i == 1) //show first result

           echo "<div id=\"page1\" style=\"display: block;\">";

         else 

           echo "<div id=\"page".$i."\" style=\"display: none;\">";      

         echo "<table><tr><td></td></tr>";

         echo "<tr><td>".$ligne["texteNouvelle"]."</td></tr>";//texteNouvelle = text news

?>

         <img height="300" src="<?echo $ligne['path'].$ligne['name']?>">					  

<?         

         echo "</table></div>"; 

         $i++; 

     }

?>


here is my code for the news with the text and image you can put the php code inside the body and it will work

my path directory is './data/' when i do the upload


if you guys want to tell me some advice on how to improve the code
tell me i willl be happy to hear it
and if u want the upload file part
ask me
i will show it

Edited by nicnicnic, 19 November 2008 - 11:12 AM.


#12
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts

John said:

Xav, use PHP tags when posting PHP -rep for you mister.
Excuse me? I was posting HTML with PHP embedded in it. I wanted the HTML to be highlighted, not the PHP. -rep
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums