Jump to content

Recommended Posts

Hello I need some help here as I cant see where I'm going wrong with my code???

 

I have say 5 rows in a table and if I delete row 3, row 3 is deleted and rows 4 & 5 are now renamed to rows 3 & 4. make sense?

 

BUT when I try to delete row 1 I end up with two row 2's.

 

Any help appreciated...

 

 

//Find the amount of LineItems and delete

$CheckItemDelete=$_GET["LineItemDelete"];

 

 

//Find quote number and show frames to edit

$result = mysql_query("SELECT * FROM Table WHERE ID='1'") or die(mysql_error()); 

($row = mysql_fetch_array($result));

$QuoteCheck = ($row['QuoteCheck']);

 

mysql_query("DELETE FROM Table WHERE LineItems='$CheckItemDelete' && QuoteNum='$QuoteCheck'");

 

mysql_query("DELETE FROM Table WHERE LineItems='$CheckItemDelete' && QuoteNum='$QuoteCheck'");

 

mysql_query("DELETE FROM Table WHERE LineItems='$CheckItemDelete' && QuoteNum='$QuoteCheck'");

 

 

 

$result3 = mysql_query("SELECT * FROM Table WHERE QuoteNum='$QuoteCheck' ORDER BY LineItems ASC") or die(mysql_error()); 

($row3 = mysql_fetch_array($result3));

 

while($row3 = mysql_fetch_array($result3))

{

if (($row3['LineItems']) > $CheckItemDelete){

$LineItemCountAdjust = ($row3['LineItems']) - 1;

$LineItemCount = ($row3['LineItems']);

 

rename("Folder/$QuoteCheck$LineItemCount.png", "Folder/$QuoteCheck$LineItemCountAdjust.png");

 

echo "$LineItemCountAdjust";

echo "$LineItemCount";

$result = mysql_query("UPDATE Table SET LineItems ='$LineItemCountAdjust' WHERE LineItems='$LineItemCount' && QuoteNum='$QuoteCheck'")

or die(mysql_error());

}

 

}

 

$MyDir = "Folder/";

$MyExt = ".png";

 

unlink($MyDir.$QuoteCheck.$CheckItemDelete.$MyExt);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.