Posted by version2 on 11/19/21 11:57
Jerry you are the only one so far to understand,
And i do think this is a good idea.
I have implemented the code but there was an error with
"mysql_fetch_result"
here is the current setup. Could you have a look and tell me what i am
doing wrong
index.php
$HTMLOutput .= "<tr>
<td align=\"center\">".$record[exerciseName]."</td>
<td align=\"center\"><a href =
'item_position.php?action=moveup&ID=".$record[ID]."&muscleName=".$record[ArtistType]."'>move
up</a>".$record[position]."</td>
</tr>";
item_position.php
<?
if ($_GET["action"] == "moveup") {
$muscleName=$_GET['muscleName'];
$ID = $_GET["ID"];
$rank = 10;
//this is where i am adding in the 15
$phase1 = "UPDATE ".DB_PREFIX."".TBL_PREFIX." SET position = position +
15 WHERE ID = $ID;";
//this is where i am calling the $phase1 to run
mysql_query($phase1);
//this is your code i am tring to implement
$result1 = mysql_query("SELECT id, position FROM
".DB_PREFIX."".TBL_PREFIX." ORDER BY position");
while ($data = mysql_fetch_result($result1)) {
$result2 = mysql_query("UPDATE ".DB_PREFIX."".TBL_PREFIX." SET
position=$position WHERE id = {$data['id']}");
$rank += 10;
}
header("Location: index.php");
exit;
}
?>
[Back to original message]
|