PHP - Refining...:)
Well with help from this community I have my NFL score board working!! First off HUGE Thanks to the willingness of you guys to help all of us!! Many of us are here to learn [I hope no one is here just to scrap code ..]... I like learning this stuff.. it's really interesting!!
Ok now that it's working I'd like to throw some ideas out there and see what you guys think... Currently this is what I have... <?php $url="http://www.nfl.com/l...stseason/ss.xml"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); // get the url contents $data = curl_exec($ch); // execute curl request curl_close($ch); $xml = simplexml_load_string($data); echo " "; echo " Similar TutorialsHi!
I'm fairly new to PHP & MySQL (from a programmer's perspective) and have just started seriously building my own applications using PHP. I need some help bridging the gap with this MySQL query I have created that is to find only the organizations that have names that start with the letter 'A'. The initial query that I have written does work. However, I need to refine the query to "skip" over the first word -- example "The" so that I can get the complete correct results.
Here is my code:
include_once("dbconnect.php"); $linkA = "SELECT church_org FROM ics_data WHERE church_org LIKE 'A%' ORDER BY church_org ASC"; $queryA = mysql_query($linkA); $dataA = array(); while ($row = mysql_fetch_array($queryA) ) array_push ($dataA, array('church_org' => $row[0])); echo json_encode(array("dataA" => $dataA));This fetches every organization that starts with the letter 'A'. However, some organizations have St. or The in front of their names. So the query doesn't pick those up because it doesn't match what I have specified. I have tried the following: $linkA = "SELECT church_org FROM ics_data WHERE church_org LIKE 'A%' & TRIM('St. ', 'St ' church_org) ORDER BY church_org ASC";This doesn't do what I wanted it to do and after further research, I believe it is because TRIM only trims the words specified from the end-result string. I *think* I need to use REGEX to define a better pattern for the query but am still a little confused after reading the documentation on how to go about building that out. How would I accomplish this? I appreciate any help or guidance! Hopefully, I have posted this in the right forum. |