hopper
Member
- Messages
- 225
- Reaction score
- 0
- Points
- 16
here is the php script i am working on
the idea is to delete a record from a database and decrement the remaining id numbers by 1 to fill the gap, but the sql query keeps dieng, any suggestions?
(yes the delete part is commented out for the time being until i can get the update part running)
Code:
<?php
$mysqli = new mysqli("localhost", "root", **** "htf");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
else {
/*$sql = "DELETE FROM ".$_GET['type']." WHERE id=".$_GET["id"];
mysqli_query($mysqli, $sql);
echo "File Removed<br>"; */
for ($x = $_GET['id']; $x <= $_GET['highest']-1; $x++) {
$y=$x+1;
$sql = "UPDATE ".$_GET['type']." SET id=".$x." WHERE id = ".$y;
echo $sql."<br>";
mysqli_query($mysqli, $sql) or die('failed');
}
mysqli_close($mysqli);
}
//echo "<meta http-equiv=\"refresh\" content=\"0; URL=\"./manage.php\">";
(yes the delete part is commented out for the time being until i can get the update part running)
Last edited: