Q:

Looks like this if condition is not working

I want a query to be executed IF the following condition is true...
but looks like the query is executed anyways.

if($post->post_parent = '302'){
// Query goes here
}
Is this query fine?? I want to executed the query if the parent page of current page is 302.
Thanks

A:

The following solution worked
$query2= mysql_query("SELECT * FROM wp_posts WHERE ID='$post->ID' AND post_parent=302");
$numrows2 = mysql_num_rows($query2);
if($numrows2 != 0) {
// query goes here
}

