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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:20:20+00:00 2026-06-05T21:20:20+00:00

I have a php script that inserts data from an Android app into a

  • 0

I have a php script that inserts data from an Android app into a MySQL DB. Some of the submitted values are set to “N/A” text when submitted. I have confirmed that the values sent from the Android device are indeed “N/A”. All of the “N/A” text values are saved correctly to my MySQL DB except for at two fields/columns. The values appear as “N/” in these two fields/columns instead of “N/A”. I am using mysql_real_escape_string() on the entered data.

The data is sent as a JSON object string to the PHP script:

$q = json_decode(stripslashes($_POST['questionnaire']), true);

This is a section of the php script where the values are inserted into MySQL DB. It is the values at q3_7 and q4_3 that are truncated from “N/A” to “N/”:

$query_insert = "INSERT INTO people (q_id, first_name, surname, gender, age, race, q2_7, q2_8, q2_9, q2_10, q2_11, q2_11_1, q3_1, q3_2, q3_3, q3_4, q3_5, 
                q3_6, q3_7, q3_8, q3_9, q3_10, q3_11_1, q3_11_2, q3_11_3, q3_12, q3_13, q4_1, q4_2, q4_3, q4_4, q4_5, q5_1, q5_2, q5_3) VALUES";
$values = "";
$count = 0;
foreach ($q[people] as $entry) {
    $values .= "('".mysql_real_escape_string($q[qID])."', '".mysql_real_escape_string($entry[firstName])."', '".mysql_real_escape_string($entry[surname])."',
                '".mysql_real_escape_string($entry[gender])."', '".mysql_real_escape_string($entry[age])."', '".mysql_real_escape_string($entry[race])."',
                '".mysql_real_escape_string($entry[q2_7])."', '".mysql_real_escape_string($entry[q2_8])."', '".mysql_real_escape_string($entry[q2_9])."',
                '".mysql_real_escape_string($entry[q2_10])."', '".mysql_real_escape_string($entry[q2_11])."', '".mysql_real_escape_string($entry[q2_11_1])."', 
                '".mysql_real_escape_string($entry[q3_1])."', '".mysql_real_escape_string($entry[q3_2])."', '".mysql_real_escape_string($entry[q3_3])."', 
                '".mysql_real_escape_string($entry[q3_4])."', '".mysql_real_escape_string($entry[q3_5])."', $first_map_insert_id + $count*2, 
                '".mysql_real_escape_string($entry[q3_7])."', '".mysql_real_escape_string($entry[q3_8])."', '".mysql_real_escape_string($entry[q3_9])."', 
                '".mysql_real_escape_string($entry[q3_10])."', '".mysql_real_escape_string($entry[q3_11_1])."', '".mysql_real_escape_string($entry[q3_11_2])."', 
                '".mysql_real_escape_string($entry[q3_11_3])."', '".mysql_real_escape_string($entry[q3_12])."', '".mysql_real_escape_string($entry[q3_13])."', 
                '".mysql_real_escape_string($entry[q4_1])."', $first_map_insert_id + $count*2 + 1, '".mysql_real_escape_string($entry[q4_3])."', 
                '".mysql_real_escape_string($entry[q4_4])."', '".mysql_real_escape_string($entry[q4_5])."', '".mysql_real_escape_string($entry[q5_1])."', 
                '".mysql_real_escape_string($entry[q5_2])."', '".mysql_real_escape_string($entry[q5_3])."'),";
    $count++;
}
$query_insert = $query_insert . substr($values, 0, -1) . ";";
$result = mysql_query($query_insert) or errorReport("Error in query: $query_insert. ".mysql_error());

As mentioned the “N/A” text values are only truncated to “N/” at two of the fields. The rest of the values for the other fields are saved correctly as “N/A”. Any ideas or help would be appreciated.

  • 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-05T21:20:22+00:00Added an answer on June 5, 2026 at 9:20 pm

    Input length must not exceed database table column length.

    Maybe these two fields is shorter, on database table?

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

Sidebar

Related Questions

I'm creating a PHP script that imports some data from text files into a
I have a PHP script that creates an entry into a mysql database. The
I have a php script that process keywords from a mysql table keywords (columns:
I have a PHP script that in every run, inserts a new row to
I have a php script that needs to run for quite some time. What
I have a ajax call to a php script that updates my MySQL DB
I have made a script that run various loops and does some SQL inserts.
I've got a PHP script that deletes old data from a database, reads data
I have a PHP script that is inserting a record into a database after
I have the following PHP script which runs nicely and inserts all the data

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.