Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
$sql_query_posts = "SELECT * FROM `posts`";

$sql_form_permission = mysql_query("SELECT * FROM `integrations` WHERE `rank_id`='$user_level' AND `mode`='form_per'");
    if ( mysql_num_rows($sql_form_permissions) > 0 ) {

Now the part I'm struggling with:

   $sql_query_posts .= " IN (";
    while ( $row_form_permissions = mysql_fetch_assoc($sql_form_permissions) ) { 
    $sql_query_posts .= $row_form_permissions['form_id'] . ",";
    }
    $sql_query_posts .= ")";
    }

I want the output to be something like:

SELECT * FROM `posts` IN (4, 3, 2)

But the code above gives an output like:

SELECT * FROM `posts` IN (4, 3, 2,)

So I have to get rid of the comma at the end. How can I make sure the script disables the comma at the last row.

share

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.