Form data problem/question

  • Travis Coats
  • Graduate
  • Graduate
  • Travis Coats
  • Posts: 107

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Travis Coats
  • Graduate
  • Graduate
  • Travis Coats
  • Posts: 107

Post 3+ Months Ago

No thoughts on this one?
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

maybe the name is too long have you tried changing it to "Light Instr." instead ... ?
  • Travis Coats
  • Graduate
  • Graduate
  • Travis Coats
  • Posts: 107

Post 3+ Months Ago

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
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

have you tried running the query inside phpMyAdmin or MySqlQueryBrowser to see what it returns?
  • Travis Coats
  • Graduate
  • Graduate
  • Travis Coats
  • Posts: 107

Post 3+ Months Ago

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
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

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
  • Travis Coats
  • Graduate
  • Graduate
  • Travis Coats
  • Posts: 107

Post 3+ Months Ago

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
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

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 ...
  • Travis Coats
  • Graduate
  • Graduate
  • Travis Coats
  • Posts: 107

Post 3+ Months Ago

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: No registered users and 43 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.