Birdmansplace Posted December 28, 2009 Author Share Posted December 28, 2009 there are 7 in the database. that's weird. here is sql exported -- phpMyAdmin SQL Dump -- version 2.11.8.1deb5+lenny3 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Dec 28, 2009 at 11:21 AM -- Server version: 5.0.51 -- PHP Version: 5.2.6-1+lenny4 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `dominostest` -- -- -------------------------------------------------------- -- -- Table structure for table `simple_search` -- CREATE TABLE IF NOT EXISTS `simple_search` ( `sid` int(11) NOT NULL auto_increment, `stitle` varchar(50) NOT NULL, `sdescription` varchar(255) NOT NULL, `sbody` text NOT NULL, PRIMARY KEY (`sid`), KEY `stitle` (`stitle`), KEY `sdescription` (`sdescription`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; -- -- Dumping data for table `simple_search` -- INSERT INTO `simple_search` (`sid`, `stitle`, `sdescription`, `sbody`) VALUES (1, 'Test Simple Search 1', 'This is a test result for our MySQL simple search tutorial.', 'MySQL searching is a valueable item to be used in coordination with PHP. The data provided here will be easily searchable to users. Granted it will only provide the users with the basic, hence simple, search.'), (2, 'Searching Made Easy 101', 'Searching through MySQL sets is made easy in PHP', 'PHP provides us with a means to access Relational databases with ease. Through the functions that are provided a user is able to create a form and allow their clients to browse through postings that other''s have posted and find relevant articles to their searches. Because this is a search made easy it will not be exact or concise instead pull up a catch all to the terms searched.'), (3, 'Gateway to Information', 'The web provides us with many tools to access loads of information that are stored in a database on our server.', 'Storing information on your server is a great way to provide clients with different information. A client can now find information they were looking for all In one place. Utilizing a scripting language often makes access to this data easier and provides the server owner with a means to backup extreme amounts of data with ease. Not to mention access that data.'), (4, 'The Gaming World as we Know it', 'The gaming world as we know it has undergone many changes in the past. But what changes lay in the future?', 'Some say the future of gaming on computers relies in a virtual reality, but not like the 80''s virtual reality. This new virtual reality allows the user to use their mind to control elements of a video game, vs using a controller. This new aspect of gaming will put the user right in to the game by providing a more efficient way of controlling their character. How long before this technology is readily available, no body knows. But the gaming world as we know it is changing rapidly and only time will tell when this great feature will be added to the next gaming console.'), (5, 'Hundreds of Ants Attacking', 'Hundreds, if not thousands of Ants are starting to rage war against the human race. Can we stop it?', 'In recent news, Ants have been found to attack random people. A mom in Brazil reported that her child was just playing nicely outside when an Ant decided to go and bite her. The mom reported this incident to the police immediately, but as was told, the police were busy with nearly two dozen other Ant related reports. "I was scared for my childs life" report Janet Marget from Pawtucket, IL. "The ant just came running out of the bushes and charged me, I nearly escaped by stamping hard on the ground and crushing the ant." While some are over come by fear, others are embracing the new "regime" as it is being called. Jack Oldswell said, "I welcome the ants to take over. I mean come on, with ants out numbering humans, millions if not billions to one, they have the numbers.". This pandemic has caused quite a stir in the government agencies who have set up a task force to go and do recon on Ant colonies. Unfortunately, in this line of work, every employee has been bitten by multiple ants and this line of work is highly dangerous. As such the government raised the employees salary to three times the amount of a normal persons salary. As for this lowly reporter, I welcome the ants and offer them this statement so that they might spare me and save my life when they rule the planet.'), (6, 'testing', 'test1', 'testing 123'), (7, 'testung', 'test2', 'testung 456'); Quote Link to comment Share on other sites More sharing options...
Buddski Posted December 28, 2009 Share Posted December 28, 2009 Yes.. And none of them were affected by the delete query.. If you pass sid=7 into the delete1.php page see how many results are left after that.. Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 28, 2009 Author Share Posted December 28, 2009 same thing, its still in the database. Quote Link to comment Share on other sites More sharing options...
Buddski Posted December 28, 2009 Share Posted December 28, 2009 Ok.. echo out the sql for us.. and the get for the hell of it.. <?php echo $query.'<pre>'; print_r($_GET); echo '</pre>'; ?> just before the $result line Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 28, 2009 Author Share Posted December 28, 2009 #1 Query didnt fail - Affected rows: 0 DELETE FROM simple_search WHERE sid = '{1}' Array ( [sid] => {1} ) #2 Query didnt fail - Affected rows: 0 DELETE FROM simple_search WHERE sid = '{2}' Array ( [sid] => {2} ) skiped a couple #7 Query didnt fail - Affected rows: 0 DELETE FROM simple_search WHERE sid = '{7}' Array ( [sid] => {7} ) even added an 8th #8 Query didnt fail - Affected rows: 0 DELETE FROM simple_search WHERE sid = '{8}' Array ( [sid] => {8} ) Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 28, 2009 Share Posted December 28, 2009 Add this to your delete page after the include mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); Quote Link to comment Share on other sites More sharing options...
Buddski Posted December 28, 2009 Share Posted December 28, 2009 For some reason your main page is passing {#} as the value.. it would only be a number without the braces there.. And I found out why.. change this echo "<a href=\"deletePage.php?sid={{$record['sid']}}\">Delete</a>\n"; to echo "<a href=\"deletePage.php?sid=".$record['sid']."\">Delete</a>\n"; Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 28, 2009 Author Share Posted December 28, 2009 Update, Current code that i am using the "display" page where the delete link is at: <?php ini_set("display_errors", "1"); error_reporting(E_ALL); include("dbinfo.php"); mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "SELECT `stitle`, `sdescription`, `sbody`, `sid` FROM simple_search ORDER BY sid"; $result = mysql_query($query); if (!$result) { //Temporary error handling echo "There was a problem:<br />".mysql_error(); } while($record = mysql_fetch_assoc($result)) { echo "<br /><br />"; echo "{$record['sid']} {$record['stitle']} {$record['sdescription']} {$record['sbody']} "; echo "<a href=\"delete1.php?sid={{$record['sid']}}\">Delete</a>\n"; } ?> delete page code: <?php ini_set("display_errors", "10"); error_reporting(E_ALL); include "dbinfo.php"; mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); // if id provided, then delete that record $sid=$_GET['sid'] ; // create query to delete record $query = "DELETE FROM simple_search WHERE sid = '$sid' "; $result = mysql_query($query); if ($result) { echo 'Query didnt fail - Affected rows: '.mysql_affected_rows(); } else { echo 'Query failed: '.mysql_error(); } ?> <?php echo $query.'<pre>'; print_r($_GET); echo '</pre>'; ?> Quote Link to comment Share on other sites More sharing options...
Buddski Posted December 28, 2009 Share Posted December 28, 2009 Make the change I stated above the the display page and it should fix the problem.. Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 28, 2009 Author Share Posted December 28, 2009 +1 for Buddski thanks, the slightest miss key or wrong one really mess's with you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.