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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:07:40+00:00 2026-05-13T11:07:40+00:00

Thanks for all your help, I now have add, update, and delete functions on

  • 0

Thanks for all your help, I now have add, update, and delete functions on my database manipulation program.
But I’m having difficulty on searching for records in mysql database.
Please help me in correcting my codes, and if you know a site that I can use as my reference please do tell. Thanks, here is my search code:

         <?php
      $con = mysql_connect("localhost","root","");
      if (!$con)
   {
     die('Could not connect: ' . mysql_error());
   }

      mysql_select_db("koro", $con);

     mysql_query("UPDATE student 
    WHERE IDNUMBER ='$_POST[INAME]'");

    while ($row = mysql_fetch_array($query)) 
    { 
      $variable1=$row["IDNUMBER"]; 
      $variable2=$row["LNAME"]; 
      $variable3=$row["FNAME"]; 
      $variable3=$row["MNAME"]; 
      $variable3=$row["GRADEYR"]; 
      $variable3=$row["ADDRESS"]; 
          } 

       mysql_close($con);

      ?>

And here is the html form that I’m using, and I think this is where the problem is. I don’t have any idea on how to put the results in the text box.

  • 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-13T11:07:40+00:00Added an answer on May 13, 2026 at 11:07 am

    Check the documentation for mysql_query: it returns TRUE or FALSE for UPDATE queries. If you want the new values, follow the UPDATE with a select.

    More importantly, your code is vulnerable to SQL injection. The best solution is to switch from the outdated mysql driver to PDO.

    Unpacking an array into separate variables (as you do) is unnecessary. It’s also problematic: notice how you’ve mistyped the last few names as $variable3.

    Also, don’t use “or die” (except in very limited circumstances).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks for your help! I'd like to output all companyName entries that have uploads
A bit confusing this one but should make sense. Thanks to all your help
and thanks in advance for your help! Here's my situation: I have a set
Thank you all for your help. A number of you posted (as I should
I am a newbie to VBS scripting. Thanks for all your comments! I fixed
first of all thanks for taking your time! I'm a junior Dev, working with
thanks for all the help the last few days. I'm hoping someone knows this
First, thanks for all the help I've received so far from StackOverflow. I've learned
Hello i have the this problem, i need your help to figure out what
I have this Chrome Extension, it adds a poke all button under your pokes.

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.