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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:24:51+00:00 2026-06-07T08:24:51+00:00

I am trying to build a PHP Form with MySQL. The problem is that

  • 0

I am trying to build a PHP Form with MySQL. The problem is that I get an error every time if I try to add some long Text into the field.

The error

You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near…..at line 1

The PHP code generating the query is this:

<?php

if ( $_GET['aktion'] == "speichern" )
{
    $title          = $_GET['title'];
    $description    = $_GET['description'];
    $applepart      = $_GET['applepart'];
    $partnumber     = $_GET['partnumber'];
    $productcode    = $_GET['productcode'];
    $compatibility  = $_GET['compatibility'];
    $url_bild       = $_GET['url_bild'];
    $price          = $_GET['price'];

    $sql  = "INSERT INTO adressbuch ";
    $sql .= " SET ";
    $sql .= " title         = '$title', ";
    $sql .= " description   = '$description', ";
    $sql .= " applepart     = '$applepart', ";
    $sql .= " partnumber    = '$partnumber', ";
    $sql .= " productcode   = '$productcode', ";
    $sql .= " compatibility = '$compatibility', ";
    $sql .= " url_bild      = '$url_bild', ";
    $sql .= " price         = '$price' ";

    require_once ('konfiguration.php');
    $db_erg = mysql_query($sql)
        or die("Anfrage fehlgeschlagen: " . mysql_error());

    echo '<h1>Adresse wurde speichert</h1>';
    echo '<a href="auflistung.php">Auflistung anzeigen</a>';
    exit;
}
?>

<form name="" action="" method="GET" enctype="text/html">
<p>Title:<br />
<input type="text" name="title" value="" size="60" />
</p>
<p>description:<br />
<input type="text" name="description" value="" size="60" />
</p>
<p>applepart:<br />
<input type="text" name="applepart" value="" size="60" />
</p>
<p>partnumber:<br />
<input type="text" name="partnumber" value="" size="60" />
</p>
<p>productcode:<br />
<input type="text" name="productcode" value="" size="60" />
</p>
<p>compatibility:<br />
<input type="text" name="compatibility" value="" size="60" />
</p>
<p>Bild:<br />
<input type="text" name="url_bild" value="" size="60" />
</p>
<p>price:<br />
<input type="text" name="price" value="" size="60" />
</p>

<input type="hidden" name="aktion" value="speichern" />

<input type="Submit" name="" value="speichern" />
</form>

Thanks for your help

  • 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-07T08:24:53+00:00Added an answer on June 7, 2026 at 8:24 am

    Your code is susceptible to SQL injection, and your problem is only a hint as to why.

    The rule we always use is: “Never trust data from the user-agent” (i.e. consider anything in $_GET or $_POST as potentially problematic or worse). At a minimum, we should always escape these values using mysqli_real_escape_string or else a more robust DB framework.

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

Sidebar

Related Questions

I'm trying to build a PHP form that outputs custom JSON code. Take a
I'm trying to build a PHP function that allows me to have an array
I am trying to build a php class that will let me include other
I'm trying to build a custom search form using PHP and I'm looking for
having some issues with a callback request form I'm trying to build for a
I'm trying to build a simple HTML table form that displays values from a
I'm trying to build a query using php and mysql, $query = select *
Using PHP and MySQL, I have a forum system I'm trying to build. What
I am trying to use php for my form validation for the first time.
I am trying to convert a paper form to a PHP form that will

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.