| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Account Closed Join Date: Apr 2006 Location: England, UK
Posts: 494
![]() ![]() ![]() | Can anyone help me please? :] Hi, I was wondering if somebody would be able to help me. I want to have a page on my website where i can see all layouts that have been submitted to my database that have a status set as inactive. I know how to output those but i just need a tick box or button/link to delete a layout row from the database (if i dont want to add it to my website) and a tick box or button/link to change the status from inactive to active (if i want to add it to my website). Thanks in advance! UPDATE!!!! Okay, i've done the delete row and edit status links but i've realised it's crap LOL. Each time i add a row to my database it automatically adds an id, which is a number going up in order. Im upto 330 layouts now, i just added a test layout with an id of 331 and deleted with the function i just created (that i asked for help with above) so it deletes the row but then when i add another row it adds an id of 332, but i'd like it to use 331 again (if the row doesn't exist for the id) - anyone know what i could do here?
Last edited by Fun4Free.co.uk; 12-18-2006 at 03:22 PM.
|
| |
| | #2 (permalink) |
| NamePros Member Join Date: May 2006
Posts: 160
![]() | It's not a great idea to start reusing IDs... it kind of defeats to purpose and I don't know of any easy way to do it other than to grab all of the IDs and iterate through them until you possibly find an unused one. But again: don't do it |
| |
| | #3 (permalink) | ||||
| NamePros Member Join Date: Nov 2006
Posts: 57
![]() |
EDIT: On a better note; i'll explain it a bit more, my post above sounds a little odd ![]() You would need to do the following steps: 1) Turn off "auto_increment" for "id" 2) Rebuild the database Then when you isert a row, you would need to do the following: PHP Code: Hope this helps ![]() - Richard Anderson
Last edited by Cybo; 12-19-2006 at 03:06 AM.
| ||||
| |
| | #4 (permalink) |
| NamePros Regular Join Date: May 2005 Location: England
Posts: 392
![]() ![]() ![]() | Although considering all the code needed to do that, you might be better off just letting it auto-increment. And then sort out the numbers in your site's interface... Why do you need to get the id's in order so much?
__________________ -Beaver6813.com - Web Developer Extraordinaire! |
| |
| | THREAD STARTER #5 (permalink) |
| Account Closed Join Date: Apr 2006 Location: England, UK
Posts: 494
![]() ![]() ![]() | Thanks alot cybo ![]() Im just fussy, i guess i don't really need it lol. Hmm i think i will leave it then instead of making more work for myself when it's not needed =P. I have another question if any of you are up for helping me? this question is about my new website BangVideoBang and i want to add tags for videos i put up on the site now, view this video for example: ????: NamePros.com http://www.namepros.com/showthread.php?t=270705 http://www.bangvideobang.com/videos/...e-session.html I have added some tags for it, is there anyway that i could make each tag goto something like this: http://www.bangvideobang.com/videos/tags.php?tag=bmx http://www.bangvideobang.com/videos/...tag=dave+mirra http://www.bangvideobang.com/videos/...?tag=back+flip http://www.bangvideobang.com/videos/...?tag=warehouse (i haven't added tags.php yet so the links above won't work) Those are the tags i have added for that video, i want it so a visitor can click any of the tags and then it will go off and get all the videos with that tag in it. Anyone know how i could do this? Im new with php and mysql so i don't know much. Thanks alot. |
| |
| | THREAD STARTER #7 (permalink) |
| Account Closed Join Date: Apr 2006 Location: England, UK
Posts: 494
![]() ![]() ![]() | Yeh they are. what do you mean the layout of the database? (sorry lol) Is it the structure? Click Here: http://img246.imageshack.us/img246/884/structurepe0.png I bet it's all wrong heh lol. I use name for the tags. Gotta sort those field names out at some point. |
| |
| | THREAD STARTER #9 (permalink) |
| Account Closed Join Date: Apr 2006 Location: England, UK
Posts: 494
![]() ![]() ![]() | I put the tags in the 'name' row. I have them with a comma and then a space. should i just do a comma and no space or is that okay? Like this: live bands, hanging, cute, music, warped tour |
| |
| | #10 (permalink) | ||||
| NamePros Member Join Date: Nov 2006
Posts: 57
![]() |
![]() I wont do the html, but I will put where you need to put it Give me a little while | ||||
| |
| | #12 (permalink) |
| NamePros Member Join Date: Nov 2006
Posts: 57
![]() | tags.php PHP Code: Again, hope it helps |
| |
| | THREAD STARTER #13 (permalink) |
| Account Closed Join Date: Apr 2006 Location: England, UK
Posts: 494
![]() ![]() ![]() | Thanks for your help cybo but i didn't explain what i needed properly =P I know how to do the tags.php page to output the video listings for the selected tags. I just don't know how to change the actual tags on the video pages into links, so that a visitor can click on the tag which goes to tags.php?tag=blah. I add the tags to the database as 'tag, tag tag, taggy, tagoo' etc lol. I could add them as links directly into the database but i was just wondering if there is a small php code that would make all the tags that are outputted display as links instead of just text as you see on: http://www.bangvideobang.com/videos/...out-the-e.html under video information. Thanks alot though mate, reallly appreciate it ![]() UPDATE!!! I've added the tag links now, have a look: http://www.bangvideobang.com/videos/...out-the-e.html |
| |