Closed Thread
Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

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

  1. #11
    nicnicnic is offline Newbie
    Join Date
    Nov 2008
    Posts
    16
    Rep Power
    0

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

    HTML Code:
    <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>
    Code:
    <?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']?>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <?         
             
    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
    Last edited by nicnicnic; 11-19-2008 at 11:12 AM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #12
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

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

    Quote Originally Posted by John View Post
    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

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  4. #13
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

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

    Quote Originally Posted by nicnicnic View Post

    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
    One suggestion, if you want to go more advanced, is to store the pictures in the database instead of the filesystem. I's a little bit more tricky, but it is helpful if there are going to be many pictures.

    Part I: Tutorial: Storing Images in MySQL with PHP
    Part II: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

  5. #14
    nicnicnic is offline Newbie
    Join Date
    Nov 2008
    Posts
    16
    Rep Power
    0

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

    rgr ty orjan

    and ty all !

Closed Thread
Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 05-24-2011, 05:55 AM
  2. MAKE Problem - Command Not Found
    By BigLinux in forum Linux Applications
    Replies: 4
    Last Post: 07-05-2009, 01:35 AM
  3. Google Indexing Problem
    By Crane in forum Search Engine Optimization
    Replies: 12
    Last Post: 04-18-2007, 06:35 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts