I have two recordsets in a page - rsDetail & rsPhotos
On the page is a dynamic region 'rsDetail.install_UID' which displays the unique install_UID of a record from the detail_tbl which I am viewing at that current time. I have labelled this region 'installnumber'
<td class="style1" id="installnumber"><?php echo $row_rsDetail['install_UID']; ?></td>
This is the detail_tbl (used in rsDetail)
install_UID | Column a | Column b | Column c | Column d |
100755 | 2597 | 53 | 23 | 100629 |
100855 | 4329 | 83 | 62 | 102121 |
100752 | 1388 | 78 | 66 | 100452 |
100708 | 4329 | 53 | 62 | 101970 |
100630 | 2597 | 78 | 23 | 100629 |
100876 | 4329 | 116 | 62 | 102102 |
100565 | 1388 | 78 | 66 | 100452 |
100481 | 4386 | 0 | 66 | 86908 |
100451 | 4329 | 78 | 62 | 97043 |
100921 | 4329 | 116 | 62 | 102087 |
100447 | 4329 | 57 | 62 | 100405 |
100416 | 2597 | 78 | 23 | 100043 |
100019 | 1388 | 2 | 66 | 97847 |
100284 | 2597 | 57 | 23 | 94762 |
101007 | 4329 | 2 | 62 | 100654 |
159 | 1388 | 19 | 66 | 86662 |
164 | 4329 | 19 | 62 | 95578 |
100019 | 1388 | 2 | 66 | 97847 |
100565 | 1388 | 78 | 66 | 100452 |
100752 | 1388 | 78 | 66 | 100452 |
159 | 1388 | 19 | 66 | 86662 |
This is the photos_tbl (used in rsPhotos)
mediaUID | install_ID | Image_url |
2136 | 100018 | Images/Install100018/Install100018_95760_05.jpg |
2135 | 100018 | Images/Install100018/Install100018_95760_04.jpg |
2134 | 100018 | Images/Install100018/Install100018_95760_03.jpg |
2133 | 100018 | Images/Install100018/Install100018_95760_02.jpg |
2132 | 100018 | Images/Install100018/Install100018_95760_01.jpg |
2123 | 100014 | Images/Install100014/Install100014_95760_03.jpg |
2120 | 100013 | Images/Install100013/Install100013_97676_02.jpg |
2121 | 100014 | Images/Install100014/Install100014_95760_01.jpg |
2122 | 100014 | Images/Install100014/Install100014_95760_02.jpg |
2131 | 100017 | Images/Install100017/Install100017_95760_04.jpg |
Is it possible to create a statement that says 'display records from photos_tbl where photos_tbl.install_ID = installnumber ?
I tried this in the rsPhotos recordset but it didn't work:
SELECT *
FROM photos_tbl
WHERE install_ID = ["installnumber"]
Thanks
Because of the way I've designed the site I need to find out if it's possible to do it using the 'id=installnumber' way.
<td class="style1" id="installnumber"><?php echo $row_rsDetail['install_UID']; ?></td>
Or, can I create a statement for rsPhotos along the lines of:
SELECT *
FROM photos_tbl
WHERE install_ID = "installnumber"
or
SELECT *
FROM photos_tbl
WHERE install_ID = "rsDetail.install_UID"
if so can you advise me on the correct syntax to use as I'm not fluent in php.
Thanks again!
>if so can you advise me on the correct syntax to use as I'm not fluent in php.
I'm not a php developer so don't trust me on anything here.
>SELECT *
>FROM photos_tbl
>WHERE install_ID = ["installnumber"]
Here you are telling the where clause to look for an install_ID equal to the string "installnumber", which obviously is not correct. Is "installnumber" a variable you have created somewhere in the script? If so, then to create your SQL string you would use
"SELECT *
FROM photos_tbl
WHERE install_ID =" . $installnumber
Similar problem here
>SELECT *
>FROM photos_tbl
>WHERE install_ID = "rsDetail.install_UID"
You would not put variables inside of quotes. It would be something like
"SELECT *
FROM photos_tbl
WHERE install_ID = " . $rsDetail.install_UID
This seems to have done the trick. In the photos recordset I used this sql statement...
SELECT *
FROM photos_tbl
WHERE install_ID = installnumber
and then created this variable (all from within the advanced recordset dialogue box)...
Variable
name: installnumber
type: integer
defailt value: -1
runtime value: $row_rsDetail['install_UID']
Thanks for your help ![]()
North America
Europe, Middle East and Africa
Asia Pacific