Result Display Issues

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mrpaulfrank
Forum Commoner
Posts: 33
Joined: Sun Jun 23, 2002 3:39 am

Result Display Issues

Post by mrpaulfrank »

Ok, what im doing is a basic mysql query for certain field information:

"SELECT * FROM test WHERE genre = '????'"

according to this genre, im letting the client receive these dynamic text/image:

<img src="<?php echo $row_Recordset1['image']; ?>">
<p><?php echo $row_Recordset1['title']; ?>
<p><?php echo $row_Recordset1['format']; ?>
<p> <?php echo $row_Recordset1['company']; ?>

So far its working quite nicely...by changing the '????' i can retrieve data related to the different genres.

Although this is good, i need to be able to display EVERY result within the genre that the person is searching for (this set up only shows me one result).

I have an iframe that will display the results, and inside this iframe, i would like 5 columns and 2 rows (10 total) per page.

How do i set this result display?? and how do i include links at the bottom of the page to navigate through the pages of results??

Thanks so much!
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

Well, I'm kind of new to PHP so I don't think I can tackle the whole thing quite yet, but I could give you a start on how to get all of the results.

Code: Select all

$genre = "rock";
$query = "SELECT * FROM test WHERE genre='".$genre."'";
$result = mysql_query($query) or die(mysql_error());

while( $row = mysql_fetch_assoc($result) )
&#123;
  echo "Title: ".$row&#1111;'title']."<br>\n".
    "Format: ".$row&#1111;'format']."<br><br>\n\n";
&#125;
That would display a list of each rock title and its format.
mrpaulfrank
Forum Commoner
Posts: 33
Joined: Sun Jun 23, 2002 3:39 am

image

Post by mrpaulfrank »

thanks, that helped me. also i would like to insert an image of each result right above the title etc info. i tried what i was doing before, but it was this:

<img src="<?php echo $row_Recordset1['image']; ?>">

which is in the body of the html and wont work otherwise. any ideas??

also, can anyone help me with the code for display settings?? how many results per: row, column, page ?? thanks a lot!!!
mrpaulfrank
Forum Commoner
Posts: 33
Joined: Sun Jun 23, 2002 3:39 am

code

Post by mrpaulfrank »

so far, this is what i have:

<?php require_once('Connections/connection.php'); ?>
<?php
mysql_select_db($database_db, $db);
$query_Recordset1 = "SELECT * FROM test";
$Recordset1 = mysql_query($query_Recordset1, $db) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_select_db($database_db, $db);

$genre = "comedy";
$query_Recordset1 = "SELECT * FROM test WHERE genre = '$genre'";
$Recordset1 = mysql_query($query_Recordset1, $db) or die(mysql_error());
while($row_Recordset1 = mysql_fetch_assoc($Recordset1))
{
echo "<A href=backs/$back><IMG SRC=images/$image></A>"."<br>\n".
"Title: ".$row_Recordset1['title']."<br>\n".
"Format: ".$row_Recordset1['format']."<br>\n".
"Price: ".$row_Recordset1['make']."<br><br>\n\n";
}
$image = $row_Recordset1['image']
?>

<html>
<head>


my problem i think is that the '$image' is not being defined before the script is being executed. ive tried placing it in random places, and no matter where i get an error. can someone help me with this? thanks so much.

also, where and how do i define how many results per row and spacing etc?

thanks a lot!
Post Reply