I am trying to make a php page that will, given a version number, list out all changes for newer versions. Here is my code so far, trimmed a little bit:
<?php
mysql_connect($host,$login,$pwd) or die("none");
$link=mysql_select_db($database) or die("none");
$r=mysql_query("SELECT * FROM `udtable` WHERE 1;");
$thisverstring= $_GET["myvn"];
$r=mysql_query("SELECT * FROM `udtable` WHERE `vnString` = '$thisverstring'");
@$n=mysql_num_rows($r)+0;
if($n==0) {
echo "none";
} else {
$line=mysql_fetch_array($r);
$key=$line['key'];
$s=mysql_query("SELECT * FROM `udtable` WHERE `key`>$key");
$theselines=mysql_fetch_array($s);
@$w=mysql_num_rows($s);
if ($w==0) {
echo "none";
} else {
echo "<!--currentversion-->";
for($i=0;$i<=$w;$i++) {
$line=mysql_fetch_array($s);
echo "$line[vnString]
$line[vnInfo]
";
}
}
}
?>
So far in my table, i have 3 rows, numbered by keys 1,2,3. When I enter the vnString of the oldest of the 3 updates, it shows that there are 2 newer updates, but only lists the newest updates information.
I hope this helps, it seems there is an issue with the for loop, if anyone could help that would be great.
Thank you.