Unstoppable Domains

Can anyone help me please?

Spaceship Spaceship
Watch

Marty Rogers

Account Closed
Impact
3
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:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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 :)
 
0
•••
Fun4Free.co.uk said:
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?

The only way to do something like that is to use manual submition on the id's, not automatic. Which means defining an ID each time you insert a row.

EDIT:

On a better note; i'll explain it a bit more, my post above sounds a little odd :P

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:
$result = mysql_query ("SELECT * FROM table");
$total_rows = mysql_num_rows($result);
$counter1 = 0;
$freespaces = 0;
$last_id = 0;
$free = array();
while ($row = mysql_fetch_assoc($results))
{
      $counter1 += 1;
      if ($last_id != $counter1 - 1)
      {
            // We have found a free space
            $free[$freespaces] = $row['id'] - 1;
            $freespaces += 1;
      }
      $last_id = $row['id'];
}
// $free[0] is the id of the first free space
if ($freespaces == 0)
{
      // No free spaces? Move to the next in the list.
      $nextspace = $total_rows + 1;
}
else
{
      // A Free Space was found
      $nextspace = $free[0];
}

// Make the new ID = $nextspace


Hope this helps ;)

- Richard Anderson
 
Last edited:
0
•••
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?
 
0
•••
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:

http://www.bangvideobang.com/videos/dave-mirra-secret-warehouse-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/tags.php?tag=dave+mirra
http://www.bangvideobang.com/videos/tags.php?tag=back+flip
http://www.bangvideobang.com/videos/tags.php?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.
 
0
•••
Fun4Free,

Are these tags stored in your database? If they are would be be able to share the layout of the database and I will knock you up a script, the PHP anyway :P, your need to do the HTML.
 
0
•••
0
•••
:D Yeah, thats what I need. Which one are the tags stored in? And how are the tags stored? (EG; Are the separated with a space, ect?)
 
0
•••
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

:)
 
0
•••
Fun4Free.co.uk said:
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

:)

Nah, that's all fine. Let me knock something up for you and I will post again in this thread so you know i've posted it :D

I wont do the html, but I will put where you need to put it :P Give me a little while
 
0
•••
Thanks alot mate, im well happy lol :)
 
0
•••
tags.php

PHP:
<?php
// Connect to the database here.


if (!isset($_GET['tags']))
{
      // No tags sent... Change the below:
      header("Location: http://yoursite.com/index.php");
}
// Get the tags
$rawtagdata = $_GET['tags'];

// Explode the raw data
$tags = explode("+", $rawtagdata);

$sql = "SELECT * FROM thetable WHERE name LIKE '%" . $tags[0] . "%'";
$counter1 = 1;
$loop1done = false;

while ($loop1done = false)
{
      if (!isset($tags[$counter1]))
      {
            $loop1done = true;
      }
      else
      {
            $sql .= " OR name LIKE '%" . $tags[$counter1] . "%'";
            $counter1 += 1;
      }
}
$results = mysql_query($sql);

// Now just loop over the $results :D


Again, hope it helps :P
 
0
•••
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/taking-back-sunday-cute-without-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/taking-back-sunday-cute-without-the-e.html

:)
 
0
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back