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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:34:24+00:00 2026-06-05T23:34:24+00:00

What would a potential employer think when seeing a function such as: function updTable{$table,

  • 0

What would a potential employer think when seeing a function such as:

function updTable{$table, $primary, $id, $key, $value){
    $primary = mysql_real_escape_string($primary);
    $id = (int) $id;
    $key = mysql_real_escape_string($key);
    $value = mysql_real_escape_string($value);
    $table = mysql_real_escape_string($table);

    mysql_query("UPDATE `{$table}` SET
                `{$key}`=`{$value}` 
                WHERE `{$primary}` = {$id}");

}

Is this bad practice? Are there any good articles on general php / mysql design guidelines (not syntax) I should read and know about?

  • 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-05T23:34:25+00:00Added an answer on June 5, 2026 at 11:34 pm

    The way you are handling your database interaction is from yesteryear. Prepared statements are the norm now and thwart a lot of SQL related attacks.

    Also, depending on your system design, you would never have a need for a function like this. If you were using an MVC pattern, you’d write a method in your model that would handle a certain type of update instead of just a generic table update.

    Looking at this function, what happens if you want to update multiple columns in that table? If, for example, you are updating 3 columns, you would have to make a call to your database 3 times, instead of one time.

    If you want something that could be a very general database layer, take a look at Doctrine or make something very similar to it.

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

Sidebar

Related Questions

I have a potential project where I would be working on developing the Data
It would eliminate whitespace. But, other than poor readability, any potential risks I should
What would be potential strategies to getting the old data into a new db
How would I go about storing potential SQL injection attacks in a database? Assume
Here are two potential workflows I would like to perform in a web application.
Is there any tool that will help detect potential errors like undefined function in
Does anyone have an idea which would be better for potential string replacement? If
Does dependency injection potentially cause large overhead? I would imagine so, especially if the
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode
Would be possible to extend this kind of layout so that I can have

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.