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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:50:43+00:00 2026-05-25T09:50:43+00:00

First I need to say that I am new to iPhone development, so please

  • 0

First I need to say that I am new to iPhone development, so please I need you to be specific!

I’m developing an application for School scientific project,the question is: How can I insert data into a mysql table from UITextFields on the iPhone?

On my application I have 3 UITextFields, so I need to insert those UITextFields values into the mysql table. It doesn’t matter the way you know to do that, I’m in a hurry and I just wanna to put it to work.

1-I working with this PHP code

<?php


if (isset ($_GET["matricula"]))
    $matricula = $_GET["matricula"];

else 

    $matricula = "ELO";



$sql="INSERT INTO chatitems (user, message, matricula) VALUES ('$_GET[user]','$_GET[messages]','$_GET[matricula]')";



$con = mysql_connect($DB_HostName,$DB_User,$DB_Pass) or die(mysql_error()); 
mysql_select_db($DB_Name,$con) or die(mysql_error()); 

//$sql = "insert into $DB_Table (matricula) values('$matricula');";
$res = mysql_query($sql,$con) or die(mysql_error());

mysql_close($con);
if ($res) {
    echo "success";
}else{
    echo "faild";
}// end else

?>

And I insert this CODE on my application(Xcode 4.1)

2

- (IBAction)insert:(id)sender
{
// create string contains url address for php file, the file name is phpFile.php, it receives parameter :name
NSString *strURL = [NSString stringWithFormat:@"http://localhost:8888/phpFile.php?name=%@",txtName.text];
//NSString *strURL = [NSString stringWithFormat:@"http://localhost:8888/phpFile.php?name=%@",txtMatricula.text];

// to execute php code
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];

// to receive the returend value
NSString *strResult = [[[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding]autorelease];

NSLog(@"%@", strResult);


NSString *cont11 = [NSString stringWithFormat:@"http://localhost:8888/UEUO/insertMT.php?name=%@",txtName.text];
NSString *cont21 = [NSString stringWithFormat:@"http://localhost:8888/UEUO/insertMT.php?matricula=%@",txtMatricula.text];

NSData *cont12 = [NSData dataWithContentsOfURL:[NSURL URLWithString:cont11]];
NSData *cont22 = [NSData dataWithContentsOfURL:[NSURL URLWithString:cont21]];

NSString *cont13 = [[[NSString alloc] initWithData:cont12 encoding:NSUTF8StringEncoding]autorelease];
NSLog(@"%@", cont13);

NSString *cont23 = [[[NSString alloc] initWithData:cont22 encoding:NSUTF8StringEncoding]autorelease];
NSLog(@"%@", cont23);

}

This code works fine for only one UItextField, I need three3.

Repenting: How can I insert the values of three UITextFields into a MySql table using PHP and C++?

Please anything is helpful, if you know how please help me or send me a tutorial or a piece of code!

  • 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-25T09:50:44+00:00Added an answer on May 25, 2026 at 9:50 am

    Your PHP script is looking for 3 parameters passed from a single request.

    Your iPhone code is sending 2 different requests with 1 parameter each.

    Your iPhone code should be sending 1 request with 3 parameters set, as with this sort of request:

    NSString *cont11 = [NSString stringWithFormat:@"http://localhost:8888/UEUO/insertMT.php?name=%@&matricula=%@&message=%@",txtName.text, txtMatricula.text, txtMessage.text];
    [NSData dataWithContentsOfURL:[NSURL URLWithString:cont11]];
    

    I should also point out that you haven’t sanitized your inputs. That’s really bad. Sanitize your inputs.

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

Sidebar

Related Questions

First of all I need to say that I'm new to jQuery. When I
Say I need a new type in my application, that consists of a std::vector<int>
in first and foremost i need to say that I'm new in Spring AOP
I have an application that when it first starts i need it to run
Hi there First of all just let me say that I'm new in Python
First, I'd like to say that I'm new to C / C++, I'm originally
First of all let me just say that I am new to nHibernate so
First I'd like to say that I'm brand new to SSIS so bear with
Explanation: Say package A is always built first and then package B. I need
String[] a = c.toArray(new String[0]); First: Do I need type cast here? (I think

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.