Ask a question about how to obtain a field from the database on mobile. ask a question about how to obtain a field from the database on mobile = ''.
A program for sending text messages
Obtain a piece of data based on xingming_iD. how can I assign the property of one of the mobile phones to the back of mobile?
Trouble
The source code is as follows:
$ Con = mysql_connect ("localhost", "XXX", "XXXX ");
If (! $ Con)
{
Die ('could not connect: '. mysql_error ());
}
Mysql_select_db ("sfsdb", $ con );
$ Xingming_id = $ _ GET ['xingming _ id'];
$ SQL = "select * from sfsdbplayers where xingming_id = '". $ _ GET ['xingming _ id']. "'";
$ Result = mysql_query ($ SQL, $ con );
If ($ row = mysql_fetch_array ($ result )){
}
?>
Header ("Content-Type: text/html; charset = UTF-8 ");
$ Flag = 0;
$ Params = ''; // data to be post
$ Verify = rand (123456,999 999); // Obtain the random verification code
// Enter the following information.
$ Mobile = ''; (how can I assign the field of the obtained mobile phone number here? thank you)
$ Argv = array (
'Name' => 'xxxxxxxxxxxxxxxxxxxxxx', // required parameter. User account
'Pwd' => 'xxxxxxxxxxxxxxxxxxxx', // required parameter. (Web platform: interface password in basic information)
'Content' => 'text message verification code: '. $ verify.'. do not provide the verification code to others. ', // Required parameter. Sending content (1-500 Chinese characters) UTF-8 encoding
'Mobile' => $ mobile, // required parameter. Mobile phone number. Multiple IDs are separated by commas (,).
'Stime' => '', // optional parameter. Sending Time: the time that has been filled in to send the message. if not filled in, the message is sent at the current time.
'Sign' => 'xxxxxx', // required parameter. User signature.
'Type' => 'pt', // required parameter. Fixed pt
'Extno' => ''// optional parameter, extended code, user-defined extended code, can only be a number
);
// Print_r ($ argv); exit;
// Construct the string to post
// Echo $ argv ['content'];
Foreach ($ argv as $ key => $ value ){
If ($ flag! = 0 ){
$ Params. = "&";
$ Flag = 1;
}
$ Params. = $ key. "="; $ params. = urlencode ($ value); // urlencode ($ value );
$ Flag = 1;
}
$ Url = "http://web.duanxinwang.cc/asmx/smsservice.aspx? ". $ Params; // submitted url
$ Con = substr (file_get_contents ($ url), 0, 1); // obtain the status after the message is sent.
If ($ con = '0 '){
Echo "script" alert ('sent successfully! '); Script ";
} Else {
Echo "script" alert ('failed to send! '); History. back (); script ";
}
?>
Reply to discussion (solution)
You have already made it. You can write a method in the model to obtain the mobile phone number, and use this method in ctrl. $ mobel = XXX; // get the model
You have already made it. You can write a method in the model to obtain the mobile phone number, and use this method in ctrl. $ mobel = XXX; // get the model
Can you write it down for me?
I'm not a beginner!
Thank you l
Check whether your $ row is a one-dimensional array or a two-dimensional array.
For a one-dimensional array, $ row ['field'] is $ row [0] ['field'] --- $ row [n] ['field'].
Check whether your $ row is a one-dimensional array or a two-dimensional array.
For a one-dimensional array, $ row ['field'] is $ row [0] ['field'] --- $ row [n] ['field'].
Is a one-dimensional array, the key output must be displayed here
$ Mobile = 'output items must be displayed here ';
You mean $ mobile = '$ row ['shoujihaoma'] ';
This is not correct!
Trouble!
Check whether your $ row is a one-dimensional array or a two-dimensional array.
For a one-dimensional array, $ row ['field'] is $ row [0] ['field'] --- $ row [n] ['field'].
Is a one-dimensional array, the key output must be displayed here
$ Mobile = 'output items must be displayed here ';
You mean $ mobile = '$ row ['shoujihaoma'] ';
This is not correct!
Trouble!
Do not use single quotes...
$ Mobile = $ row ['shoujihaoma '];
Check whether your $ row is a one-dimensional array or a two-dimensional array.
For a one-dimensional array, $ row ['field'] is $ row [0] ['field'] --- $ row [n] ['field'].
Is a one-dimensional array, the key output must be displayed here
$ Mobile = 'output items must be displayed here ';
You mean $ mobile = '$ row ['shoujihaoma'] ';
This is not correct!
Trouble!
Do not use single quotes...
$ Mobile = $ row ['shoujihaoma '];
This method is very helpful.
Awesome
Why remove the single quotes?