Jump to content

AJLX

Members
  • Posts

    37
  • Joined

  • Last visited

Posts posted by AJLX

  1. Hello guys,

     

    Using ChemicalBliss's code I get the following returned:

    Array ( )
    
    Warning: Invalid argument supplied for foreach() in /home/ajlxcou1/public_html/ProjectA/delete_message.php on line 8
    

     

    My guess would be that the array is empty. Which then means that the foreach statement has nothing to run, and therefor throws me back an error? Is this correct? I'm not asking you guys to write this for me, but a prod in the right direction is useful!

     

    Regards,

     

    AJLX

     

  2. It is worth noting that the check box code sits in a 'while' statement so that there are lots of them, each of which have the message ID attached to them. I want to then delete messages by this ID.

     

    Regards

     

    AJLX

  3. Hello All,

    Hopefully this should be an easy one. I have the following select box:

     

    echo '<td><input name="checkbox[]" type="checkbox"  id="checkbox[]" value='.$row['ID']."></td>";
    

     

    I get these variables on a separate page and try and run them through a loop so that I can delete all of the select items. It is this bit that I'm struggling with at the moment. Here is what I have so far:

     

    <?php
    session_start();
    include("inc/session.inc.php");
    include("inc/conf2.inc.php");
    
        foreach($_POST['checkbox'] as $value);
         $sql_query = mysql_query("DELETE FROM messages WHERE ID = '$value'");
    ?>
    

     

    At the moment this doesn't appear to be working. Does anyone have any ideas?

     

    Regards

     

    AJLX

  4. Hello Guys,

    I have a column named message_status it can only have the values "read" or "unread" in it. I would like to show an image in the column next to it. If the message is "read" then I would like to display a green dot, and if it is unread I would like to display a red dot. I would also like to be able to have anything in the row that's "unread" to appear in bold. I completely stumped by this! I have written the following code, which doesn't seem to work, presumably because it is run after the table has been displayed? I am very new to this so please be gentle!

     

    Regards,

     

    AJLX

     

    
    $result = mysql_query("SELECT * FROM messages where username ='$username'ORDER BY {$_GET['orderbycol']} $sort");
    
    echo "<table border='1'>
    <tr width='200'>
    <th>View</th>
    // code to display table removed
    </tr>"; 
    $green_dot = $message_status; 
    $red_dot = $message_status;
    $green = "";
    $red = "";
    $bold = "";
    while ($row = mysql_fetch_array($result))
    {
      echo  "<tr>";
      $id = $row['ID'];
      echo  "<td><a href='/view_message.php/?view_message=$id'>View</a></td>";
      echo "<td>"  .$green . $red."</td>";
      echo  "<td>" .$bold . $message_status = $row['message_status'] . "</td>";
      echo  "<td>" .$bold. $row['date_sent'] . "</td>";
      echo  "<td>" .$bold. $row['contact_name'] . "</td>";
      echo  "<td>" .$bold. $row['subject'] . "</td>";
      echo  "</tr>";
    }
    if ($green_dot = 'read'){
    $green ='<img src=\"assets/red.jpg\"/>';
    echo $green;
    } else {
      $red ='<img src=\"assets/red.jpg\"/>';
      $bold = "<b>";
      echo $red;
    
    
    

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.