Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7001699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:50:11+00:00 2026-05-27T20:50:11+00:00

I’ve put together the code below that lists and allows me to delete members.

  • 0

I’ve put together the code below that lists and allows me to delete members.

Solution

    <?php
    $db_host = 'hostname';
    $db_user = 'username';
    $db_pwd = 'password';

    $database = 'databasename';
    $table = 'tablename';
    // use the same name as SQL table

    if (!mysql_connect($db_host, $db_user, $db_pwd)) 
    die("Can't connect to database"); 

    if (!mysql_select_db($database)) 
    die("Can't select database"); 

    function sql_safe($s)  
{  
    if (get_magic_quotes_gpc())  
        $s = stripslashes($s);  

    return mysql_real_escape_string($s);  
}  

if ($_SERVER['REQUEST_METHOD'] == 'POST')  
{  
    if (isset($_POST["submit"]))  
    {  
        if (isset($_POST['del'])) 
            $userid = intval($_POST['del']); 

        if (mysql_query("DELETE FROM {$table} WHERE userid={$userid}")) 
            $msg = 'The member who you selected has now been deleted!';  
        else 
            $msg = 'Could not delete the selected member'; 
    } 
}  
?> 
<html><head> 
<title>Save Photo(s) to Find</title>
<style type="text/css">
<!--
.style1 {
    color: #FFFFFF;
    font-size: 18px;
    font-family: Calibri;
}
.style2 {
    font-size: 18px;
    font-weight: bold;
    font-family: Calibri;
}
.style3 {font-family: Calibri}
.style6 {font-size: 16px}
.style7 {font-family: Calibri; font-size: 16px; }
-->
</style>
</head> 
<body>
<p class="style7">
<?php 
if (isset($msg)) // this is special section for 
// outputing message 
{ 
?></p>
<p class="style7">
  <?=$msg?>
</p>
<?php 
} 
?>
<form action="<?=$PHP_SELF?>" method="POST" enctype="multipart/form-data"> 
<?php 
$result = mysql_query("SELECT userid, forename, surname, subscriptionexpiration FROM {$table} ORDER BY userid DESC"); 
if (mysql_num_rows($result) == 0) // table is empty 
echo 'There are no members to view'; 
else 
{ 
echo "<table>\n"; 
while(list($userid, $forename, $surname, $subscriptionexpiration) = mysql_fetch_row($result)) 
{ 
echo "<tr>\n" 
."<td><input type='radio' name='del' forename, surname value='{$userid}' /></td>\n" 
."<td><small>{$forename} {$surname}</small><td>\n" 
."<td><small>{$subscriptionexpiration}</small><td>\n" 
."</tr>\n"; 
} 
echo "<tr><td colspan=\"3\">"; 
echo '<input type="submit" value="Delete Selected Member" name="submit"/>'; 
echo "</td></tr>"; 
echo '</table>'; 
} 
?> 
<input type="hidden" name="action" id="action" /> 
</form> 
</body>
</html>

To make it a little easier for me, I’d like to be able to insert the outputted list into a table on my form with the first column containing the bullet point, radio button and name of the member and the last column to show the ‘Subscription Expiration Date’.

I’ve tried to simply move the php script into the table columns but this simply doesn’t work because I can’t, or should I say, don’t know how to incorporate the PHP and HTML elements together.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:50:12+00:00Added an answer on May 27, 2026 at 8:50 pm

    I eddited your code and replaced the list items (ul and il) with table tags (table,tr, and td).

    $result = mysql_query("SELECT userid, forename, surname, subscriptionexpiration FROM {$table} ORDER BY userid DESC"); 
    if (mysql_num_rows($result) == 0) // table is empty 
    echo 'There are no members to view'; 
    else 
    { 
        echo "<table>\n";
        while(list($userid, $forename, $surname, $subscriptionexpiration) = mysql_fetch_row($result)) 
        { 
            echo "<tr>\n"
            ."<td><input type='radio' name='del' forename, surname value='{$userid}' /></td>\n"
            ."<td><small>{$forename} {$surname}</small><td>\n"
            ."<td><small>{$subscriptionexpiration}</small><td>\n"
            ."<td><input type=\"submit\" value=\"Delete Selected Member\" onclick=\"document.getElementById('action').value='delete'\" /><td>\n"
            ."</tr>\n";
        } 
        echo '</table>';  
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.