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 6930271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:25:32+00:00 2026-05-27T11:25:32+00:00

The code below is meant to delete the record who’s id is the one

  • 0

The code below is meant to delete the record who’s id is the one rendered on the page from the query select. I am having problems how to delete that row . So instead of id = ‘233’” get the table id and delete. Can you kindly look in this code, and suggest a solution?Thanks

<form name="form1" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">

<?php


/* New Code */
//if($_POST['formSubmit'] == "Submit") 
if (isset($_POST['formSubmit']))

{
$courseid=$_POST['rowid'];
$db8=& JFactory::getDBO();
$db8->setQuery("DELETE FROM jos_jquarks_persontraining WHERE
  id = '233'");
 $db8->query();
echo $courseid;

}

$database =& JFactory::getDBO();
// Display enrollments
echo "<h1>";
echo "<span style='text-decoration: underline;'>";
echo "Courses : " ;
echo "</h1>";
echo "</b>";

echo "</br>";
echo "</br>";

$database->setQuery("SELECT jos_jquarks_persontraining.id as trainingid,training.training, 
DATE_FORMAT(training.trainingDate, '%W, %M %e, %Y'),
training.trainingHour, training.course_location,
date_format(jos_jquarks_persontraining.timeStamp,'%m/%d/%Y')  
FROM jos_jquarks_persontraining 
INNER JOIN training ON  jos_jquarks_persontraining.training_id = training.training_id
WHERE
  jos_jquarks_persontraining.user_id =  " .$id  ) ;

if (!$database->query()) 
{ 
    echo "<script> alert('".$database->getErrorMsg()."'); </script>";
}

$tableStyle = "padding: 5px;border:1px solid black"; 
$tdStyle = "padding:5px"; 
$thStyle = "padding:7px";

$row = $database->loadRowList();
if ( 0<count($row)) {
    echo '<table style="', $tableStyle, '" cellpadding="7" cellspacing="7">';  
    echo '<tr><th style="', $thStyle, '" align=center>Id</th><th style="', $thStyle, '" align=center>Course</th><th style="', $thStyle, '" align=center>Date</th>
    <th style="', $thStyle, '" align=center>Time</th>
<th style="', $thStyle, '" align=center>Location</th>

<th style="', $thStyle, '" align=center>Enrollment Date</th>
<th style="', $thStyle, '" align=center>Action</th>'; 


    $row = $database->loadRowList();
    foreach($row as $valuearray) {
        echo '<tr align="center">';

        foreach($valuearray as $field){
            echo '<td style="', $tdStyle, '" align=center>', $field, '</td>'; 

        } // field
        echo '</tr>';

echo '<tr align="center">';
echo'<td>';
//echo '<input type="submit" name="formSubmit" value="Unenroll" />';
echo '<input type="hidden" name="rowid" value="'.$row['ID'].'" ]" />';
echo '<input type="submit" name="formSubmit" value="Unenroll" />';

echo '</td>';
echo '</tr>';


    } // $valuearray
    echo '</table>'; 
}
 // if count
?>
</form>
  • 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-27T11:25:33+00:00Added an answer on May 27, 2026 at 11:25 am

    I believe you want this:

    $db8->setQuery("DELETE FROM jos_jquarks_persontraining WHERE
      id = '".mysql_real_escape_string($courseid)."'");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code I have pasted below is meant to display images on the middle
In the below code sample, what does {0:X2} mean? This is from the reflection
DISCLOSURE: This is homework. The code below is meant to read a command file
I have the following code below that is meant to change a class var
In the code below, from a blog post by Alias , I noticed the
The code below is meant to insert values into a MySQL Database if the
Why is the Child class's converter constructor called in the code below? I mean,
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
Code below is not working as expected to detect if it is in design
Code below is working well as long as I have class ClassSameAssembly in same

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.