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

The Archive Base Latest Questions

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

I am working on a control panel (admin pages) for a website. All the

  • 0

I am working on a control panel (admin pages) for a website. All the pages have the same code with little changes in the database table name and columns. All of them work fine, but one page doesn’t work.

This is its code….

<?php
include('connect.php');

// read the input data
$KTitle   = $_POST['Title'];
$Kcontent = $_POST['content'];
$ImgName  = $_FILES["file"]["name"];

//get img extension
$ImgExtension = substr($ImgName, (strlen($ImgName) - 4), strlen($ImgName));
//check if it Gif, Bng, Jpg
if ($ImgExtension == ".gif" || $ImgExtension == ".jpg" || $ImgExtension == ".png")
{ //get img name to rename it then readd the extinsion
    $ImgName      = substr($ImgName, 0, (strlen($ImgName) - 4));
    $storyImgName = $ImgName . "_" . $Title;
    $target       = "../CharacterImgs/" . $storyImgName . $ImgExtension;
    $target       = str_replace(" ", "_", $target);

    move_uploaded_file($_FILES['file']['tmp_name'], $target);
    mysql_query("INSERT INTO CharactersN (name,desc,img) VALUES ('$KTitle', '$Kcontent','$target')");

    echo "<meta http-equiv=\"refresh\" content=\"3;URL=AddCharacterForm.php\">";
}
?>
  • 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-27T01:37:26+00:00Added an answer on May 27, 2026 at 1:37 am

    You have a problem here:

    INSERT INTO CharactersN (name,desc,img)
    

    desc is a reserved word, so you must use the ` notation there, which is like this:

    INSERT INTO CharactersN (`name`,`desc`,`img`)
    

    It is a good practice to use this notation for field names every time (or never use reserved words for field names in your database design).


    Also, please read about SQL Injection, because your code shows you are not aware of it. You are inserting values into your query which are coming from outside (POST in this case).

    VALUES ('$KTitle', '$Kcontent','$target')")
    

    You should escape these values first with mysql_real_escape_string(), or even better, use PDO for your database interaction.

    enter image description here
    from xkcd

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

Sidebar

Related Questions

I have a custom post_type created in wordpress admin control panel. all is working
For an app I'm working on, I'd like to have a control panel window
Currently, I have this version of the autocomplete control working when returning XML from
I have been working on standardizing the source control structure for our Team Foundation
I'm working on a Silverlight Polling control. My goal is to have a Button
Earlier today, I decided to start working on a small control panel for administration
I'm working on a custom panel control and one of the things I'm trying
i careate button control and place in panel but not working? protected void Button1_Click(object
I'm currently working on a SilverLight text editor for my site control panel, I
I'm working on a package that includes a control panel created using plone.app.registry. I

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.