need some help

Started on the old forum in June 2015 · view the original in the archive · old links redirect here

8 replies · 189 views · started 11 years ago · 1 min read

3 participants
thunderwap Developer · 169 posts #1

hello

$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&tid=$lpt[0]&go=last&sid=$sid">$tlnm</a>";
$vulnk = "<a
href="index.php?action=viewuser&who=$tluid&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?

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

something else Fellow · 2,296 posts #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?

thunderwap Developer · 169 posts #3
$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";
          }
  

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

something else Fellow · 2,296 posts #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:

$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

thunderwap Developer · 169 posts #5

this is posts table

--
-- Table structure for table `ibwf_posts`
--

CREATE TABLE IF NOT EXISTS `ibwf_posts` (
  `id` int(100) NOT NULL auto_increment,
  `text` blob NOT NULL,
  `tid` int(100) NOT NULL default '0',
  `uid` int(100) NOT NULL default '0',
  `dtpost` int(100) NOT NULL default '0',
  `reported` char(1) NOT NULL default '0',
  `quote` int(100) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10255 ;

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

something else Fellow · 2,296 posts #6

I got the fields correct 🙂

$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&who=$nops[1]&sid=$sid">.getname_uid($nops[1])."</a>: <a href="index.php?action=viewtopic&tid=$tid&sid=$sid">$nops[2]</a>";

Sorry the links and function names maybe wrong as i am going by memory.

thunderwap Developer · 169 posts #7

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

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

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

ezaman Newbie · 6 posts #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

thunderwap Developer · 169 posts #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

http://php-designer.en.softonic.com

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

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close