sorry to ask twice, but the other one was closed because it was missing important info and i apologize however my code is this:
if (isset($_GET['id'])) {
// Connect to the MySQL database
include "connect.php";
$id = preg_replace('#[^0-9]#i', '', $_GET['id']);
// Use this var to check to see if this ID exists, if yes then get the bio info
$sql = mysql_query("SELECT * FROM bio\n"
. "LEFT JOIN bio_media \n"
. "ON bio.id=bio_media.bioid\n"
. "WHERE bio.id = ".$id."\n"
. "\n"
. " LIMIT 0, 30 ");
// get all the bio details
while($row = mysql_fetch_array($sql)){
$name = $row["name"];
$age = $row["age"];
$division = $row["division"];
$pic = $row["pic"];
$story = $row["story"];
$fb = $row["fb"];
$tw = $row["tw"];
$type = $row['type'];
$file = $row['file'];
$alt = $row['alt'];
$title = $row['title'];
$Age= DetermineAgeFromDOB ($age);
while ($type == "image"){
$images .='<a rel="lb[pp_gal]" href="images/'.$file.'" ><img width="60px" alt="'.$alt.'" title="'.$title.'" src="images/'.$file.'" /></a>';
break;
}
$i=-1;
if($type == "video"){
$i++;
$videos .='<li><a href="watch.php?id='.$id.'&v='.$file.'&ref='.$i.'?iframe=true&width=745&height=520" rel="lb" title="'.$alt.'">'.$title.'</a></li>';
}
Question: How do i get the “ref” portion of the url to update +1 for each entry in the database?
If I understand you correctly, you have to get rid of
$i=-1;in the loop and just put$i=0;before the loop.By the way, you are overwriting your variables in the loop every time; either just add
$rowto an array and use that or don´t use these temporary variables at all and just use$rowdirectly where you need it.