2012-03-15 142 views
0

我嘗試在Xcode中創建註冊表單。我會將這些信息存儲在我的mysql數據庫中。但是當我將值發送到Xcode中的URL時,php腳本只能獲得第一個。我在Xcode中沒有語法錯誤,但是我仍然不確定它是否正確。如果您在以下代碼中發現錯誤,我會很樂意聽取您的表單。Xcode發送乘法參數到url

的Xcode:

NSString *strURL = [NSString stringWithFormat:@"http://localhost/login/index.php?email=%@",email.text, "&username=%@", username.text]; 

我的PHP代碼:

<?php 
    $email  = $_GET['email']; 
    $username = $_GET['username']; 
    $sql  = "INSERT INTO users (email, username) VALUES ('$email', '$username')"; 
    $qry  = mysql_query($sql); 
?> 

感謝您的時間。

回答

3

嘗試做:

NSString *strURL = [NSString stringWithFormat:@"http://localhost/login/index.php?email=%@&username=%@",email.text, username.text]; 
+0

然後放入電子郵件和用戶名變量的電子郵件的價值? – thar 2012-03-15 07:47:04

+0

在該字符串後面加一個斷點,並執行 - po strURL你會看到替換字符串 – Injectios 2012-03-15 07:51:03

+0

你可能會爲我做例子嗎? – thar 2012-03-15 07:55:18