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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:32:15+00:00 2026-06-13T20:32:15+00:00

I want to store a php array as JSON in mysql. for that I

  • 0

I want to store a php array as JSON in mysql. for that I have meeting_point_json column with type=’longtext’.

here is the array:

Array
(
    [1] => Array
        (
            [date] => 23/4/2012
            [meeting_time] => 23:04
            [meeting_place] => town hall
            [venue] => London
            [opponents] => Tigers
            [official_incharge] => Mr Putin
        )

    [2] => Array
        (
            [date] => 23/4/2050
            [meeting_time] => 13:04
            [meeting_place] => chief office
            [venue] => Kenya
            [opponents] => Peococks
            [official_incharge] => Mr Black
        )

    [3] => Array
        (
            [date] => dsad
            [meeting_time] => sadas
            [meeting_place] => jjjjj
            [venue] => jjjj
            [opponents] => dasds
            [official_incharge] => asad
        )

)

and here is the php code:

$data = json_encode($_POST['team_meeting_pt']);
    $sql = "UPDATE yami_sub_team set meeting_point_json = $data where id = $subteam_id";
    if(mysql_query($sql)){
        exit("Done!");
    }else{
        die('Something went wrong, changes not saved. Error details: ' . mysql_error());
    }

it should work but Instead, I get an error:

Something went wrong, changes not saved. Error details: 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 '"1":{"date":"23\/4\/2012","meeting_time":"23:04","meeting_place":"town hall","ve' at line 1

Any idea what I am doing wrong here?

  • 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-13T20:32:16+00:00Added an answer on June 13, 2026 at 8:32 pm

    See at:
    $data variable change with ".$data."
    and
    $subteam_id variable with ".$subteam_id."

    remember the sql query only sent as strings, not variable inside there…
    and do it to your all way to write PHP. Always wrap variable with “..” and ‘..’

    “..” and ‘..’ are depending by your strip wrapper:
    For example:
    If look like this
    $string = mysql_query("SELECT DATA FROM ".$variable."");
    So, you must use “..” wrapper !
    and if like this
    $string = mysql_query('SELECT DATA FROM '.$variable.'');
    So, you must use ‘..’ wrapper !

    Good luck friend

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

Sidebar

Related Questions

Some code here, I want store mysql query result into an array with php,
I have an array of php objects that I want to store into a
I just want to ask if there is any PHP/MySQL datatype that can store
I have a an associative array in php that i parse to get json
I have multiple $_POST values which I want to store in an array to
I have an iPhone app with an array of objects that I want to
i am trying to import Mysql column in andorid column here is my php
I have an array that is json encoded and stored into a database. All
I have a JSON string (from PHP's json_encode() that looks like this: [{id: 1,
i have F8 like json file and i want to store and count the

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.