6 Replies - 375 Views - Last Post: 07 June 2011 - 01:46 AM Rate Topic: -----

#1 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 387
  • Joined: 10-April 09

Locking functions

Posted 07 June 2011 - 01:23 AM

It's working, But the problem is that it locks ALL of my topic's!

<?php
$id = (is_numeric($_GET['id'])) ? $_GET['id'] : 0;
$sql = "SELECT * FROM forum_question WHERE id = $id";
$result = mysql_query($sql);
$result = mysql_fetch_array($result);

if ($result['lock'] == 1){

// content

}
else
{
echo 'TOPIC CLOSED!';
}
?>


Is This A Good Question/Topic? 0
  • +

Replies To: Locking functions

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 2899
  • View blog
  • Posts: 7,555
  • Joined: 08-June 10

Re: Locking functions

Posted 07 June 2011 - 01:28 AM

does lock = 1 mean the topic is locked?
Was This Post Helpful? 1
  • +
  • -

#3 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 387
  • Joined: 10-April 09

Re: Locking functions

Posted 07 June 2011 - 01:29 AM

Yes, If there is an 1 place in value lock, then the topic should display "TOPIC IS LOCKED"
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 2899
  • View blog
  • Posts: 7,555
  • Joined: 08-June 10

Re: Locking functions

Posted 07 June 2011 - 01:34 AM

currently you’re showing the content if lock = 1
Was This Post Helpful? 1
  • +
  • -

#5 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 387
  • Joined: 10-April 09

Re: Locking functions

Posted 07 June 2011 - 01:38 AM

So it should be != 0??

And how can i set and ID in there so that it will not lock ALL of my topics? just to the one's i assign it to lock.
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 2899
  • View blog
  • Posts: 7,555
  • Joined: 08-June 10

Re: Locking functions

Posted 07 June 2011 - 01:41 AM

your problem is not in the SQL … lock != 0 is practically the same as lock == 1. you could try lock == 0
Was This Post Helpful? 1
  • +
  • -

#7 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 387
  • Joined: 10-April 09

Re: Locking functions

Posted 07 June 2011 - 01:46 AM

Thank you tons! It worked!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1