Jump to content

aquatsr

Members
  • Posts

    220
  • Joined

  • Last visited

Posts posted by aquatsr

  1. another thing:isnt the LIKE clause case sensitive?So make two queries like that, and on the first one use the lowercasing function (not sure what that is) and the second us ucfirst().:)
    I don't need to. Each field that enters into the database automatically has the first letter of each string made into an uppercase, so I only need to select uppercase.(and actually, the query works whether a lowercase or uppercase letter is used, at least in my case)
  2. It gives an error:Could not query the database:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNIQUE genre FROM songs WHERE genre LIKE 'I%' ORDER BY genre ASC' at line 1(It's the same whether it's I or r or any letter, regardless of case.)

  3. It's not a good practice to include GET (or any other user form) variables directly in a query like that, you are leaving yourself open to attack. It would be better to use this:
    $sql = "SELECT * FROM songs WHERE title LIKE '" . mysql_real_escape_string($page) . "%' ORDER BY " . mysql_real_escape_string($sort);

    You're right. Thanks for pointing that out.
  4. I guess PHP doesn't like setting variables that have the same name as the querystring.
    Hmmm no... it's not that. I don't think the problem has been solved completely :) .
  5. OK so in my databast driven site I like to give the user a variety of choices in sorting by starting letter and catogory. The problem is that when I say, like "Sort by album starting with letter P I get:Phobia - Breaking BenjaminPhobia - Breaking BenjaminPhobia - Breaking BenjaminPhobia - Breaking BenjaminPhobia - Breaking BenjaminPhobia - Breaking BenjaminPhobia - Breaking BenjaminPhobia - Breaking BenjaminPhobia - Breaking BenjaminPhobia - Breaking BenjaminPhobia - Breaking BenjaminBasically it shows every entry that has that... which is good if I was showing the individual song titles - but I'm not. How can I show that my database has Phobia, but not have it show every entry?

  6. thanks so much for all your help, guys!any recommendations for content management systems? ultimately i'd like to build one, just so i'll understand exactly what's happening, but for my current project the smart thing is probably to get it up and running, rather than sitting on it another few weeks while i hack away at a new programming language...thanks again!jason
    PHP Nuke, maybe? It's pretty popular from my POV.
  7. As $page now hold the value found from the get statement you can put it straight into your $sql statement so you don't need to write a line for each letter of the alphabet. And you might as well stick the sort term in as well.$sql = "SELECT * FROM songs WHERE title LIKE '{$page}%' ORDER BY {$sort}";
    Interesting! Thanks a lot! That will save a lot of code-writing!
  8. You could try this:SELECT * FROM books WHERE title < 'A'This would give you titles starting with a number - but also blank entries as well.
    I'll try that, if it really does work it won't be a problem as I don't have any blank entries (yet).thx.
  9. I have a URL, sayhttp://mywebsite.com/thispage.php?page=a&sort=titleand in my php page I have<?php$page = $_GET['page'];$sort = $_GET['sort'];/*and I want to get all entries with titles starting with the letter A sorted by title, for now*/if ($page == 'a' && $sort =='title') {$sql = "SELECT * FROM songs WHERE title LIKE A%";}else if ($page == 'b' && $sort == 'title') {$sql = "SELECT * FROM songs WHERE title LIKE B%";}...else { /*whatever*/}?>Will this code work?

  10. thanks justsomeguy, that was extremely helpful :)aquatsr: I'm not using a forum in this particular case, I am merely trying to integrate a membership system from scratch into my current webpage design. it may sound like reinventing the wheel, but there is a reason for it. Both hotscripts and phpfreaks both have scripts that do membership systems, but they were all missing the "remember me?" part, not sure why, apparently alot of authors seem to think saving cookies is a bad thing (shrugs) there is a big difference between tracking cookies and session cookies.thanks justsomeguy :)
    I see. I was just offering a suggestion :)
  11. And to add to that, unless it is stated otherwise, all images, text (media in general) is automatically copyrighted by the author when created according to U.S. copyright laws.So when in doubt, ask for permission.

  12. hello,yesterday i was searching for a web site with images that i can use in my sitethe kind of pictures that make the site look goodis there is such site or i should google for my picturesneedless to say i want a free one :)
    The sites below contain non-copyright photos which you may use freely.www.freestockphotos.com, www.geekphilosopher.com, www.bigfoto.com, www.firstgov.gov, www.sxc.hu/index.phtml.And in general, you can use pictures from Google as long as you ask permission and give credit for the picture where due.
×
×
  • Create New...