need some help

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

    need some help

    hello

    PHP Code:
    $lpt mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_topics ORDER BY
    lastpost DESC LIMIT 1"
    ));
    $nops mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_posts WHERE tid = '".$lpt[0]."'"));
    if(
    $nops[0]==0)
    {
    $pinfo mysql_fetch_array(mysql_query("SELECT authorid FROM ibwf_topics WHERE id = '".$lpt[0]."'"));
    $tluid $pinfo[0];
    }else{
    $pinfo mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_posts ORDER BY dtpost
    DESC LIMIT 1"
    ));
    $tluid $pinfo[0];
    }
    $tlnm htmlspecialchars($lpt[1]);
    $tlnick getnick_uid($tluid);
    $tpclnk "<a
    href="
    index.php?action=viewtpc&amp;tid=$lpt[0]&amp;go=last&amp;sid=$sid">$tlnm</a>";
    $vulnk "<a
    href="
    index.php?action=viewuser&amp;who=$tluid&amp;sid=$sid">$tlnick</a>";
    echo 
    "<div><center><b>Last Post: $tpclnk, BY: $vulnk</b><br/></center></div>"

    this is my last post code.i am getting some problem with it.

    suppose a member of my site john has posted a reply in a topic.and if a staff of my site deletes johns reply then it should also get deleted from last post code as above.

    but last post still shows johns topic name and "by" shows name of person who posted last in forums, before my staff deleted johns post from that topic.


    what is problem in it? it shows me wrong last post even when a staff deleted post of john? looks like poster name code is fine but the problem is with last forum post code. what is mistake here?
    sigpic

    WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

    #2
    The delete section needs to add the second last post to be added in the ibwf_topics sql in the delete section

    Can you show the delete section of the script?
    Last edited by something else; 08.06.15, 16:12.

    Comment


      #3
      PHP Code:
      $pid $_GET["pid"];
        
      $tid gettid_pid($pid);
        
      $fid getfid_tid($tid);


      $res mysql_query("DELETE FROM ibwf_posts WHERE id='".$pid."'");
        if(
      $res)
                {
                  
      $tname mysql_fetch_array(mysql_query("SELECT name FROM ibwf_topics WHERE id='".$tid."'"));
                  
      mysql_query("INSERT INTO ibwf_mlog SET action='posts', details='<b>".getnick_uid(getuid_sid($sid))."</b> Deleted Post Number $pid Of the thread ".mysql_escape_string($tname[0])." at the forum ".getfname($fid)."', actdt='".time()."'");
                  
                  echo 
      "<img src="../images/ok.gif" alt="O"/>Post Message Deleted";
                }else{
                  echo 
      "<img src="../images/notok.gif" alt="X"/>Database Error";
                } 
      sigpic

      WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

      Comment


        #4
        Ugh i forget how badly scripted Lava is >.<
        There is much better ways of doing it than this - there isn't any real need for a lastpost field in the database if it was scripted better.

        To wipe it away it is on the lines of:
        PHP Code:
        $nops mysql_fetch_array(mysql_query("SELECT MAX(id), uid, text FROM ibwf_posts WHERE tid = '".$lpt[0]."'")); 
        text might be the wrong field name - as i have no ibwf_posts sql at hand and not in the mood to download it

        Comment


          #5
          this is posts table

          PHP Code:
          --
          -- 
          Table structure for table `ibwf_posts`
          --

          CREATE TABLE IF NOT EXISTS `ibwf_posts` (
            `
          idint(100NOT NULL auto_increment,
            `
          textblob NOT NULL,
            `
          tidint(100NOT NULL default '0',
            `
          uidint(100NOT NULL default '0',
            `
          dtpostint(100NOT NULL default '0',
            `
          reportedchar(1NOT NULL default '0',
            `
          quoteint(100NOT NULL default '0',
            
          PRIMARY KEY  (`id`)
          ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10255 
          sigpic

          WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

          Comment


            #6
            I got the fields correct
            PHP Code:
            $nops mysql_fetch_array(mysql_query("SELECT MAX(id), uid, text FROM ibwf_posts WHERE tid = '".$lpt[0]."'"));  
            echo 
            "Last Post: <a href="index.php?action=viewuser&amp;who=$nops[1]&amp;sid=$sid">.getname_uid($nops[1])."</a>: <a href="index.php?action=viewtopic&amp;tid=$tid&amp;sid=$sid">$nops[2]</a>"; 
            Sorry the links and function names maybe wrong as i am going by memory.

            Comment


              #7
              it didnt worked.i used this and changed with yours.

              PHP Code:
              $lpt mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_topics ORDER BY
              lastpost DESC LIMIT 1"
              ));
              //$nops = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_posts WHERE tid = '".$lpt[0]."'"));


              $nops mysql_fetch_array(mysql_query("SELECT MAX(id), uid, text FROM ibwf_posts WHERE tid = '".$lpt[0]."'"));
              if(
              $nops[0]==0)
              {
              $pinfo mysql_fetch_array(mysql_query("SELECT authorid FROM ibwf_topics WHERE id = '".$lpt[0]."'"));
              $tluid $pinfo[0];
              }else{
              $pinfo mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_posts ORDER BY dtpost
              DESC LIMIT 1"
              ));
              $tluid $pinfo[0];
              }
              $tlnm htmlspecialchars($lpt[1]);
              //$tlnick = getnick_uid($tluid);

              $tlnick getnick_uid($nops[1]);

              $tpclnk "<a
              href="
              index.php?action=viewtpc&amp;tid=$lpt[0]&amp;sid=$sid&amp;go=last">$nops[2]</a>";
              $vulnk "<a
              href="
              index.php?action=viewuser&amp;who=$nops[1]&amp;sid=$sid">$tlnick</a>";
              echo 
              "<b>Last Post: $tpclnk, BY: $vulnk</b><br/>"
              sigpic

              WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

              Comment


                #8
                i m new here and i didnt find where is the option to ask a question or post a new topic. i want to know about php designer 8 installition and database link up process with php designer 8,can anyone help me or send me msg with the appropiate link

                Comment


                  #9
                  hello welcome here

                  please click on forums category and u will see new topic. click on it.go to the link below to download php designer 8




                  sigpic

                  WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

                  Comment

                  Working...
                  X