Jump to content


useing MYSQL IDs in links


1 reply to this topic

#1 Pbkilldezines

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 02 December 2004 - 07:58 PM

Ok so heres what I want to do: I have a script setup that counts out going links from my affiliate page. I have a test script with the following code (not all of code- above this is the connect and stuff)

$table = "aff_affiliates";

$sql= mysql_query("SELECT * FROM $table ORDER BY count DESC");

$result = mysql_query('SELECT * FROM $table WHERE id="$id"');
$row2 = mysql_fetch_row("$result");

while($row = mysql_fetch_assoc($sql))
{
echo "<a href=\"http://www.pbkill.com/*.php?id=".$row2."\" target=\"_blank\"><img src=\"".$row[button]."\" border=\"0\"></a> ";
}
}

*** where I echo the link I want to generate the ID at the end of herf. Which then links with the image to make the affiliate button. This how ever dosnt work

Can someone tell me what im doing wrong????
THANKS!

#2 shao

    Original P2L Programmer

  • Members
  • Pip
  • 49 posts
  • Gender:Male
  • Location:Canada

Posted 04 December 2004 - 12:46 AM

It looks like you're trying to show the same ID for all your buttons. You should get rid of the results and row2 since they don't help. The data you get are from one table so use the id from that and replace row2 with row[id] similar to your row[button].

You simply need to work on your program logic before you code, it gets easier that way.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users