Dup Posted September 15, 2005 Share Posted September 15, 2005 Ok, been a long time since I posted in here, but here goes! Basically im after a small PHP solution for a small project im working on for someone. Basically I would like to have an updatable script where the user can upload change and delete the details of an event. Basically it needs these fields: Title, Dates (like begin - dd/mm/yy/ and end - dd/mm/yy or something more simple) and a full description. Also an option field for a weblink would be nice too. This data will be output via a table on a page on its own, but I would also like the data to be accessed by another page where dates and descriptions are output in a column in a list where only 3/4 are displayed, oldest first. I'm not sure on the volume of work involved here but I have no PHP experience at all apart from editing a few values etc. If anyone could help me or has a script which could be edited to suit i could really appreciate it. Link to comment Share on other sites More sharing options...
Johnno Posted September 15, 2005 Share Posted September 15, 2005 (edited) You may be able to find a suitable script on HotScripts, or similar. If not, this wouldn't be a hard script to write - just some basic PHP and MySQL (it would be possible with a flat-file database, I know, but i'd prefer MySQL). This could serve as the MySQL table: CREATE TABLE `event` (`id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `title` VARCHAR(100) NOT NULL,`startdate` DATE NOT NULL,`enddate` DATE,`description` TEXT NOT NULL,`related1` VARCHAR(100),`related2` VARCHAR(100),); The TEXT for the description row can store up to 65 535 characters - enough for this kind of application. Also, I added 2 related rows, so the user can input up to 2 related links. From there you'd just need to write 2 (maybe more) PHP scripts - one to insert new events into the database, and one to output the events. I might do that tommorow . Update: I figured since I can't sleep, i'd so some more. (none of this has been tested - it should work though) connect.php To connect to the database, you'll need a connection file. display.php This is the file to display the events - at the moment, it displays all of the events in a long list. Not the best method, but it can be improved upon. It's been a while since i've used tables, so they're probably wrong. The PHP code shouldn't be too bad though. insert.php This one will provide the form and PHP to insert an event into the database. It should be enough for now, but it could also be improved. The sticky-form should work - it's been a while since i've made one. parsecode() will only parse (i'm not confident enough with regexp's for this): link - [link]http://google.comGoogle[/url]image - [img=http://google.com/image.jpg]strong - [s]Strong text.[/s]emphasis - [em]Emphasized text.[/em] There we are - a fairly simple script in 3 files and a database. To install, just place connect.php, display.php and insert.php in the same directory. Either build your page around them, or include them into another PHP page. For setting up the MySQL, i'm assuming your host has MySQL installed. As well as Cpanel and PHPMyAdmin. If not, i'll leave that to someone else. Login to Cpanel, and click on phpMyAdmin. Add a new user/password, and database (remember to insert these values into connect.php). Give the new user all permissions to that database. From memory, there is a small link at the bottom of where you are - click it. phpMyAdmin should now be opened. Select your new database from the drop-down menu. There should be a little textarea for you to use MySQL commands, in the main frame - insert the MySQL code above into here, and submit. That should then be done. I'm getting rather tired now, so good luck . Edited September 15, 2005 by Johnno Link to comment Share on other sites More sharing options...
Dup Posted September 15, 2005 Author Share Posted September 15, 2005 Wow, I understand how the MySQL table works, played with them before. I wasn't asking for someone to write it, although that would rock. Im hoping this "simple" exercise will help me understand PHP a bit more so I can get into it myself as its the next stage of developing for me as CSS HTML etc etc is simple enough for me. Thanks Johnno. Link to comment Share on other sites More sharing options...
Dup Posted September 15, 2005 Author Share Posted September 15, 2005 Doubleh Postage... Thanks a million Johnno, I'll post the final product when its all styled and working correctly. I just went and borked phpMyAdmin, I changed the wrong password. Anywho, not using it for anything else so I can just reinstall it! By the way, the SQL query didn't work. Had to create the table manually. What is it with it creating the collation as swedish? Link to comment Share on other sites More sharing options...
tehhunter Posted September 16, 2005 Share Posted September 16, 2005 Doubleh Postage... Thanks a million Johnno, I'll post the final product when its all styled and working correctly. I just went and borked phpMyAdmin, I changed the wrong password. Anywho, not using it for anything else so I can just reinstall it! By the way, the SQL query didn't work. Had to create the table manually. What is it with it creating the collation as swedish? It's usually much easier just to create tables with phpMyAdmin or something or other. Link to comment Share on other sites More sharing options...
Dup Posted September 19, 2005 Author Share Posted September 19, 2005 Is there any way of writing an edit and delete function to this script? Easy? Hard? I really cannot grasp this at all... I have lost the ability to read something and for it to soak in. Link to comment Share on other sites More sharing options...
Dup Posted October 24, 2005 Author Share Posted October 24, 2005 pretty please? Link to comment Share on other sites More sharing options...
Mercie Posted October 25, 2005 Share Posted October 25, 2005 I'll take a look. If I don't edit, it means I failed miserably and cannot do such a task. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now