Jump to content

magga

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

magga's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a page that lists galleries that it gets from the database, currently they are all listed on one page. As time has gone on, there are more and more galleries so ideally I want to be able to split this up to say 10 galleries per page and then have a link to see the next page etc... e.g. page [1] [2] Pretty much like the forum works in that when there are so many replies to a post you would click [2] to see the next page of posts. Question is how can I go about doing this in the mysql_query ? I'm thinking some way of using LIMIT on the result or something ?
  2. Thanks, I know this too, it's just implementing it... That won't give you the full link if you're using variables e.g.... galleries.php?gallery=test&picid=12345 You'd just get galleries.php back which effectively wouldn't take the user back to where they came from. Besides this, if you use this to redirect after submitting the form, it's either going to take the user back to the page where they entered their login details or the same page again if the form submits to itself. That's why I'm thinking there must be another way to do this.
  3. Yes I realise that, I'm already using that, but it needs to know what mypage.php is from the page it's been directed from.
  4. Hi, A have a few pages on my site that require the user to be logged in to view, it checks for a cookie, if there isn't one it directs them to the login page. Now once they have logged in and everything is ok, I want it to direct them to the original page that they tried to view before being directed to the login page. Whats the easiest/best way to do this ? Thanks
  5. Thanks a lot, that works now. Can I just ask one thing, does this: [code]WHERE id IN ({$notification_ids})[/code] Just mean WHERE the id's inside the array ?
  6. Can you expand on creating the notification_id[] field ? Do you mean in the form or somewhere else ?
  7. In the mail() part you have $to,$subject and then '' which would be the body. You need to put some content in there or a variable which you then need to specify elsewhere in the page.
  8. Hi I have a page which lists rows from a database. I then have a form where you can select certain rows and delete them. What I want to do is enable users to delete multiple rows from one form which currently it is not doing. These are the bits of code that might be useful in helping me: [code] $notification_id = $_POST['notification_id']; mysql_query("DELETE from notifications where id='$notification_id'");[/code] And from the form: [code]<input type="checkbox" name="notification_id" value="<? echo $row['id'] ?>">[/code] (the $id in this comes from another query and does work) It is currently working but you can only delete one row at once obviously because the $notification_id is only holding one value on the post. Do I need to put the values into an array then run the delete query for each value ? If so, how do I go about this ? Thanks in advance.
  9. Ok I thought it was working..... If you click next it goes to the next available image as expected but if you click previous, it goes back to the first image of the gallery ! Obviously cos its reading the table from the start and the first record it finds, the id is smaller than the current one so thats the one you get to
  10. No, its ok. Thats not really what I'm trying to do take a look at this page and click on one of the pictures: [url=http://www.magga-james.co.uk/galleries.php?gallery=nye06]www.magga-james.co.uk/galleries.php?gallery=nye06[/url] The next and previous buttons add + or - to the 'id' which make it display the next/previous picture. Now if there is an id missing for example, the next or previous button disappears. I need to be able for it to carry on adding to the id until it find the next row that matches the query. I have got this far but then, when it gets to the last picture in the gallery, it keeps searching and searching and searching in an endless loop. Is there anyway of killing a while statement when it reaches the end of the table ?
  11. I'm not sure what you mean about $page 1.... all the images for a gallery should be on the same page.
  12. Which way would you go about it ? If it helps, you can see it in action here: [url=http://www.magga-james.co.uk/galleries.php?gallery=nye06]www.magga-james.co.uk/galleries.php?gallery=nye06[/url]
  13. Hi I currently have a query which pulls out picture information from a database. Underneath is a previous and next button which adds 1/takes away 1 from the 'id' which is the auto_increment column of the database. The problem is, if for some reason there is an 'id' missing (for example if a picture is removed) then the previous/next button disappears. I know why it does this, I just can't work out how to write the code correctly so it will then carry on and search for the next id in that gallery. I do want the previous/next buttons to disappear however when there IS no previous or next picture. Hope you can understand what im saying here... here is the code: [code]<? $previd=$id-'1'; $tempres=mysql_query("SELECT *FROM galleries WHERE gallery='$gallery' AND type='picture' AND id='$previd'"); if($values=mysql_fetch_array($tempres)) echo "<a href='?gallery=$gallery&type=picture&id=".$previd."'><img src='images/previous.gif' border='0'></a>";?>   <a href="http://www.magga-james.co.uk/galleries.php?gallery=<?=$gallery; ?>#pictures"><img src='images/thumbs.gif' border='0'>         <?  $nextid=$id+'1'; $tempres=mysql_query("SELECT *FROM galleries WHERE gallery='$gallery' AND type='picture' AND id='$nextid'"); if($values=mysql_fetch_array($tempres)) echo "<a href='?gallery=$gallery&type=picture&id=".$nextid."'><img src='images/next.gif' border='0'></a>";?>[/code] I did make a while loop so it kept adding +1 to the id until it found the next record but obviously when it did get to the last record, it kept searching and searching for a record that never existed so that's obviously not the solution. Any help would be appreciated. Thanks in advance.
×
×
  • 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.