Ask a question my mobile = "Here's how to get a field from a database query

Source: Internet
Author: User
Ask a question my mobile = "Here's how to get a field from a database query

A program that sends text messages
Get a piece of data based on xingming_id, how do I assign a property of one of the phones in this data to the back of the mobile

It's trouble.

The following is the source code:

$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 post
$verify = rand (123456, 999999);//Get Random verification code

Fill in the following information yourself
$mobile = ";(is here how do I assign the field of the cell phone number above to the value here, thank you)
$ARGV = Array (
' Name ' = ' xxxxxxxxxxxxxxxxx ',//required parameters. User account
' pwd ' = ' xxxxxxxxxxxxxxxx ',//required parameters. (Web platform: interface password in basic data)
' Content ' + ' SMS Verification Code: '. $verify. ', do not provide verification code to others. ',//required parameters. Send content (1-500 kanji) UTF-8 encoding
' Mobile ' = $mobile,//Required parameters. Mobile phone number. Multiple separated by commas
' Stime ' + ',//optional parameters. Send time, fill in when the time is sent, do not fill out the current time to send
' Sign ' = ' xxxxxx ',//required parameters. User signature.
' Type ' = ' pt ',//required parameter. Fixed value PT
' Extno ' = ' + '//optional parameter, extension code, user-defined extension code, only for digital
);
Print_r ($argv); exit;
Constructing a 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; URL address for submission
$con = substr (file_get_contents ($url), 0, 1); Get the status after information is sent

if ($con = = ' 0 ') {
echo "";
}else{
echo "";
}

?>


Reply to discussion (solution)

You've made it. You write a method in the model, that is, you get the method of mobile phone number, and then in the CTRL out of this method $mobel= XXX; Model acquisition

You've made it. You write a method in the model, that is, you get the method of mobile phone number, and then in the CTRL out of this method $mobel= XXX; Model acquisition



Can you write it down for me?
I'm a novice, not very good!
Thank you L

First make sure your $row is a one-dimensional or two-dimensional array
If a one-dimensional array is $row[' field '] two-dimensional is $row[0][' field ']---$row [n][' field ']

First make sure your $row is a one-dimensional or two-dimensional array
If a one-dimensional array is $row[' field '] two-dimensional is $row[0][' field ']---$row [n][' field ']



is a one-dimensional array, the key output of something to be shown here

$mobile = ' The output of something must be shown here ';

You mean $mobile = ' $row [' shoujihaoma '];
That's not right!
I'm in trouble!


First make sure your $row is a one-dimensional or two-dimensional array
If a one-dimensional array is $row[' field '] two-dimensional is $row[0][' field ']---$row [n][' field ']



is a one-dimensional array, the key output of something to be shown here

$mobile = ' The output of something must be shown here ';

You mean $mobile = ' $row [' shoujihaoma '];
That's not right!
I'm in trouble!



Do not use single quotes ...
$mobile = $row [' Shoujihaoma '];



First make sure your $row is a one-dimensional or two-dimensional array
If a one-dimensional array is $row[' field '] two-dimensional is $row[0][' field ']---$row [n][' field ']



is a one-dimensional array, the key output of something to be shown here

$mobile = ' The output of something must be shown here ';

You mean $mobile = ' $row [' shoujihaoma '];
That's not right!
I'm in trouble!



Do not use single quotes ...
$mobile = $row [' Shoujihaoma '];



It's a great strength to use your method.
It's too much for the force.
Why should I remove the single quotes outside?
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.