[HELP] Command + Queries to update SQL

Discussion in 'PHP' started by bigfatpig, Jul 24, 2009.

  1. #1
    Hi all, I need help regarding the following issue. Say for example I am creating a Adminpanel that allows an admin to monitor the site. I wish to have a function whereby admin can approve or delete reveiws submitted by users.

    I have a database table named reviews, and a field review_status = (default at 0) so when a user submits a review, the status is set at 0. What should I script in the PHP so that the admin can insert into review_status that an approved review would have 1 and if the review contains anything unwanted the admin can delete the review? Your help and suggestion is greatly appreciated. Please advice.

    <?
    echo  "</head>
     <body onload=\"FullScreen_go();\">
     <div>";
      $header = "Pending Reviews";
        include("header.html.php");
    
    $query = "SELECT * FROM reviews where review_status = 0 ORDER BY id ASC"; 
    $approve = "";
    $delete = "";
    	
    	$result = mysql_query($query) or die(mysql_error());
    	
    	
        while($row = mysql_fetch_row($result)) { 
            echo "<div style='height:65px;'><tr>";
            echo "<td><ul><font color=666666>Restaurant:</font>".$row[1]."<br>";
    		echo "<font color=666666>Title: </font>".$row[6]."<br>";
    		echo "<font color=666666>Review: </font>".$row[7]."<br>";
    		echo "<font color=666666>Written By: </font>".$row[8]."<br>";
    		echo "<font color=666666>Date Joined: </font>".$row[9]."<br>";
    		echo "<font color=666666>Review Status:</font><b> Approve | Delete </b><br>";
    		echo "</tr>";
    		echo "</table>";
    		echo "</div>";
    		}
    ?>
    Code (markup):
     
    bigfatpig, Jul 24, 2009 IP
  2. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #2
    what's that hard to do a query by $_GET to say
    update tbl set status = '1' where id = '$_GET[param]'
     
    crivion, Jul 24, 2009 IP
  3. bigfatpig

    bigfatpig Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    How can i get the param? where id would be that specific id of the review?
     
    bigfatpig, Jul 25, 2009 IP
  4. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #4
    if your php knowledge is equal to 0 this is no place
    go to w3 schools or tizag first and learn basic things then you can ask
     
    crivion, Jul 25, 2009 IP
  5. HivelocityDD

    HivelocityDD Peon

    Messages:
    179
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can make these Approve | Delete as links which passes the id = approve or
    id=delete and use $_GET[id] to get the parameter value and perform the needed operation

    Thanks !!
     
    HivelocityDD, Jul 25, 2009 IP