
cuboidgraphix
User
Apr 25, 2009, 2:25 PM
Post #1 of 6
(1435 views)
|
|
Inserting MySQL row outputs into an array.
|
Can't Post
|
|
Hi guys, 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[0]","$number[2]","$number[3]"); 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); $sth1->execute(); $sth1->bind_columns(undef, \$smart_number); while($sth1->fetch()) { # Here is where I want to insert the output into an array. }
|