Jump to content

result capturing


Danny620

Recommended Posts

<?php 

require('config.inc.php');

require_once (MYSQL);

$time = time();

$time = $time - 86400;

// Query the database:
	$q = "SELECT company_id, image FROM profile WHERE date > '$time' LIMIT 9";		
	$r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc));

	if (@mysqli_num_rows($r) >= 1) { // A match was made.

		while($row = mysqli_fetch_array ($r, MYSQLI_ASSOC)){

		$image = $row['image'];

echo "<div class=\"new_ads\"><a href=\"profile.php?id=$row[company_id]\"><img src=\"$image\" width=\"125\" height=\"100\" /></a></div>";
}

	}

	// Query the database:
	$q = "SELECT category FROM category LIMIT 9";		
	$r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc));

	if (@mysqli_num_rows($r) >= 1) { // A match was made.



	 $category = while($row = mysqli_fetch_array ($r, MYSQLI_ASSOC)){

		$cat = $row['category'];

	 $category=  "<li><a href=\"search.php?$cat\" title=\"Search for $cat in United Kingdom\">$cat</a></li>";

												       }

		mysqli_free_result($r);
	}

	echo $category;

 

in this piece of code i want it to be able to store this $category=  "<li><a href=\"search.php?$cat\" title=\"Search for $cat in United Kingdom\">$cat</a> for as many time as the data is in the database so that i can echo $category where ever on my page thanks

Link to comment
https://forums.phpfreaks.com/topic/203689-result-capturing/
Share on other sites

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.