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

  • Home
  • SEARCH
  • 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 9134669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:42:17+00:00 2026-06-17T08:42:17+00:00

i am sending data from iphone to server using php it is sending data

  • 0

i am sending data from iphone to server using php it is sending data from iphone but not inserting in mysql i am using following php code.

 <?php
  $con =     

  mysql_connect("surveyipad.db.6420177.hostedresource.com","tom","ben");
   if (!$con)
    {
   die('Could not connect: ' . mysql_error());
   }

   mysql_select_db("surveyipad", $con);



   $device_Id=$_POST['device_Id'];
   $R1=$_POST['R1'];
   $R2=$_POST['R2'];
   $R3=$_POST['R3'];
   $comment=$_POST['comment'];
   $update_date_time=$_POST['update_date_time'];

    $query=("INSERT INTO survey_responsese_pfizer (device_Id,R1,R2,R3,comment,update_date_time)

  VALUES ('$device_Id','$R1','$R2','$R3','$comment','$update_date_time')");

   mysql_query($query,$con);
   printf("Records inserted: %d\n", mysql_affected_rows());

    echo($device_Id)
   ?>
  • 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-17T08:42:17+00:00Added an answer on June 17, 2026 at 8:42 am

    Ok one only learns by example, stop using the mysql_functions(), They are no longer maintained and are officially deprecated. And in PHP 5.6 they will most likely be removed, rendering you code broken.

    Move over to PDO with prepared querys.
    A Port of your current code using PDO:

    <?php
    // SQL Config
    $config['sql_host']='surveyipad.db.6420177.hostedresource.com';
    $config['sql_db']  ='surveyipad';
    $config['sql_user']='tom';
    $config['sql_pass']='ben';
    
    // SQL Connect
    try {
            $db = new PDO("mysql:host=".$config['sql_host'].";dbname=".$config['sql_db'], $config['sql_user'], $config['sql_pass']);
            $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
    }catch (Exception $e){
            die('Cannot connect to mySQL server.');
    }
    
    // Check for POST, add isset($_POST['device_Id']) ect to add validations
    if($_SERVER['REQUEST_METHOD']=='POST'){
       // Build your query with placeholders
       $sql = "INSERT INTO survey_responsese_pfizer 
                      (device_Id,R1,R2,R3,comment,update_date_time)
                       VALUES
                      (:device_Id, :R1, :R2, :R3, :comment, :update_date)";
    
        // Prepare it
        $statement = $db->prepare($sql);
        // Assign your vairables to the placeholders
        $statement->bindParam(':device_Id', $_POST['device_Id']);
        $statement->bindParam(':R1', $_POST['R1']);
        $statement->bindParam(':R2', $_POST['R2']);
        $statement->bindParam(':R3', $_POST['R3']);
        $statement->bindParam(':comment', $_POST['comment']);
        $statement->bindParam(':update_date', $_POST['update_date_time']);
        // Execute the query
        $statement->execute();
    
        echo htmlspecialchars($device_Id);
    }
    ?>
    

    Untested tho, hope it helps.

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

Sidebar

Related Questions

I am sending data from iphone application to server but when it reads post
Hi I have a problem in sending data from php to pdf. I think
I am trying to receive a json object back from php after sending data
i will be sending a POST request to login.php on my server from an
I am having trouble sending data on a socket from an iphone application I
I am sending push notifications from php job application to iphone. I am sending
I have an IPhone app that uses webservices to get data from a server.
I'm using C2DM in my Application to send data from mobile to mobile But
iphone.php?email=%@&password=%@ Is there any issues with sending sensitive data over the airwaves like this
Possible Duplicate: sending post data from Iphone Hello everyone, I'm a new member of

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.