Hi Im trying to run 2 querys in the same query call.
// send the query
global $wpdb;
$commentQ = "SELECT * FROM $wpdb->comments " . $whereClause . $orderBy;
$comments = $wpdb->get_results( $commentQ, ARRAY_A);
So far it works , but when i try to run 2 querys it fails. What I wanna do is i want to run:
**SELECT *
FROM `wp_88_commentmeta`
ORDER BY `wp_88_commentmeta`.`meta_value` ASC
LIMIT 0 , 30**
Im trying to get the meta_value only from that table.
So my question is , how can i call 2 querys in the same call, and if theres i a better way to do that?
EDIT:
I want to JOIN $wpdb->comments with commentmeta. Im only trying to get the field "meta_value".
global $wpdb;
$commentQ = "SELECT * FROM $wpdb->comments " . $whereClause . $orderBy;
$comments = $wpdb->get_results( $commentQ, ARRAY_A);
// build the string
$commentString = "";
$count = 0;
if( $comments ){
$first = true;
foreach( $comments as $row ){
if( $first ){
// column labels
foreach ( $row as $col => $value ){
//$commentString .= $col . chr( 9 );
After i join the tables i want to get "meta_value" from wp_commentmeta_88 and insert it instead of "comment_author"
// Column Author
if($col == 'comment_author') {
$commentString .= 'User Meta ';
}
// Column IP
if($col == 'comment_author_IP') {
$commentString .= ' IP ';
}
// Column date
if($col == 'comment_date') {
$commentString .= ' Datum ';
}
// Column comment
if($col == 'comment_content') {
$commentString .= ' Meddelande ';
}
}
$commentString .= chr( 13 );
$first = false;
}
SELECT * FROM tableA; SELECT * FROM tableB;
I am pretty sure you can't. PHP/MySQL doesn't support it as far as I know, not on a LAMP stack anyway. I've heard rumors that you can do with if you have ASP.NET support. I don't work with that though.