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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:55:11+00:00 2026-06-13T12:55:11+00:00

Here i have a query to my MySql database and I am taking out

  • 0

Here i have a query to my MySql database and I am taking out all the information about a course to be put in a row and displayed in my table. The last column of the table is a check box, that check box I want to make it so it will save the row of data for each row that it is checked off. The variable i chosen was courses[], to be saved in array then saved in session to be accessed else where. I’m not sure how to extract the row data to put in to my array. Right now I have value='$row2013 and that doesnt work because when I var_dump($courses) = array(5) { [0]=> string(5) "Array" [1]=> string(5) "Array" [2]=> string(5) "Array" [3]=> string(5) "Array" [4]=> string(5) "Array" } , Which I have selected five courses.

To sum things up, I am not saving the right thing.

case 2013:
    $string2013 = "SELECT Course.CourseCode, Course.Title, Course.WeeklyHours, Semester.Term, Semester.SemesterCode
    FROM Course, CourseOffer, Semester WHERE Semester.YearNum='$selectedYear' AND Course.CourseCode=CourseOffer.CourseCode AND
    Semester.SemesterCode=CourseOffer.SemesterCode";
    if($Result2013 = mysqli_query($link, $string2013))
    {
        echo "<form action='CourseSelection.php' method='get'>
        <table><tr><th>Code</th><th>Course Title</th><th>Hours</th><th>Term</th><th>Select</th></tr>";
        while($row2013 = mysqli_fetch_assoc($Result2013))
        {
            echo "<tr><td>$row2013[CourseCode]</td><td>$row2013[Title]</td><td>$row2013[WeeklyHours]</td>
            <td>$row2013[Term]</td><td><input type='checkbox' name='courses[]' value='$row2013'></td></tr>";
        }
        echo "</table>";
    }
    else
    {
        echo "<p>" + mysqli_error($link) + "</p>";
    }
    break;
  • 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-06-13T12:55:12+00:00Added an answer on June 13, 2026 at 12:55 pm

    You should try to save only the row ID in the value of checkbox. This way you can easily recall a row from the database by its ID. $row2013["CourseCode"] should work.

    When you do the POST request, you will get an array of IDs ($_POST['courses']). Of course you need to treat it as array, so you must iterate over it in order to get all the rows you selected.

    If you var_dump($_POST['courses']) you should see something like this, assuming you have selected the first 5 rows:

    array (size=5)
      0 => string '1' (length=1)
      1 => string '2' (length=2)
      2 => string '3' (length=3)
      3 => string '4' (length=4)
      4 => string '5' (length=5)
    

    Now just query the database according to the selected rows, and you’re good to go:

    SELECT * 
    FROM Course
    WHERE CourseCode = 1
       OR CourseCode = 2
       OR CourseCode = 3
       OR CourseCode = 4
       OR CourseCode = 5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a mysql database I have table of geographical areas where each row has
i have try to develop one java app.here am getting information from mysql database.
I have a query here pulling data from MySQL database. It's working great.But what
I have a script below which reads on displayed information from my mysql database
I have this query which works correctly in MySQL. More background on it here
I have a problem with (for me to complicated) MySql query. Okay, here is
Here is the query which will get me all the contacts have HD quality
Here I have a MySQL database and I need to retrieve many rows. I
Here where I work I am attending a series of lectures about database query
I have this MySQL query, and it works on a MySQL database, but not

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.