Jump to content

Getting id's issue


spur18

Recommended Posts

I am making a script using Java/HTML and PHP/Mysql. Basically its just at the moment for downloads, I have categorys with each file(s) that belong in the category. When you click on the File Name(title) It opens a Java based window with what is suspose to be the file information. I can get this to work normal in a normal popup window, but with this DHTML window it is getting the $_GET[id] from my categorys instead, Even though I have it clearly asking for the download ID. Im wondering if someone that knows more about php/mysql can help me see where my code problem is.

 

Below is my code, and you can see how it works here

http://spfactor.rscsites.org/downloads.php

You will see when you click on the Download name that it loads the wrong Data. My Cat ID for "cars" is id 2, but the download ID is 3. But the Maserati Setups is id 2. So its getting the wrong ID.

 

<?
//get the download list
$q1= "SELECT * FROM sp_dcat where cdid = '$_GET[id]'"; 
$r1 = mysql_query($q1) or die(mysql_error());
$q1 = "select * from sp_down where dcat = '$_GET[id]'";
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) > 0)
{
echo "<table STYLE='border-collapse:collapse;' width=675 height='25' align=center cellspacing=0>";

$col = "white";

while($a1 = mysql_fetch_array($r1))
{
	if($col == "white")
	{
		$col = "#ADBDCE";
	}
	else
	{
		$col = "white";
	}
echo "<tr><td width=20 height=25 style='border-width:1; border-color:black; border-style:solid;' bgcolor='#E9E9E9'><p align=center><img src=http://spfactor.rscsites.org/images/down_icon.gif></p></u></td>\t";
echo "<td width=333 height=25 style='border-width:1; border-color:black; border-style:solid;' bgcolor='#E9E9E9'><a href='loaddown.php?id=$a1[did]' onClick='openmypage();; return false'>$a1[dname]</a></td>\t";
echo "<td width=332 height=25 style='border-width:1; border-color:black; border-style:solid;' bgcolor='#E9E9E9'>Author: $a1[dauthor]</td>\t";
}
echo "</table>";
}
else
{
echo"No Files Found";
}
?>
<script type="text/javascript">
function openmypage(){
inlinewin=dhtmlwindow.open("broadcastbox", "inline", "<p align=center><?$q1= "SELECT * FROM sp_down where did = '$_GET[id]'"; $r1 = mysql_query($q1) or die(mysql_error());$a1 = mysql_fetch_array($r1);echo "$a1[dname]";?><br><?$q1= "SELECT * FROM sp_down where did = '$_GET[id]'"; $r1 = mysql_query($q1) or die(mysql_error());$a1 = mysql_fetch_array($r1);echo "<img src='$a1[dpic]' width='550' height='375''></a>";?><br><?$q1= "SELECT * FROM sp_down where did = '$_GET[id]'"; $r1 = mysql_query($q1) or die(mysql_error());$a1 = mysql_fetch_array($r1);echo "Description:$a1[ddesc]";?><br><?$q1= "SELECT * FROM sp_down where did = '$_GET[id]'"; $r1 = mysql_query($q1) or die(mysql_error());$a1 = mysql_fetch_array($r1);echo "Author:$a1[dauthor]";?><br><?$q1= "SELECT * FROM sp_down where did = '$_GET[id]'"; $r1 = mysql_query($q1) or die(mysql_error());$a1 = mysql_fetch_array($r1);echo "Download:<a href=$a1[dlink] target=_blank><img src='http://spfactor.rscsites.org/images/down_icon.gif'></a>";?>", "Download", "width=675px,height=600px,left=0px,top=25px,resize=1,scrolling=1")
}
</script>

 

Any help would be appreicated. :)

Thanks

Shawn

Link to comment
https://forums.phpfreaks.com/topic/59001-getting-ids-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.