Jump to content

Recommended Posts

Hey guys.  Sorry to keep posting so many questions but this forum has extremely talented people in it that seem to know what they're doing.

 

So here's the idea that I have: I've just queried a database to bring back everything.  Every row and column is visible, and I've added another row after the real data that just consists of an X.  Now, with this X I would like to make the entry disappear to the left it represents.  Is there a way to do this or would it require $_POST, $_GET, or $_REQUEST functions?

 

// if rows exist

if (sqlite_num_rows($result) > 0) {

    // get each row as an array

    // print values

    echo "<table cellpadding=10 border=1>";

    while($row = sqlite_fetch_array($result)) {

        echo "<tr>";

        echo "<td>".$row[0]."</td>";

        echo "<td>".$row[1]."</td>";

        echo "<td>".$row[2]."</td>";

        echo "<td>".$row[3]."</td>";

        echo "<td>".$row[4]."</td>";

        echo "<td><a href=\"deletequery.php?entrynumber=$row[0]\">X</a></td>";

        echo "</tr>";

    }

    echo "</table>";

 

I've got this table so far

Link to comment
https://forums.phpfreaks.com/topic/48690-queried-return/
Share on other sites

Well your link is clearly a get method. Simply make the page deletequery.php do the DELETE FROM bla_bla WHERE bla_bla = ' " . $_GET['entrynumber'] . " ' and then header('Location: wherever.php') to bring them back to the updated page (now that a row is deleted). however if you want it on instant, like he said above, use AJAX, or iframes to at least make it appear like they are not refreshing the page.

Link to comment
https://forums.phpfreaks.com/topic/48690-queried-return/#findComment-238524
Share on other sites

Make this smaller:

        echo "<td>".$row[0]."</td>";
        echo "<td>".$row[1]."</td>";
        echo "<td>".$row[2]."</td>";
        echo "<td>".$row[3]."</td>";
        echo "<td>".$row[4]."</td>";
// ... by doing this...
        foreach ($row as $r) echo "<td>$r</td>";

 

That won't solve anything, but it takes less typing.

 

As for your actual question, I really don't understand what you mean right around the same part as MadTechie is confused.  Can you elucidate?

Link to comment
https://forums.phpfreaks.com/topic/48690-queried-return/#findComment-238530
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.