Web Hosting Talk







View Full Version : Using ODBC results to pass variables through popups


BC
06-21-2003, 11:54 PM
Apologies for the confusing title.... But please read on :) Need some help here (and urgently!).

Let's say I have 1 table with the following fields -


Code No. Logo

21111 Logo 1
21112 Logo 2
21113 Logo 3


These table exists in a database in SQL Server 2000, and I'm using PHP to pull these results out via odbc_result_all.

Now with the table I'd like to add a field so that when the results come up, it displays the actual logo e.g. <img src="/logos/21111.gif">

Obviously 21111.gif would be pulled from the 'Code No.' field.

Is this possible? Or do I need to create a new field?

2. The other thing I need to do - have a look at the following table.


Code No. Song Title Pop-Up field

11111 Song 1
11112 Song 2
11113 Song 3


In the Pop-Up field, I will be inserting a JavaScript pop-up link which will do two things:

- Open a new page, 'popup.php' which will contain the following details:

Song Title: Song 1
Code No. 11111
(and other static information)

- As well, I will be embedding a midi (e.g. 11111.wav) in popup.php.

So in other words, I need to pass the code no. and song title as dynamic variables through the pop-up window via the GET method... (and do it for all 2000-odd songs in the DB).

Is this possible with ODBC results??? Would appreciate any guidances or pointers. If anyone could offer me a solution I would forever be in your debt....

Thanks in advance.

(bear in mind - the titles I've given to the fields are hypothetical and aren't the real field names, so they actually won't have spaces anyway :))