Results 1 to 6 of 6

Thread: SQL Help :)

  1. #1
    Join Date
    Apr 2006
    Location
    Salford
    Posts
    2,108
    Tokens
    0

    Latest Awards:

    Default SQL Help :)

    Ok well basicly, i want it so when you press "Delete" it replace's the text someone post's.

    I.e if someone posted "Omg idiot" And i clicked Delete, i want the post to say "This post has been removed by $username who is moderating the forum"

    Here is my code (At the moment it just delete's the post)

    PHP Code:
    <?
    session_start
    ();
    include 
    "includes/db_connect.php";
    include 
    "includes/functions.php";
    include
    "includes/smile.php";
    logincheck();
    $forum=$_GET['forum'];
    $username=$_SESSION['username'];
    $viewtopic $_GET['viewtopic'];
    $forum_look=$_GET['forum_look'];
    $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));

    if(
    $_GET[clean]) { 
    $clean=$_GET[clean];
    if(
    $fetch->userlevel == "2" || $fetch->userlevel == "0") { die('You cannot delete this post!'); }
    mysql_query("DELETE FROM replys WHERE id='$clean' AND forum='$forum'") or die ("<font color=white>Cannot delete reply</font>");
    echo 
    "<font color=white>Reply Deleted</font>!";
    echo 
    "<meta http-equiv='refresh' content='1;url=right.php?forum=$forum&viewtopic=$viewtopic'>";
    }
    if (!
    $viewtopic){
    $viewtopic "1";
    }

  2. #2
    Join Date
    Jul 2007
    Location
    Swindon
    Posts
    990
    Tokens
    125

    Default

    what you need to do is edit the current sql with the message you want to display i honestly cant remember the sql i was thinking it will come to me ina min

  3. #3
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    529
    Tokens
    0

    Default

    Whats the name in the db for the field with the content?

  4. #4
    Join Date
    Apr 2006
    Location
    Salford
    Posts
    2,108
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by RichardKnox View Post
    Whats the name in the db for the field with the content?
    Erm text.

  5. #5
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    PHP Code:
    <?php
    session_start
    ();
    include 
    "includes/db_connect.php";
    include 
    "includes/functions.php";
    include
    "includes/smile.php";
    logincheck();
    $forum=$_GET['forum'];
    $username=$_SESSION['username'];
    $viewtopic $_GET['viewtopic'];
    $forum_look=$_GET['forum_look'];
    $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));

    if(
    $_GET[clean]) { 
    $clean=$_GET[clean];
    if(
    $fetch->userlevel == "2" || $fetch->userlevel == "0") { die('You cannot delete this post!'); }
    mysql_query("UPDATE `replys` SET `text` = 'This post has been removed by $username who is moderating the forum' WHERE id='$clean' AND forum='$forum'") or die ("<font color=white>Cannot delete reply</font>");
    echo 
    "<font color=white>Reply Deleted</font>!";
    echo 
    "<meta http-equiv='refresh' content='1;url=right.php?forum=$forum&viewtopic=$viewtopic'>";
    }
    if (!
    $viewtopic){
    $viewtopic "1";
    }

  6. #6
    Join Date
    Apr 2006
    Location
    Salford
    Posts
    2,108
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    PHP Code:
    <?php
    session_start
    ();
    include 
    "includes/db_connect.php";
    include 
    "includes/functions.php";
    include
    "includes/smile.php";
    logincheck();
    $forum=$_GET['forum'];
    $username=$_SESSION['username'];
    $viewtopic $_GET['viewtopic'];
    $forum_look=$_GET['forum_look'];
    $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));

    if(
    $_GET[clean]) { 
    $clean=$_GET[clean];
    if(
    $fetch->userlevel == "2" || $fetch->userlevel == "0") { die('You cannot delete this post!'); }
    mysql_query("UPDATE `replys` SET `text` = 'This post has been removed by $username who is moderating the forum' WHERE id='$clean' AND forum='$forum'") or die ("<font color=white>Cannot delete reply</font>");
    echo 
    "<font color=white>Reply Deleted</font>!";
    echo 
    "<meta http-equiv='refresh' content='1;url=right.php?forum=$forum&viewtopic=$viewtopic'>";
    }
    if (!
    $viewtopic){
    $viewtopic "1";
    }
    I could marry you. xx

Posting Permissions

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