Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Star/Unstar a user.

  1. #1
    Member craigfarrall's Avatar
    Join Date
    Dec 2008
    Posts
    75

    Default Star/Unstar a user. 4 Mar 2009 @ 11.52

    Hi,

    I have a little contact manager I am creating, and I have a function which I would like to set up.

    Ok, so we have listed the number of customers, and I would like to be able star them, by clicking the icon, which then makes them available to a new list of just starred customers, which can later be unstarred.

    Whats the best way to go about this?

    I was thinking about adding a field to the users database, something like visible, and have either a 0 or 1 which will trigger 0 to be unstarred and 1 to be starred, would this be the best way to go about it?

    If so, anyone know a tutorial of how to do this?

    Thanks for your help
      Reply With Quote

  2. #2
    Member bonnit's Avatar
    Join Date
    Jan 2009
    Posts
    163
    Blog Entries
    4

    Default 4 Mar 2009 @ 12.46

    im new to php and mysql, but couldnt you just add a 'new' column which a 1 for each record you want to identify as new customer(or whatever the star is for) and then when you are displaying use:

    Code:
     SELECT * FROM table_name WHERE new_customer='1'
    to display only the results you want to display from the 'new' column? if your inserting into another table to be displayed or whatever use INSERT INTO and then the select statement

    but like i said im new to this so i may be wrong

    MySQL :: MySQL 5.0 Reference Manual :: 12.2.8 SELECT Syntax
      Reply With Quote

  3. #3
    Member craigfarrall's Avatar
    Join Date
    Dec 2008
    Posts
    75

    Default 4 Mar 2009 @ 12.55

    This sounds like a good place to start, this is exactly what I needed, I myself am new at this, so trying to teach myself, but I knew this would be nice and simple to do, its just getting your head around what needs doing.
      Reply With Quote

  4. #4
    Member bonnit's Avatar
    Join Date
    Jan 2009
    Posts
    163
    Blog Entries
    4

    Default 4 Mar 2009 @ 13.01

    amen to that lol
      Reply With Quote

  5. #5
    Member craigfarrall's Avatar
    Join Date
    Dec 2008
    Posts
    75

    Default 4 Mar 2009 @ 13.02

    This works beautifully thanks for that help, was nice and easy
      Reply With Quote

  6. #6
    Member craigfarrall's Avatar
    Join Date
    Dec 2008
    Posts
    75

    Default 4 Mar 2009 @ 13.12

    Ok, this script works fine for listing all the starred customers, but how can I now, make them star myself, so once they click on the star icon it then adds to the db as 1, and if unclicked changes it to 0.

    I am guessing this will need an if statement, but how would I go about this next?
      Reply With Quote

  7. #7
    Member bonnit's Avatar
    Join Date
    Jan 2009
    Posts
    163
    Blog Entries
    4

    Default 4 Mar 2009 @ 13.27

    have a checkbox/radiobutton in your form, and the insert the data into your database as you would with the rest, so if selected it returns the value '1', and get it to POST this along with the rest of your data
      Reply With Quote

  8. #8
    Member craigfarrall's Avatar
    Join Date
    Dec 2008
    Posts
    75

    Default 4 Mar 2009 @ 13.47

    What about unclicking it? because it is actually not a form I will be using it in, I will be using it from when my results are all shown, and I want to be able to click the image, and it does it for me, instead of a radio buttom and a submit button.

    Any ideas?
      Reply With Quote

  9. #9
    Member bonnit's Avatar
    Join Date
    Jan 2009
    Posts
    163
    Blog Entries
    4

    Default 5 Mar 2009 @ 18.44

    i really dont know but i would presume the radio button would be an easier option as far as i can see, sorry
      Reply With Quote

  10. #10
    Trusted Guru Jack Franklin's Avatar
    Join Date
    Dec 2008
    Posts
    409
    Blog Entries
    4

    Default 5 Mar 2009 @ 20.03

    Hey craig, I might do a bit of a jQuery/PHP tutorial on this for learnitscreencasts, sounds like a challenge!
    Site: jackfranklin.co.uk Blog: ispeakwebstuff.co.uk Project: learnitscreencasts.co.uk
    I'm available for 1 to 1 lessons on HTML/CSS/PHP/Javascript/jQuery/Photoshop/Fireworks so please PM Me!
      Reply With Quote

Page 1 of 2 12 LastLast

Similar Threads

  1. php With User Interface
    By Xarzu in forum PHP, ASP & Java
    Replies: 2
    Last Post: 7 Feb 2011, @ 07.28
  2. New Star Trek is really great
    By 41ex in forum Coffee House
    Replies: 7
    Last Post: 18 May 2009, @ 16.51
  3. star trek scene
    By saltedm8 in forum Imagery, Graphics & Typography
    Replies: 7
    Last Post: 18 Apr 2009, @ 10.10

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •