Jump to content

Birdmansplace

Members
  • Posts

    170
  • Joined

  • Last visited

Everything posted by Birdmansplace

  1. how about posting the code for the rest of us to see. make sure to use the code tags when you post it.
  2. Notice: Undefined index: datepicker in page on line 57. I have added js jquery calander to a form entry. i have everything changed so it works in page and when and made sure code works for mysql to write the date to sql. So before i changed my code for this everything worked and would write to mysql. Once i got the calendar to work witch i had to change field names in sql and in the php code and now it wount work. If i change everything back it will. Only thing that has changed is adding the calendar and field name('s) in sql and php code. Line 57 is : $datepicker = mysql_real_escape_string($_POST['datepicker']); the hole page code: <div align="center"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link type="text/css" href="calendar/css/custom-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet" /> <script type="text/javascript" src="calendar/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="calendar/js/jquery-ui-1.7.2.custom.min.js"></script> <script type="text/javascript"> $(function(){ // Datepicker $('#datepicker').datepicker({ inline: true }); //hover states on the static widgets $('#dialog_link, ul#icons li').hover( function() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); } ); }); </script> <style type="text/css"> /*demo page css*/ body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;} .demoHeaders { margin-top: 2em; } #dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;} #dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;} ul#icons {margin: 0; padding: 0;} ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left; list-style: none;} ul#icons span.ui-icon {float: left; margin: 0 4px;} </style> </head> <?php ini_set("display_errors", "10"); error_reporting(E_ALL); if (isset($_POST['submit'])) { { //YOU NEED TO HAVE AN EXTERNAL PHP FILE WITH YOUR DATABASE CONNECTION DETAILS. LET ME KNOW IF YOU DON'T KNOW HOW include("dbinfo.php"); mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to establish a connection to the relevant database."); $stitle = mysql_real_escape_string($_POST['stitle']); $datepicker = mysql_real_escape_string($_POST['datepicker']); $sbody = mysql_real_escape_string($_POST['sbody']); $ipaddress = getenv('REMOTE_ADDR'); $now_datetime = date('Y-m-d h:i:s'); $msg = "Your request has been entered $stitle !"; $query = "INSERT INTO simple_search VALUES ('','$stitle','$datepicker','$sbody','$ipaddress',NOW())"; mysql_query($query); echo "<br />"; echo "<script langauge=\"javascript\">alert(\"".$msg."\");</script>"; echo "<a href='requestoff.php'><input name='' type='button' value='Enter another Request'/>"; echo "<br /><br /><br /><br />"; include("html/overall_footer.html"); exit(); } } ?> <br /> <li>Capitalize your First name as shown in box</li> <li>Date must be like this: "01/01/10" with out the quotes other wise it might be missed</li> <li>Reason: Appointment, cant open/close, etc...</li> <li>If you made a mistake thats ok, just re-enter with the correct info.<br /> The number at the begining is a list number and email me or texted me that<br /> you made a mistake along with the list number and I will delete it.</li> <br /> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> Name:<input type="text" name="stitle" id="stitle" value="Name<?php if (isset($_POST['stitle'])) echo $_POST['stitle']; ?>" size="10"/> <div div="datepicker"> Date: <input type="text" id="datepicker" value="<?php if (isset($_POST['datepicker'])) echo $_POST['datepicker']; ?>" size="12"> </div> <br /> <br /> Reason:<input type="text" name="sbody" id="sbody" value="Cant open/close, Etc..<?php if (isset($_POST['sbody'])) echo $_POST['sbody']; ?>" size="50"/> <br /> <input type="submit" name="submit" id="submit" value="Submit Details"> <input type="reset" name="reset" id="reset" value="Reset Form"> </form> </body> <div align="center"> <?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`, `datepicker`, `sbody`, `sid` FROM simple_search ORDER BY datepicker"; $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 "<input name='' style='font-size:14px' type='text' value='{$record['sid']} {$record['stitle']} {$record['datepicker']} {$record['sbody']} ' size='85' maxlength='10' readonly='true'/>"; } ?> </div> </div> I have been fighting this for over a day and just cant figure out wtf is causing the error code. Thanks
  3. +1 for Buddski thanks, the slightest miss key or wrong one really mess's with you.
  4. 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>'; ?>
  5. #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} )
  6. same thing, its still in the database.
  7. 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');
  8. np Query didnt fail - Affected rows: 0
  9. Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in ......delete1.php on line 13 Query didnt fail - Affected rows:
  10. <?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) or die ("epic FAIL because: ".mysql_error()); ?> once you click delete from the "display" page it takes you to the page this code is on.
  11. yay no more errors but still doesnt work.
  12. epic FAIL because: No database selected
  13. i see i missed the s in sid. still get same error.
  14. just added that to the deletepage.php i get: epic FAIL
  15. not getting any error messages eather.
  16. code for display: <?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=\"deletepage.phpl?sid={{$record['sid']}}\">Delete</a>\n"; } ?> deletepage.php <?php include "dbinfo.php"; // if id provided, then delete that record $sid=$_GET['sid'] ; // create query to delete record $query = "DELETE FROM simple_search WHERE id = '$sid' "; $result = mysql_query($query) or die ("epic FAIL!") ?>
  17. how about the deletepage.php code. mine is the second "code" in first post. could you provide me with code that will work? Thanks
  18. I found this in tutorials http://www.phpfreaks.com/tutorial/simple-sql-search and i liked the set up of that (thanks to who wrote it). I am making a "request off" db for work and i am looking for how to delete row buy row using sid I have searched for it here and cant figure it out. heres the page code i am usein to display it and would like to know how to get delete to work let alone code it. <? 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 * FROM simple_search ORDER BY sid"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $sid=mysql_result($result,$i,'sid'); $stitle=mysql_result($result,$i,'stitle'); $sdescription=mysql_result($result,$i,'sdescription'); $sbody=mysql_result($result,$i,'sbody'); ?> <div align="center"> <br /> <br /> <? echo $sid; ?> <?php echo $stitle; ?> <?php echo $sdescription; ?> <?php echo $sbody; ?> <? echo "<a href='link.for.delete.code.will.go.here'><input name='' type='button' value='delete'/></a>"; ?> <? $i++;} ?> this is code that i have found and was trying to use for delete: <?php include "dbinfo.php"; // if id provided, then delete that record $sid=$_GET['sid'] ; // create query to delete record $query = "DELETE FROM simple_search WHERE id = '$sid' "; $result = mysql_query($query) or die ("epic FAIL!") ?>
  19. my form has 153 enterys. Once the submit button has been clicked it saves to mysql. What i am trying to figure out is the best way to edit after submit. Basicly from the "view" page is to be able to change 1 to 153 enterys then submit again but over write what has been saved with out creating a new entry. the only idea i can come up with is manualy changing enterys in phpmyadmin or mate "view" and "form" page together. meaning "view" page calls the info from sql and displays it then while on that page also have "form" code in it so you can submit the changes. Doing it that way to me would create another entery and still would have to go into phpmyadmin and delete the other. What i am making is an online schedule for work and would hate to delete the hole thing if the user while entering made a mistake. I already have delete set up to wipe out the whole table but the manager would like to keep a record for so long to look back on. I just looking for something to edit one entry.
  20. is there a way using the above code sence its calling for the newest entry by date to delete it? thinking thats going to be by best route atm.
  21. i guess i could say that i would like code that 1st. calls what to display followed but submit again but over writes the data.
  22. I have been searching for hours over the last day or 2 for find let alone understand how i would write code for calling the last data entered to mysql and then submiting the changed data. I already have code for entering it and code to read it to display from html/php. How would i go about doing that? I know basic php, not so much mysql atm so, with that said much help would be needed. this is part of the code that i have php connecting to mysql to read and then display the contents. include("dbinfo.php"); mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM schedule ORDER BY date DESC"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); So lost.......
  23. Thanks for the help, Turns out helps to have data in the database to display. Well then for users that need the code there you go.
  24. For some reason i cant figure out why its not getting info from mysql table. <br /> <div align="center"> <table style="width 87%" border="1" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">&#8226 Entrys &#8226</th> <th><font face="Arial, Helvetica, sans-serif">&#8226 User Name &#8226</th> <th><font face="Arial, Helvetica, sans-serif">&#8226 Amount &#8226</th> <th><font face="Arial, Helvetica, sans-serif">&#8226 Date &#8226</th> <th><font face="Arial, Helvetica, sans-serif">&#8226 Trans Type &#8226</th> <th><font face="Arial, Helvetica, sans-serif">&#8226 Trans Type &#8226</th> <th><font face="Arial, Helvetica, sans-serif">&#8226 Trans Type &#8226</th> <th><font face="Arial, Helvetica, sans-serif">&#8226 Trans Type &#8226</th> </tr> <? 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 * FROM schedule"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $day1=mysql_result($result,$i,'day1'); $day2=mysql_result($result,$i,'day2'); $day3=mysql_result($result,$i,'day3'); $day4=mysql_result($result,$i,'day4'); $day5=mysql_result($result,$i,'day5'); $day6=mysql_result($result,$i,'day6'); $day7=mysql_result($result,$i,'day7'); $day8=mysql_result($result,$i,'day8'); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><? echo $day1; ?></td> <td><font face="Arial, Helvetica, sans-serif"><? echo $day2; ?></td> <td><font face="Arial, Helvetica, sans-serif"><? echo $day3; ?></td> <td><font face="Arial, Helvetica, sans-serif"><? echo $day4; ?></td> <td><font face="Arial, Helvetica, sans-serif"><? echo $day5; ?></td> <td><font face="Arial, Helvetica, sans-serif"><? echo $day6; ?></td> <td><font face="Arial, Helvetica, sans-serif"><? echo $day7; ?></td> <td><font face="Arial, Helvetica, sans-serif"><? echo $day8; ?></td> </tr> <? $i++;} echo "</table>"; ?> </div> nothing from database loads on page. What did i do wrong? Using old code from another project and it works using the old fields, db, and table. just coped and pasted in to a new file and changed to fit new database and table.
×
×
  • 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.