Some Code Wanted Please

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Some Code Wanted Please

    hi. been trying to do this myself for days . i get to a stage then it goes no further so am asking for proffesional help .
    i have a mysql database and i want to put on my site the last forum post on my main welcome page and make it a link so ppl can go straight to it instead of clicking to go to forum then to a certain forum then to find that post.

    i know its probably only 4 or 5 lines of code but its doing my head in lol.

    so if anyone can help i be much obliged .
    Wapchat4u


    Topsites4u

    #2
    its more like 1 line of code its somewhere in here in a thread called lavalair script mods or something search for that

    Comment


      #3
      if its 4 lava i posted tht code sumwhr at this forum.... dnt knw at wich topic thou.... search lil bit
      sigpiceeeeerrr....

      Comment


        #4
        no its not for lava but am sure i can manage to work it out for my script if i can find it lol
        Wapchat4u


        Topsites4u

        Comment


          #5
          $result = mysql_query("SELECT * FROM forumindex");
          $forum = mysql_num_rows($result);

          put the code like

          $result = mysql_query("SELECT * FROM forumindex");
          $forum = mysql_num_rows($result);
          echo "
          <a href=\"forum.phpusername=$username&amp;password=$p assword\">-forums ($forum)-</a>"; or how ever your links are

          Comment


            #6
            select the max id from ur post table, next get watever data u want based on the id n show it wherever u want to

            Comment


              #7
              this is untested so i dont know if it will work as it is now, but it basically orders all the topic titles by the &#39;time&#39; and limits how many it will show by 1

              it then defines $ttitle and $tid simply because it is easier to follow what happens and are not neccessary

              the link is then just filled in with the information

              as i said before, this probably isnt correct code, but hopefuly it gives you an idea of the processes needed to do what you need to do .. ?

              Code:
              $last_post = mysql_fetch_array(mysql_query("SELECT title, id, time FROM `topics` ORDER BY time desc LIMIT 1"));
              
              $ttitle = $last_post[0];
              $tid = $last_post[1];
              
              echo "<a href=\"forum.php?topic=$tid&amp;username=$username&amp;password=$password\">$tid</a>";
              EDIT: sorry .. had an extra line of code that i accidentally forgot to remove .. all done now =]

              Comment

              Working...
              X