Hi all,
Help me please.
i have two table: outbox and contact.
condition outbox table befor query/ insert.

CREATE TABLE outbox (
id int(11) NOT NULL,
phone_number varchar(30) NOT NULL,
message varchar(200) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Contact table:
CREATE TABLE contact (
id int(11) NOT NULL auto_increment,
name varchar(30) NOT NULL,
phone varchar(20) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

INSERT INTO contact VALUES (1, 'jana', '+60111');
INSERT INTO contact VALUES (2, 'jani', '+60222');
INSERT INTO contact VALUES (3, 'janu', '+60333');

I Want to insert a string to outbox table.

$string = "I LOVE YOU";

condition outbox table After Query/insert: Row of outbox table is:

CREATE TABLE outbox (
id int(11) NOT NULL,
phone_number varchar(30) NOT NULL,
message varchar(200) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO outbox VALUES (1, '+60111, 'I LOVE YOU');
INSERT INTO outbox VALUES (2, '+60222', 'I LOVE YOU');
INSERT INTO outbox VALUES (3, '+60333', 'I LOVE YOU');

How i write multy query mysql using php for it problem, thank you.

?php
$string = "I LOVE YOU";
$qr_contact = "SELECT * FROM contact";
$rs_contact = mysql_query($qr_contact);
while($data_contact = mysql_fetch_array($rs_contact))
{
  $id = $data_contact['id'];
  $name = $data_contact['name'];
  $phone = $data_contact['phone'];
  $xx = mysql_num_rows($rs_contact);
$phone_number=$phone;
$qr_outbox = "INSERT INTO outbox(id,phone_number,message ) VALUES ('','$phone_number','$string')";
$rs_outbox = mysql_query($qr_outbox); //how i written Query againt...?
/* how i written Query it?. 
After query Row of outbox table is:
id    phone_number       message                
1       +60111          I LOVE YOU 
2       +60222          I LOVE YOU
3       +60333          I LOVE YOU
*/
}
?> 

How to writting multy query for it problem?..

I am sorry, I am confused by your question? What is "it problem"? What does it mean by "written query it"? You have already completed the task you are showing, what else do you need to do more?

If you mean using the function multi_query, then you need to switch to the mysqli extension.

it problem = problem multy query.
"written query it = how to query it?
I want to insert into outbox (phone_number,message)

/*
$phone_number=$phone   from contact table;
$string = "I LOVE YOU";
*/

It is my project sms gateway, i want to send message to group.

/* 
$massage = "I LOVE YOU";
$string = $massage;
*/

I am sorry because my english is bad.

I do not know the mysqli extension. thank you

What do you mean with multi query exactly?

Does "multi query" mean you want to create multiple query at once? For example, "SELECT x FFROM y; UPDATE x SET k=aaa WHERE y=bbb;..." in one call?

@Taywin:
yes,

$string = "I LOVE YOU";
$phone_number=$phone;// value from contact table['phone']
$qr_outbox = "INSERT INTO outbox(phone_number,message ) 
VALUES ('$phone_number','$string')";
$rs_outbox = mysql_query($qr_outbox);

@pritaeas:
multi query = create multiple query at once

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.