Apr 25, 2009, 2:25 PM
Post #1 of 6
Inserting MySQL row outputs into an array.
I am having a problem with a piece of code from a script I'm working on. The problem I'm having is that I want to query a MySQL database for a couple of rows (3 rows to be exact). Each row contains a phone number. The output rows (3 phone numbers) I then want to place into an array whereby system piece of code will read from the array and send an sms to the phone number.
Basically this is the flow of what I want to do.
1. MySQL query gets the three phone numbers.
2. The three phone numbers are inserted into an array. (this is the problem. I need them to be inserted into an array like this @number = ("$number","$number","$number"); which will later be read by the system code.)
Can anybody help me? Below is the piece of code I have so far for getting the numbers..
$query1 = "SELECT smart_number FROM $tablename1 WHERE active = '1'";
$sth1 = $dbh->prepare($query1);
# Here is where I want to insert the output into an array.