MySQL for a Noob
Posted: Tue Sep 04, 2007 6:17 pm
Hello, I run the site http://www.mathcelebrity.com as well as a baseball site that will go live at the end of the year. The question I have will cover both sites. I'm fairly new to PHP/MySQL and after a few weeks, I was able to query the database based on my search item hard coated into my search, and not from a search box return value. I can attach the code here, but I was wondering about the following which I'm unable to accomplish:
I have a database called baseball. The table name is batting. The table looks like this
Name PlayerID Average OBP SLG
Mike Clark clarkm01 .250 .333 .350
Paul Jones jonesp01 .285 .350 .412
Brandon Jones jonesb01 .302 .352 .385
Jim Farnsworth farnsj01 .320 .425 .350
Rick Peters petersr01 .360 .375 .420
I need a double search done in php to connect to this MySQL table. The first search takes an input box where a person would enter a name or part of a name, say Jones. I want them to find anything like Jones. I believe the code is %Jones%. That input will run a query against the above table to return any name like Jones. The trick here is I want it to return the Jones entries in a row by row format, as a link, which displays the full name, but is really an identity for the PlayerID. This first query results return on a page called namesearch.php. Now, when I click that identity link mentioned before, I want a 2nd query ran against the same database which is now searching by PlayerID, but returns the 3 columns, Average, OBP, and SLG in a html table on another page called battingresult.php.
Let me know if you want me to attach my code. Thank you for your help!
I have a database called baseball. The table name is batting. The table looks like this
Name PlayerID Average OBP SLG
Mike Clark clarkm01 .250 .333 .350
Paul Jones jonesp01 .285 .350 .412
Brandon Jones jonesb01 .302 .352 .385
Jim Farnsworth farnsj01 .320 .425 .350
Rick Peters petersr01 .360 .375 .420
I need a double search done in php to connect to this MySQL table. The first search takes an input box where a person would enter a name or part of a name, say Jones. I want them to find anything like Jones. I believe the code is %Jones%. That input will run a query against the above table to return any name like Jones. The trick here is I want it to return the Jones entries in a row by row format, as a link, which displays the full name, but is really an identity for the PlayerID. This first query results return on a page called namesearch.php. Now, when I click that identity link mentioned before, I want a 2nd query ran against the same database which is now searching by PlayerID, but returns the 3 columns, Average, OBP, and SLG in a html table on another page called battingresult.php.
Let me know if you want me to attach my code. Thank you for your help!