Jump to content

How can i Run Multiple MySQL Queries with this?


Heath

Recommended Posts

I have been trying to merge 2 seperate codes I made to show up side by side. In order to do this though, I need to be able to run multiple mysql queries... Here are the 2 queries.

 

Query 1-

$query = $DB->query("SELECT id, titolo, file FROM mkp_gallery where validate = '1' ORDER BY `id` DESC LIMIT $limit");

 

 

Query 2-

$query2 = $DB->query("SELECT id, evento FROM mkp_gallery_events ORDER BY `id` DESC LIMIT $limit; ");

 

 

Any clue how to accomplish this?

Here is every thing I have. Currently. When it outputs. What should be the 2nd table in the 2nd part of this still pulls every thing from query2 and i can't figure out why.

 

<?php
$limit = 10;
$cut = 1000;
$content = "";
$query = $DB->query("SELECT id, titolo, file FROM mkp_gallery where validate = '1' ORDER BY `id` DESC LIMIT $limit");
while ($row = $DB->fetch_row($query)) {
	$idu = $row['id'];
	$umes = "";
	$message = substr($row['description'], 0, $cut);
	$message = str_replace("<br>", " ", $message);
	$message = explode(" ", $message);
	foreach ($message as $value) {
		if (strlen($value) > 20) {
			 $value = substr($value, 0, 22);
		}
   			$umes .= $value." ";
	}

	$content.= "
			<td><tr>
			  <td class=\"frontpics\"><a href=\"$this->siteurl/index.php?ind=gallery&op=foto_show&ida=$idu\" class=\"uno\"><img src=/images/front-page-bullet.jpg> {$row['titolo']}</a>
			  </td>
			</tr>";
}

if($idu == NULL) {
		$content = "
			<tr>
			  <td align=\"center\">
			  There are no Files
			  </td>
			</tr>
		";
}

if(!$mkportals->member['g_access_cp'] && !$this->member['g_access_gallery']) {
		$content = "
			<tr>
			  <td align=\"center\">
			  {$this->lang['gallery_noallow']}
			  </td>
			</tr><td>
		";
}
unset($row);
unset($umes);
unset($message);
unset($idu);


//2nd part


$query = $DB->query("SELECT id, titolo, file FROM mkp_gallery where validate = '1' ORDER BY `id` DESC LIMIT $limit");
$query2 = $DB->query("SELECT id, evento FROM mkp_gallery_events ORDER BY `id` DESC LIMIT $limit; ");
while ($row2 = $DB->fetch_row($query2)) {
	$idu = $row2['id'];
	$idb = $row['id'];
	$umes = "";
	$message = substr($row['description'], 0, $cut);
	$message = str_replace("<br>", " ", $message);
	$message = explode(" ", $message);
	foreach ($message as $value) {
		if (strlen($value) > 20) {
			 $value = substr($value, 0, 22);
		}
   			$umes .= $value." ";
	}

	$content.= "
			<td>
			<tr>
				<td class=\"frontpics\"><a href=\"$this->siteurl/index.php?ind=gallery&op=section_view&idev=$idu\" class=\"uno\"><img src=/images/front-page-bullet.jpg> {$row2['evento']}</a></td>
				<td class=\"frontpics\"><a href=\"$this->siteurl/index.php?ind=gallery&op=foto_show&ida=$idb\" class=\"uno\"><img src=/images/front-page-bullet.jpg> {$row['titolo']}</a>
			  </td>
			</tr>";
}

if($idu == NULL) {
		$content = "
			<tr>
			  <td align=\"center\">
			  There are no Files
			  </td>
			</tr>
		";
}

if(!$mkportals->member['g_access_cp'] && !$this->member['g_access_gallery']) {
		$content = "
			<tr>
			  <td align=\"center\">
			  {$this->lang['gallery_noallow']}
			  </td>
			</tr><td>
		";
}
unset($row);
unset($umes);
unset($message);
unset($idu);

?>

 

I am trying to get the content to show up side by side, opposed to one long list.

 

So it would look like this

 

(Block One                              ) (Block 1 2nd Query                            )

(Block Two                              ) (Block 2 2nd Query                            )

 

 

Right now its just straight down 10, then the 2nd Queries 10. With empty fields with just the image and empty tables with no title like it should be.

 

Thank you. I appreciate the help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.