teapear 0 Newbie Poster

Hello guys..

i need your help to convert this sql statement to php array..

$string = "SELECT
                 TOP 15
                    e.id,
                    e.title,
                    e.timestamp
 
                FROM
                    serendipity_entries AS e
                    LEFT JOIN serendipity_authors a
                        ON e.authorid = a.authorid
                    LEFT JOIN serendipity_entrycat ec
                        ON e.id = ec.entryid
                      LEFT JOIN serendipity_access AS acl_acc
                                   ON (    acl_acc.artifact_mode = 'read'
                                       AND acl_acc.artifact_type = 'category'
                                       AND acl_acc.artifact_id   = c.categoryid
                                      )
                    WHERE isdraft = 'false' AND e.timestamp <= 1242781500 AND     (
                                 c.categoryid IS NULL
                                 OR ( acl_acc.groupid = 0)
                                 OR ( acl_acc.artifact_id IS NULL
                                    )
                               )
                     GROUP BY e.id,e.title,e.timestamp
 
                     ORDER BY timestamp DESC"

TO php array

Array
(
    [SELECT] => e.id, e.title, e.timestamp
   
    [TOP] => 15
   
    [FROM] => serendipity_entries AS e
                    LEFT JOIN serendipity_authors a
                        ON e.authorid = a.authorid
                    LEFT JOIN serendipity_entrycat ec
                        ON e.id = ec.entryid
                      LEFT JOIN serendipity_access AS acl_acc
                                   ON (    acl_acc.artifact_mode = 'read'
                                       AND acl_acc.artifact_type = 'category'
                                       AND acl_acc.artifact_id   = c.categoryid
                                      )
   
    [WHERE] =>  isdraft = 'false' AND e.timestamp <= 1242781500 AND     (
                                 c.categoryid IS NULL
                                 OR ( acl_acc.groupid = 0)
                                 OR ( acl_acc.artifact_id IS NULL
                                    )
                               )
    [GROUP BY] => e.id,e.title,e.timestamp
    [ORDER BY] => timestamp DESC
 
)
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.