PHP - Delete From Not Working
Hi all,
this is probably the easiest thing and I may have just been staring at the screen for too long but one of my DELETE FROM queries isn't working. I created a cart and in the admin area when an admin deletes the product it is supposed to delete it from the 'Products' table and also all the sizes from the 'Sizes_List' table. Right now it is only being deleted from the Products table and not the Sizes_List table.. here is the snippet.. any help would be greatly appreciated. Code: [Select] if (isset($_GET['yesdelete'])) { // remove item from system and delete its picture // delete from database $id_to_delete = $_GET['yesdelete']; $deletefrom_sizes = mysql_query("DELETE FROM Sizes_List WHERE product_id = '$id_to_delete'"); $sql = mysql_query("DELETE FROM Products WHERE product_id='$id_to_delete' LIMIT 1"); // unlink the image from server // Remove The Pic ------------------------------------------- $pictodelete = ("../user/rent/inventory_images/$id_to_delete.jpg"); if (file_exists($pictodelete)) { unlink($pictodelete); } header("location: addproduct.php"); exit(); } Similar TutorialsI'm working on an existing project, it's a mess but for the moment I just have to get the delete function working, but keep getting an error and I'm not sure what I'm missing. The query string is a mess, but that's a headache for another day. The target shouldn't ge part of the query string, but that's how someone else had set it up so for now I'm stuck trying to work with it as it is currently and just have to get some basic CRUD functionality going. The other minor snag is inconsistencies with the name of the primary key between tables. It's not consistently called 'ID" so I need to get both the key and value for the where part of the DELETE statement. The query that I currently have is not working. Error 500, can't even get a simple var_dump to work.
Query string as it is in its present state: Quotesomewbsite.com/endpoints/delete.php?target=TABLENAME&primaryKey=7 <?php include('includes/config.php'); $table = $_GET['target']; parse_str($_SERVER['QUERY_STRING'], $data); array_shift($data); $cols = array_keys($data); $vals = array_values($data); $idType = $cols[0]; $id = $vals[0]; $stmt = $pdo->prepare("DELETE FROM SOME_DATABASE.$table WHERE $idType = '$id';"); $status = $stmt->execute(); if($status) { echo "Success"; } else { echo "Fail"; } ?>
Hi I am struggling with my last page for a project it is a delete page that retrieves data from a list, asks the user if he wants to delete that record if 'yes' delete it otherwise redirect to another page. My page looks like it should, but the function is not working. my code is: Code: [Select] <?php //check to see if user is logged on session_start(); if (!(isset($_SESSION['login']) && $_SESSION['login'] != "")) { header ("Location:login.php"); } include('connect.php'); //connection details to database in a connect.php page //if form was submitted if (isset($_REQUEST['yes'])){ $product_id = $_GET['product_id']; $productname = $_POST['pname']; $range = $_POST['prange']; $price1 = $_POST['pprice']; $price = (int)$price1; $query = "DELETE FROM products WHERE product_id = '$product_id'"; $result = mysql_query($query); print "<br> $productname from range $range with a price of R$price has been deleted!</br>"; } } if (isset($_GET['product_id'])){ $product_id = $_GET['product_id']; $query = "SELECT * FROM products WHERE product_id = '$product_id'"; $result = mysql_query($query); echo "<form method = \"post\" action = \"delete.php\">"; while($row = mysql_fetch_array($result)){ echo "<table>"; echo "<tr>"; echo "<td><input name = 'product_id' type = 'hidden' value ='{$row['product_id']}'></td>"; echo "</tr>"; echo "<tr>"; echo "<td>Do you really want to delete {$row['product_name']} from range {$row['product_range']} with a price of R{$row['product_price']} from the database?</td>"; echo "</tr>"; echo "<tr>"; echo "<td<input type = 'submit' name = 'yes' value = 'Yes'><input type = 'submit' name = 'no' value = 'NO'></td>"; echo "</tr>"; echo "</table>"; } echo "</form>"; } ?> Any help please? <?php $db = new PDO('mysql:host=localhost;dbname=wordpress', 'root',''); //---------prepare $delete3 = $db->prepare("DELETE FROM wp_term_relationships WHERE object_id=:id"); $delete2 = $db->prepare("DELETE FROM wp_posts WHERE ID=:id"); $delete = $db->prepare("DELETE FROM wp_postmeta WHERE post_id=:id"); $select = $db->prepare("SELECT post_id FROM reference WHERE x_id=?"); $delete->bindValue(':id', $id, PDO::PARAM_STR); $delete2->bindValue(':id', $id, PDO::PARAM_STR); $delete3->bindValue(':id', $id, PDO::PARAM_STR); //---------- echo 'conected-----'; { $delfeed = '';} $array = explode(',',$delfeed); foreach($array as $deadman){ $select->execute(array($deadman)); $row = $select->Fetch(PDO::FETCH_ASSOC); $id = $row['post_id']; if ($id == null){} else { echo "$id"."\n"; $delete->execute(); $delete2->execute(); $delete3->execute(); } $id++; } echo 'done!'; ?>its a simple delete script but it doesnt delete, it does print the right $id's witch means is working till there but delete goes bananas,double checked table names ,colums... tryied working with question mark place holders insted of bind parameter but nothing I am trying to delete records across 3 tables but my code does not work. Code: [Select] $query = ("SELECT `propertyref` FROM `feed_property` WHERE `status` = 'Sold' ")or die(mysql_error()); $result = mysql_query($query); if (isset($result)) { while ($row = mysql_fetch_array($result)): $ref1 = mysql_real_escape_string($row['propertyref']); $query1 = ("DELETE FROM `feed_property`, `feed_images`, `feed_characteristics`\n" . "USING `feed_property` INNER JOIN `feed_images` INNER JOIN `feed_characteristics`\n" . "WHERE feed_property.propertyref = '$ref1'\n" . " AND feed_images.propertyref = feed_property.propertyref\n" . " AND feed_characteristics.propertyref = feed_property.propertyref; ")or die(mysql_error()); echo $query1; endwhile; if(!mysql_query($query1)){ echo '<h1 style="color: red;">Error</h1><p>', mysql_error(), '</p>'; } else { echo '<h1 style="color: red;">Properties have been removed from the database</h1>'; } } Query1 echos as: Code: [Select] DELETE FROM `feed_property`, `feed_images`, `feed_characteristics` USING `feed_property` INNER JOIN `feed_images` INNER JOIN `feed_characteristics` WHERE feed_property.propertyref = 'abc1' AND feed_images.propertyref = feed_property.propertyref AND feed_characteristics.propertyref = feed_property.propertyref; DELETE FROM `feed_property`, `feed_images`, `feed_characteristics` USING `feed_property` INNER JOIN `feed_images` INNER JOIN `feed_characteristics` WHERE feed_property.propertyref = 'abc2' AND feed_images.propertyref = feed_property.propertyref AND feed_characteristics.propertyref = feed_property.propertyref; The query completes without errors but does not delete the entries in the DB. If I run the query singly in PHP My Admin it functions correctly. thanks for your help connection is fine .. can read records .. but can't delete ... any ideas.. Code: [Select] <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="test"; // Database name $tbl_name="test_mysql"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td><form name="form1" method="post" action=""> <table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td bgcolor="#FFFFFF"> </td> <td colspan="4" bgcolor="#FFFFFF"><strong>Delete multiple rows in mysql</strong> </td> </tr> <tr> <td align="center" bgcolor="#FFFFFF">#</td> <td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Lastname</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Email</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td> <td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['name']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['lastname']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['email']; ?></td> </tr> <?php } ?> <tr> <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> <? // Check if delete button active, start this if($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM $tbl_name WHERE id='$del_id'"; $result = mysql_query($sql); } // if successful redirect to delete_multiple.php if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete_multiple.php\">"; } } mysql_close(); ?> </table> </form> </td> </tr> </table> Mod edit: [code] . . . [/code] tags added. Hi all. Here is my scripts which allow user to check multiple rows of data and delete it , but it require select data and click for twice to delete the rows , what should be the error? Code: [Select] <form name="frmSearch" method="post" action="insert-add.php"> <table width="600" border="1"> <tr> <th width="50"> <div align="center">#</div></th> <th width="91"> <div align="center">ID </div></th> <th width="198"> <div align="center">First Name </div></th> <th width="198"> <div align="center">Last Name </div></th> <th width="250"> <div align="center">Mobile Company </div></th> <th width="100"> <div align="center">Cell </div></th> <th width="100"> <div align="center">Workphone </div></th> <th width="100"> <div align="center">Group </div></th> </tr> </form> <? echo "<form name='form1' method='post' action=''>"; while($objResult = mysql_fetch_array($objQuery)) { echo "<tr>"; echo "<td align='center'><input name=\"checkbox[]\" type=\"checkbox\" id=\"checkbox[]\" value=\"$objResult[addedrec_ID]\"></td>"; echo "<td>$objResult[addedrec_ID] </td>"; echo "<td>$objResult[FirstName]</td>"; echo "<td>$objResult[LastName] </td>"; echo "<td>$objResult[MobileCompany] </td>"; echo "<td>$objResult[Cell] </td>"; echo "<td>$objResult[WorkPhone] </td>"; echo "<td>$objResult[Custgroup] </td>"; echo "</tr>"; } echo "<td colspan='7' align='center'><input name=\"delete\" type=\"submit\" id=\"delete\" value=\"Delete\">"; if (isset($_POST['delete']) && isset($_POST['checkbox'])) // from button name="delete" { $checkbox = ($_POST['checkbox']); //from name="checkbox[]" $countCheck = count($_POST['checkbox']); for($d=0;$d<$countCheck;$d++) { $del_id = $checkbox[$d]; $sql = "DELETE from UserAddedRecord where addedrec_ID = $del_id"; $result2=mysql_query($sql) or trigger_error(mysql_error());;; } if($result2) { $fgmembersite->GetSelfScript(); } else { echo "Error: ".mysql_error(); } } echo "</form>"; Thanks for every reply. <body> <?php include 'sql.php'; $query = "SELECT * FROM validation"; $result = mysqli_query($con , $query); $rows = mysqli_fetch_assoc($result) ; $totals = mysqli_num_rows($result) ; ?> <div id="css"> <form > <table width="80%" border="0" cellpadding="2" cellspacing="2" > <caption><h2>Personal Details of Customers</h2></caption> <tr class="white"> <td bgcolor="#330033"> </td> <td bgcolor="#330033"> Id Number </td> <td bgcolor="#330033"> Full Name </td> <td bgcolor="#330033"> Email Address </td> <td bgcolor="#330033"> Website </td> <td bgcolor="#330033"> Comment </td> <td bgcolor="#330033"> Time </td> </tr> <?php while($rows=mysqli_fetch_assoc($result) { <tr> <input type="raido" name="ID" value="<?php echo $rows['ID']; ?>" /> <td bgcolor="#FFFFCC"><?php echo $rows['ID'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Name'];?> </td> <td bgcolor="#FFFFCC"><?php echo $rows['Email'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Website'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Comment'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Time'];?></td> <td> </td> <td> <a href="delete.php? ID= "$rows[ID]" /"> <input type="submit" name="del" value="Delete" /> </a> <input type="button" name= "edit" value="Edit" /> </td> </tr> }?> </table> </form> </div> </body> Hi,
I wish to find out is there any possible that I can delete some data inside my php website but inside my sql database, the record will still at there?
Thank you.
I'm trying to set it so that it will delete an entire populated directory based upon a value in the database then after finishing that to go back and delete that row in the database. my current code is Code: [Select] <?php $page_title = "Central Valley LLC | Photo Addition" ?> <?php include("header.php"); ?> <?php include("nav.html"); ?> <div id="content"> <form action="delprod.php" method="post" enctype="multipart/form-data"> <label for="which">Choose A Product To Remove:</label> <?php $con = mysql_connect("localhost","phoenixi_cv","centraladmin"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("phoenixi_cvproducts", $con); $result = mysql_query("SELECT * FROM Products"); echo "<select name=\"which\">"; while($row = mysql_fetch_array($result)) { echo "<option "; echo "value=\"" . $row['id'] . "\">"; echo $row['Name'] . "</option>"; } echo "</select>"; mysql_close($con); ?> <br /> <input type="submit" name="submit" value="Submit" /> </form> </div><!--#content--> <?php include("footer.html") ?> and the delete script Code: [Select] <?php $con = mysql_connect("localhost","phoenixi_cv","centraladmin"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("phoenixi_cvproducts", $con); $result = mysql_query("SELECT id FROM Products WHERE id=$_POST['which']"); $row = mysql_fetch_array($result) chdir('assets'); chdir('images'); $mydir = $row . '/'; $d = dir($mydir); while($entry = $d->read()) { if($entry!="." && $entry!="..") { unlink($_POST['which'] . '/' . $entry); } } rmdir($mydir); $result = mysql_query("DELETE * FROM Producs WHERE id=$_POST['which']"); ?> Thank you in advance for all your help. any easier ways of approaching this will be welcome as well ok, so how would I insert a link to remove a photo from this code: Code: [Select] <?php include("connect_to_mysql_1.php"); $query = "SELECT link, id FROM products where page123=$page ORDER BY listorder ASC "; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $link = stripslashes($row['link']); $id = stripslashes($row['id']); ?> <li id="arrayorder_<?php echo $id ?>"> <img src="<?php echo $link; ?>" width="300" height="250"/> <div class="clear"></div> </li> <?php } ?> </ul> the images are able to move around but I need to know a way to keep photos with their own delete link. I am thinking of someway using listorder and the page123 to do it. could anybody help. I can't really think of a good way to describe the issue... Hi,i know this is a duplicated thread but i have made changed to code and I have been trying to create a functionality which allows users to delete multiple entries from database, I have been working on this for a while now but cant get my head around it, can u please tell me what im doing wrong here? thanks in advance <?php session_start(); include ("../global.php"); //welcome messaage $username=$_SESSION['username']; echo "$username"; $query=mysql_query("SELECT id FROM users WHERE username='$username'"); while($row = mysql_fetch_assoc($query)) { $user_id = $row['id']; echo $id; } $per_page=5; $start=$_GET['start']; $record_count =mysql_num_rows(mysql_query("SELECT * FROM rent")); ?> <td><form name="form1" method="post" action=""> </td> <?php $max_page=$record_count/$per_page; if(!$start) $start=0; $result= mysql_query("SELECT id, msg, title, reference FROM msg LIMIT $start, $per_page"); while($row = mysql_fetch_array($result)) { $id=$row['id']; $msg=$row['msg']; $reference=$row['reference']; $title=$row['title']; ?> <table> <tr> <td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td> <td><?php echo $title; ?></td> <td><?php echo $id; ?></td> <td><?php echo $reference; ?></td> <td><?php echo $msg; ?></td> </tr> </table> <tr> <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> <?php //while } $prev=$start - $per_page; $next=$start + $per_page; if(!($start<=0)) echo "<a href='view-data.php?start=$prev'>Previous</a>"; if(!($start>=$record_count-$per_page)) echo "<a href='view-data.php?start=$next'>Next</a>"; if(isset($_POST['delete'])) { for($i = 0; $i <= count($_POST['checkbox']); $i++) { $del_id = $checkbox[$i]; $sql = "DELETE FROM rent WHERE id='$del_id'"; $result = mysql_query($sql); } if($result) { header('Location: view-data.php'); } } ?> </table> </form> nevermind delete hi. just a quick question about a delete link i have on a page ive made. basically with the code i have currently...nothing at all happens when i click delete...and i cant for the life of me see the problem. here is the code for the page where the delete link is. $sql=mysql_query("SELECT items.itemname, cat.catid, cat.category FROM items,cat WHERE cat.catid=items.catid"); $temp_item = ""; while($res=mysql_fetch_array($sql)) { echo "<table cellpadding='0' cellspacing='0' width='700'><tr>"; if($res['category'] != $temp_cat ) { echo "<td width='30%'>" . "<b>" . $res['category'] . "</b>" . "</td>" . "<td width='30%'><a href='delcat.php?id=$res[catid]'>Delete Category</a></td></tr>"; $temp_cat=$res['category']; } and here is the code for the delete page that should do the deleting. include_once("config_class.php"); $db = new db(); // open up the database object $db->connect(); // connect to the database //getting id of the data from url $id = $_GET['id']; //deleting the row from table $result=mysql_query("DELETE FROM cat WHERE listid=$id"); //redirecting to the display page (index.php in our case) header("Location:list.php?id=$id"); as i said nothing happens...please help anybody? Hi, I need a simple command to delete all rows where userID = 2567 I had a shot but didn't work: DELETE FROM * WHERE userID='2567' || usgID='2567' My website is spammed by this user so I want to delete all records by this userID in my database. Hope someone can help and thanks! I get registered spammers on my website, they seem to bypass captcha (manually spamming I believe) and we all know why IP ban is no good so I want to be able to simply delete all rows on my database where this user comes from. Can you use one query to delete from all tables with WHERE userID= '$userID' ?? Hello, the user selects an id (sid) on select form then presses confirm button. Below is my delete function however I have error : Warning: Missing argument 5 for dbstudent::delete_student(), called in C:\xampp\htdocs\cw1\delstudent.php on line 36 and defined in C:\xampp\htdocs\cw1\studentfunc.php on line 28 SQL Insertion error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(sid, name, address, postcode, photo) from student where values ('1', '', '', '' at line 1 Please advise!! function delete_student($sid, $name, $address, $postcode, $photo) { $esc_name = mysql_real_escape_string($name, $this->conn); $esc_address = mysql_real_escape_string($address, $this->conn); $esc_postcode = mysql_real_escape_string($postcode, $this->conn); $esc_photo = mysql_real_escape_string($photo, $this->conn); $sql = "delete (sid, name, address, postcode, photo) from student where values ('{$sid}', '{$esc_name}', '{$esc_address}', '{$esc_postcode}', '{$esc_photo}')"; $result = mysql_query($sql, $this->conn); if (!$result) { die("SQL Insertion error: " . mysql_error()); } else { $numofrows = mysql_affected_rows($this->conn); return $numofrows; } } I need a bit of help. I am displaying records from a db, and want the user to be able to delete a record. I'm almost there (I think) but it doesn't pass the variable ($hours_id) to the delete query. Any ideas? Should be easy...but I'm just at my end. <?php include '../php/config_conn.php'; $querysum = "SELECT SUM(total_time) FROM `coop_hours` where user = '".$_SESSION['user_name']."'"; $resultsum = mysql_query($querysum); $arr = mysql_fetch_row($resultsum); $resulthours = $arr[0]; $querytime = "SELECT * FROM `coop_hours` WHERE user = '".$_SESSION['user_name']."' ORDER BY 'date_completed'"; $result = mysql_query($querytime); $num = mysql_num_rows($result); mysql_close(); echo "<table width='800' cellpadding='0'><tr> <td><strong>Coop Job</strong></td> <td align=center><strong>Date Completed</strong></td> <td align=center><strong>Total Time</strong></td> <td><strong>Comments</strong></td><td>Delete Entry</td></tr>"; $i=0; while ($i < $num) { $hours_id = mysql_result($result, $i, "hours_id"); $user = mysql_result($result, $i, "user"); $coop_job = mysql_result($result, $i, "coop_job"); $date_completed = mysql_result($result, $i, "date_completed"); $start_time = mysql_result($result, $i, "start_time"); $end_time = mysql_result($result, $i, "end_time"); $total_time = mysql_result($result, $i, "total_time"); $comments = mysql_result($result, $i, "comments"); echo "<tr><td>$coop_job</td> <td align=center>$date_completed</td> <td align=center>$total_time</td> <td>$comments</td> <td align=center> <a href='php/del.php'><img src='images/del.png'></a></td> </tr>"; $i++; } echo "<tr><td colspan=5><hr></td></tr>"; echo "<tr><td></td><td align=right>Total hours:</td><td align=center>$resulthours</td><td></td></tr>"; echo "<table>"; ?> And here is del.php: <?php include '../../php/config_conn.php'; $del_query = ("DELETE FROM coop_hours WHERE hours_id = '".$hours_id."' LIMIT 1"); $result = mysql_query($del_query); header("Location: http://.../myaccount-testing.php"); ?> I am building a user interface to manipulate a database I have in mySQL and one of the functions is deleting records from a table I call Titles. Given my primary key is mID and a column in the table is Title, here is the code I'm working with: $sql="delete from myDb.Titles where mID=" . $_GET['mID']; if (mysql_query($sql)) { $target="delete.php?"; } echo "Successfully deleted title: " . $_GET['Title']; The actual delete itself is working fine and the record deletes properly. What I am trying to do is display the Title field associated with the record being deleted and it's not working. I don't know if I am misusing the GET function or not, but that's where I am. Any help would be appreciated. I want to delete record which i clicked the delete button in the table. I want a confirm box for delete Help me solve.. Here is code display.php Code: [Select] <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("register",$cn); $qry2=mysql_query("SELECT * FROM reg_table"); ?> <html> <head> <script type="text/javascript"> function show_confirm() { var r=confirm("Do you want to Delete?"); if (r==true) { } else { alert("You pressed Cancel!"); } } </script> </head> <body> <form action="delete.php" method="get"> <table width="200" border="1"> <tr> <th scope="col">Name</th> <th scope="col">Address</th> <th scope="col">Gender</th> <th scope="col">Qualify</th> </tr> <?php while($res=mysql_fetch_array($qry2)) {?> <tr> <td><?php echo $res['name']; ?></td> <td><?php echo $res['adrs']; ?></td> <td><?php echo $res['gender']; ?></td> <td><?php echo $res['qualify']; ?></td> <td> <a href="edit.php?uid=<?php echo $res['id']; ?>">edit</a></td> <!--<td> <button type="button" onClick="return show_confirm();">Delete</button> </td> --> <td> <input type="hidden" name="nid" value="<?php echo $res['id']; ?>" /> </td> <td> <input type="submit" value="Delete" name="del" onClick="return show_confirm();"> </td> </tr> <?php } ?> </table> </form> </body> </html> delete.php Code: [Select] <html> <body> <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("register",$cn); $del_id=$_GET['nid']; $qry=mysql_query("delete from reg_table where id='".$del_id."' ") or die(mysql_error()); if($qry) { echo "deleted"; } else { echo "not deleted"; } ?> <!--<form action="update.php" method="get"> <br /> Name: <input name="name" type="text" maxlength="20" /><br /><br /> <input type="hidden" name="uno" value="// echo $id; "> <input name="submit" type="submit" value="Save" /> </form> --> </body> </html> This script will clear the old limit value from the URL query: <?php //remove any old limits from query $tmp = array(); foreach ($_GET as $fld => $val) if ($fld != 'limit') $tmp[] = $fld . '=' . $val; $page_name = $_SERVER['SCRIPT_NAME'] . '?' . implode('&',$tmp); ?> Code: [Select] <form> <select"> <option value="<? echo "$page_name" ?>&start=0&limit=25">25 records per page</option> <option value="<? echo "$page_name" ?>&start=0&limit=50">50 records per page</option> <option value="<? echo "$page_name" ?>&start=0&limit=100">100 records per page</option> </select> </form> How can I get it to clear BOTH the start and the limit values in the URL? Thank you. ~Wayne |