We help IT Professionals succeed at work.
Get Started

store and call specific mysql records from a query in a javascript window.open() function

Ron McCain
Ron McCain asked
Last Modified: 2013-07-27
we have a ajax, php,mysql search script that gets records from a mysql dbase and list them in a table. the user can then select any of the found items and have a detail page returned.

we have a typical href script working to do this however what we need is to open the found item detail page(s) in a new browser window using the window.open() function.

We have this working, however selecting the window.open() function for any of the found items always calls the last record found when the query ran.

Below is the script producing this result, please assist so that we can get the window.open() to get the correct found item record.

.....mysql connects and queries database..............


<font size=2 color="#000000" face="Arial">
<div align="left"><table width="100%" border="1" cellpadding="0"  cellspacing="0" bgcolor="#ffcc99">
<td width="95"><font size=2 color="#000000" face="Arial">
<div>Issue Date:</div>



=====this script calls detail page and sends correct id for the appropriate found item

$prodsec1= "http://192.x.x.x/url_path/".$row['brand_wwb']."/".$row['type_wwb']."/".$call_detail_page."?prodwwb_pkid=".$row['prodwwb_pkid'].'">';

<script type="text/javascript">
function open_win_article()
      window.showModelessDialog('<?php echo $prodsec1; ?>','<?php echo $prodsec1; ?>',"dialogHeight: 725px; dialogWidth: 850px; dialogTop: 150px; dialogright: 450px; edge: Raised; center: yes; help: No; scroll: yes; status: no;")


<input type="button" value="Review This Item" onclick="open_win_article()" />

<td width="434"><?php echo $row['model_wwb']; ?> <br />

As stated with the above script we  always get the last found item record from the query, and to restate, a typival href() script always works to get the correct found item as selected from the found item display table.

We can provide more info if need, we are in a bit of a hurry so any fast help will be appreciated.
Watch Question
Most Valuable Expert 2011
Author of the Year 2014
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE