Jump to content


Photo

Show detail


  • Please log in to reply
3 replies to this topic

#1 barney0o0

barney0o0
  • Members
  • PipPipPip
  • Advanced Member
  • 103 posts

Posted 12 March 2006 - 02:51 PM

Hi folks, i hope someone could help me with this one.

For the first time im trying to use relational databases. The code below works fine in pulling down all the relevant infomation;


$query_Recordset1 = "SELECT * FROM props, gallery_photos WHERE gallery_photos.photo_category = props.propID"; 


The information is a brief overview. I have a 'more info' button that i would like to pass to another page. Before ive used something like

ebro fincas properties_detail.php?ID=<?php echo $row_Recordset1['propID']; ?> 


However, how do i change the initial recordset (that i will copy and paste into the detail page) to accomodate this new filter of a passed variable....


many thanks in advance

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,015 posts

Posted 12 March 2006 - 03:01 PM

I would have thought that you would need to pass the ID of a specific item instead of the propID (which is the category id according to your first query).

In your detail page

$id = $_GET['ID'];

$query = "SELECT * FROM gallery_photos WHERE id = '$id'";
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 barney0o0

barney0o0
  • Members
  • PipPipPip
  • Advanced Member
  • 103 posts

Posted 12 March 2006 - 03:11 PM

Wouldnt this just pull info about the photo table?

....the main content is in the props table. What ive done is to form a record set that selects all info from the props table and link it to the image info with the same ID.

This works fine at the moment (ive pulled down all the records with the correct image)

On the 'more info' button i need to determine which ID the record is from the recordset and pass this onto the detail page

sorry, im just typing this to get it straight in my own mind, by no means are im asking you to suck eggs!

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,015 posts

Posted 13 March 2006 - 08:31 PM

Sorry, but all we know about your database is what you have in this query

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]SELECT * FROM props, gallery_photos WHERE gallery_photos.photo_category = props.propID [/quote]

which tells us you have tables "props" and "gallery_photos" and a photo_category column joined to props.propID which makes it seem that the props table is category data.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users