Form data problem/question

  • Travis Coats
  • Graduate
  • Graduate
  • No Avatar
  • Joined: May 27, 2007
  • Posts: 107
  • Status: Offline

Post September 22nd, 2008, 7:51 pm

I implemented a search query on my database that would list all songs of a certain primary and secondary genre for visitor to easily find something they would like to listen to. However, I have noticed that one of my genres doesn't do anything when you try to search for it. I have negated the problem of spelling errors, by implementing a drop down menu on my insert record admin page to insert the genre text data. Now I am just stuck with the remaining bewilderment. :)

Top of the page - try Light Instrumental (you can see clearly in my top 5 latest version below it, that there is a genre match...)
Working Demo

Any thoughts?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post September 22nd, 2008, 7:51 pm

  • Travis Coats
  • Graduate
  • Graduate
  • No Avatar
  • Joined: May 27, 2007
  • Posts: 107
  • Status: Offline

Post September 24th, 2008, 6:15 am

No thoughts on this one?
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post September 25th, 2008, 2:13 am

maybe the name is too long have you tried changing it to "Light Instr." instead ... ?
Let's leave all our *plum* where it is and go live in the jungle ...
  • Travis Coats
  • Graduate
  • Graduate
  • No Avatar
  • Joined: May 27, 2007
  • Posts: 107
  • Status: Offline

Post September 25th, 2008, 5:54 am

I thought of that one too. I thought maybe using the GET with its character limitations might have been the issue. It was "minimalistic Instrumental" then I changed it to "Light Instrumental," this morning I tried your suggestion and it still won't pass the results to the page. Sort of confusing. My queries are Dreamweaver created and it is filtering the genre column in my table by the URL parameter passed from the drop down value on submit. Everyone of the options seem to be going good, but this one just doesn't want to show its face. :)
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post September 25th, 2008, 6:10 am

have you tried running the query inside phpMyAdmin or MySqlQueryBrowser to see what it returns?
Let's leave all our *plum* where it is and go live in the jungle ...
  • Travis Coats
  • Graduate
  • Graduate
  • No Avatar
  • Joined: May 27, 2007
  • Posts: 107
  • Status: Offline

Post September 25th, 2008, 7:24 am

I tried running the same query script that dreamweaver genrerated in my phpMyAdmin Process window with resulting error messages. I am sure this is because I am structuring the SQL statement incorrectly and not accouting for variables that the PHP/URL form action is passing. Here is what I have for my query in dreamweaver.
Code: [ Select ]
SELECT title, album, genre, secondgenre, created FROM maincatalog WHERE genre = colname ORDER BY created DESC


of course genre is the actual table column, whereas colname is a variable from my form results. How would I structure this, if you need any other info I can try my best to get it. I am just one of those guys who learns enough to get by - getting by in this case is slowly making the site better.

Thanks for your help
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post September 25th, 2008, 7:35 am

that seems right ... but when you run that query remember that colname will need to be in quotation marks ('), so it'd be something like this ...
Code: [ Select ]
"SELECT album,genre,secondgenre,created FROM maincatalog WHERE genre='" . $colname . "' OR secondgenre='" . $colname . "' ORDER BY created DESC";

so try doing this in phpMyAdmin and see what happens:
Code: [ Select ]
SELECT album,genre,secondgenre,created FROM maincatalog WHERE genre='Light Instrumental' OR secondgenre='Light Instrumental' ORDER BY created DESC
Let's leave all our *plum* where it is and go live in the jungle ...
  • Travis Coats
  • Graduate
  • Graduate
  • No Avatar
  • Joined: May 27, 2007
  • Posts: 107
  • Status: Offline

Post September 25th, 2008, 12:55 pm

Worked like a charm. Too bad it doesn't on the site. Although everything else is coming out just fine. It's only this one value... maybe it's some tiny Dreamweaver thing I am overlooking.
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post September 25th, 2008, 12:57 pm

wow ... this is truly strange ... what does the code look like on that search page? or at least that part that reads the data out of the DB and onto the page ...
Let's leave all our *plum* where it is and go live in the jungle ...
  • Travis Coats
  • Graduate
  • Graduate
  • No Avatar
  • Joined: May 27, 2007
  • Posts: 107
  • Status: Offline

Post September 25th, 2008, 5:04 pm

The Dreamweaver generated PHP portion dealing with this query:

Code: [ Select ]
$colname_catalogSearch = "-1";
if (isset($_GET['genreSearch'])) {
$colname_catalogSearch = $_GET['genreSearch'];
}
mysql_select_db($database_catalog, $catalog);
$query_catalogSearch = sprintf("SELECT title, album, genre, secondgenre, created FROM maincatalog WHERE genre = %s ORDER BY created DESC", GetSQLValueString($colname_catalogSearch, "text"));
$catalogSearch = mysql_query($query_catalogSearch, $catalog) or die(mysql_error());
$row_catalogSearch = mysql_fetch_assoc($catalogSearch);
$totalRows_catalogSearch = mysql_num_rows($catalogSearch);
  1. $colname_catalogSearch = "-1";
  2. if (isset($_GET['genreSearch'])) {
  3. $colname_catalogSearch = $_GET['genreSearch'];
  4. }
  5. mysql_select_db($database_catalog, $catalog);
  6. $query_catalogSearch = sprintf("SELECT title, album, genre, secondgenre, created FROM maincatalog WHERE genre = %s ORDER BY created DESC", GetSQLValueString($colname_catalogSearch, "text"));
  7. $catalogSearch = mysql_query($query_catalogSearch, $catalog) or die(mysql_error());
  8. $row_catalogSearch = mysql_fetch_assoc($catalogSearch);
  9. $totalRows_catalogSearch = mysql_num_rows($catalogSearch);

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: roelof and 147 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.