This topic is locked

Displaying multiple detail information on master view page

1/22/2009 6:08:29 PM
PHPRunner General questions
N
nicolagrimshaw author

Hi,
I have two tables HOTEL and PRICES where the common field accommodation_name is linked. As I have may different suppliers I may have a number of different prices for the same hotel. On the HOTEL view page I would like to display the various available prices together. I have got as far as adding the PRICES table on the Edit SQL query page, which results in a single price being displayed but I cannot work out how to display more than one price on the same HOTEL view page.
I'm sorry I've not explained this very well!
Thanks in advance

J
Jane 1/23/2009

Hi,
use custom events (Insert PHP code snippetoption on the Visual Editor tab) to select and show records from detail table on the master view page.

N
nicolagrimshaw author 1/23/2009

Hi,

use custom events (Insert PHP code snippetoption on the Visual Editor tab) to select and show records from detail table on the master view page.


Hi Jane and thank you for your response,
Sorry to be stupid, but I would be grateful if you could give me a sample code?

N
nicolagrimshaw author 1/29/2009

Hi,

use custom events (Insert PHP code snippetoption on the Visual Editor tab) to select and show records from detail table on the master view page.


Can anyone help me any further with this?
Thanks

J
Jane 1/30/2009

Hi,
here is just a sample:

global $conn, $strTableName;

if ($_REQUEST["editid1"])

{

$str = "select Field1,Field2 from MasterTable where Key=".$_REQUEST["editid1"];

$rs = db_query($str,$conn);

while($data = db_fetch_array($rs))

{

echo $data["Field1"]." ".$data["Field2"];

}

}

N
nicolagrimshaw author 1/30/2009

Hi,

here is just a sample:


Hi Jane,
Thank you for your assistance. I have tried the above and this seems but I get a PHP error on the view page :-(
Kind regards
Nicola

J
Jane 2/2/2009

Nicola,
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

N
nicolagrimshaw author 2/6/2009

Nicola,

Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.


Hi Jane,
I think I have almost 'cracked it' it seems the problem is because my key is a text value and therefore should be enclosed in quotes? I tried it out using a number and it worked (but that's no good as it's hotel names!).... I assume ".$_REQUEST["editid1"] is what I need to enclose in quotes but not quite sure how?!?!?

global $conn, $straccommodationsummary;

if (@$_REQUEST["editid1"])

{

$str = ("select spaname,facilities from spa where accname=".$_REQUEST["editid1"]);

$rs = db_query($str,$conn);

while($data = db_fetch_array($rs))

{

echo $data["spaname"]." ".$data["facilities"];

}

}


Also tried using an image which was abit more difficult!
Kind regards
Nicola

J
Jane 2/6/2009

Nikola,
here is a sample:

$str = "select spaname,facilities from spa where accname='".$_REQUEST["editid1"]."'";

N
nicolagrimshaw author 2/6/2009

Nikola,

here is a sample:


Hi Jane,
That's fantastic - thank you. I guess it's only a very simple little thing, but it was driving me mad... NOw I need to think about formatting! Perhaps I'm just trying to do too much for someone that only has a brief understanding of PHP/SQL
Thanks again
Nicola
(I'll be back with more questions soon now you've solved this one!)

N
nicolagrimshaw author 2/17/2009



Hi Jane,
That's fantastic - thank you. I guess it's only a very simple little thing, but it was driving me mad... NOw I need to think about formatting! Perhaps I'm just trying to do too much for someone that only has a brief understanding of PHP/SQL
Thanks again
Nicola
(I'll be back with more questions soon now you've solved this one!)


Hi Jane,
Is it possible to use something similar in the following situation:
I have a large number of properties which are of the same 'Type' and share other characteristics such as number of 'Bedrooms'. Each property has it's own 'EnquiryEmail'. I have made a new table multipleproperties which share the related colums 'Type' and 'Bedrooms' but need a custom expression for the EnquiryEmail fields - which I want to contain multiple email addresses (with a semicolon between) for all the hotels which meet the expression:
SELECT DISTINCT EnquiryEmail from property WHERE Type='multipleproperties.Type' and Bedrooms='multipleproperties.Bedrooms'
I think, again, I have an error with the quotes around 'multipleproperties.Type' and 'multipleproperties.Bedrooms' and I'm not sure of the bits that need to go before and after...
Thanks in advance
Nicola

N
nicolagrimshaw author 2/17/2009



I've realised this will not solve the problem I have, because on testing (having added multiple email addresses manually) this does not work. I will post in another thread for possible alternatives.
Hi Jane,
Is it possible to use something similar in the following situation:
I have a large number of properties which are of the same 'Type' and share other characteristics such as number of 'Bedrooms'. Each property has it's own 'EnquiryEmail'. I have made a new table multipleproperties which share the related colums 'Type' and 'Bedrooms' but need a custom expression for the EnquiryEmail fields - which I want to contain multiple email addresses (with a semicolon between) for all the hotels which meet the expression:
SELECT DISTINCT EnquiryEmail from property WHERE Type='multipleproperties.Type' and Bedrooms='multipleproperties.Bedrooms'
I think, again, I have an error with the quotes around 'multipleproperties.Type' and 'multipleproperties.Bedrooms' and I'm not sure of the bits that need to go before and after...
Thanks in advance
Nicola

N
nicolagrimshaw author 2/17/2009

It seems this might actually work IF I can figure out how to do it although I would require a comma rather than a semicolon between the email addresses! I tested it by adding the email addresses manually and this worked!