Jump to content

esiason14

Members
  • Posts

    58
  • Joined

  • Last visited

    Never

Everything posted by esiason14

  1. Here is the html I'm trying to match: <a href="/mlb/players/playerpage/7652">Tom Gordon</a></td><td width="5%" align="center">RP</td><td width="15%" align="left">Elbow</td><td width="45%" align="left">15-day DL. Out until at least late June</td></tr><tr class="bg2" valign="middle" align="right" height="17"><td width="15%" align="center">04/18/09</td><td width="20%" align="left"><a href="/mlb/players/playerpage/580789">Stephen Drew</a></td><td width="5%" align="center">SS</td><td width="15%" align="left">Hamstring</td><td width="45%" align="left">Questionable for April 19 at San Francisco</td></tr> "The Regex Coach" says this should work, but in practice it doesn't....Is it the % sign? <a href="\/mlb\/players\/playerpage\/([A-Za-z0-9-]+)">(.*?)<\/a><\/td><td width="5%" align="center">(.*?)<\/td><td width="15%" align="left">(.*?)<\/td><td width="45%" align="left">(.*?)<\/td><\/tr>
  2. Hi, Is there a way to simplify this query? SELECT * FROM mlbplayers p, mlbhstats hs, mlbteams t, mlbpositions pos, mlbplayer_positions ppos WHERE ppos.position_id=6 AND p.player_id=hs. player _id AND ppos. player =p. player _id AND hs.mlbteam_id=t.mlbteam_id AND hs.year = 2007 GROUP BY p.player_id ORDER by hs.hr DESC LIMIT 0,10;
  3. Thanks, frost110. A couple of tweaks to suit my needs..and it works like a charm...and I learned a lot from it. Thanks again!
  4. Ok, I gotcha...but I'm pretty sure you can understand my "stupid" question. My problem: I have some arrays that are formatted like this: Array ( [0] => 10811 [1] => 7527,7556 ) What I would like to do is explode the comma separated values (if they exist) My goal: and then add the exploded value as a new key in the array...like this: Array ( [0] => 10811 [1] => 7527 [2] => 7556 ) I've tried several variants of using explode, but I can't seem to work it out. Any help would be appreciated. Thanks for your consideration.
  5. I'm looking to explode the comma separated values in an array like this: Array ( [0] => 10811 [1] => 7527,7556 ) and then add the exploded value as a new key in the array...like this: Array ( [0] => 10811 [1] => 7527 [2] => 7556 )
  6. Thanks! That worked...much appreciated
  7. I have a series of variables that need to be compared against eachother. For example... $ab = 3; $bab = 4; $cab = 5; These will be displayed in a table...Whichever variable has the highest value will be highlighted. How can I compare these without using a gazillion if statements Thanks in advance
  8. This is killing me. I have a muli-tabbed form, each with multiple selects. If more than three selections are made across all the tabs...an alert/confirm shows. Clicking "Ok" clears the form and innerhtml (or should). It looks like it does, but if you click "Ok" and then click on another tab and select another player...the values reappear. Take a look to get a better look at what I'm talking about Select more than three players from multiple tabs. Click ok on the prompt (it looks like it resets) Now click on another tab and select a player ???
  9. I have several multiple select boxes on a page <div id='tabs0' style='position:absolute; top:0; left:0; visibility: visible; margin: 10px;'> <select multiple id=1 name=1 style='font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif; font-size: 11px; width: 350; height: 180' onChange='add_player(this, "1"); return true;' size=10> <?php $count = count($cbs_id); for($i=0;$i<$count;$i++) { if ($pos[$i] == "1") { { echo "<option value=".$cbs_id[$i].">".$lname[$i].", ".$fname[$i]."\n"; } } } ?> </select></div> I'm trying to figure out how I can pass multiple values if the user selects more than one. var c = document.getElementById('1').value; var fb = document.getElementById('2').value; var queryString = "?submit=true&1=" + c + "&2=" + fb; ajaxRequest.open("GET", "newmlbcompare2.php" + queryString, true); ajaxRequest.send(null); If there are multiple c and fb values...how can I pass all of those? Any help would be appreciated!!
  10. I'm parsing my pages to find all id's. What I want to do is: if the id already exists in my db then I want to update it...if not I want to insert a record. How can I go about doing that. Any help would be appreciated. Thanks!! foreach ($url as $value) { $base = "http://www.mypage.com/whatever"; $getit = "".$base."$value"; $input = file_get_contents("$getit"); preg_match_all('@<a href="/whatever/([A-Za-z0-9-]+)">(.*?), (.*?)</a>@', $input, $matches); for($i=0;$i<40;$i++) { $sql3 = "SELECT id from mlbplayers where id=".$matches[1][$i].""; while ($row3 = mysql_fetch_assoc($result3)) { $pid = $row3["id"]; } echo "$sql3<br />"; } }
  11. I have a table that has a whole bunch of <tr>. For each one below I want to match the bolded text. <tr class="bg2" align="right" height="17" valign="middle"><td align="left">DATE</td><td align="left"><a href="/whatever/MATCH THESE NUMBERS">text< /a></td><td align="left">text</td><td align="left">more text</td><td align="left">more text</td><td align="left">MATCH THIS TEXT</td></tr> the numbers to be matched will be like this 3424532 the matched text can have special characters Once the matches are found...I'm going to have to run an update query for each..ie. UPDATE table set text=MATCH THIS TEXT where id=MATCH THESE NUMBERS; any help with the regex would be appreciated. Thanks
  12. ...and I just wanted to add. I do know how to spell "query". It was a typo in the title :(
  13. I have two tables players  [code] `player_id` smallint(5) unsigned NOT NULL auto_increment,   `lname` varchar(50) default NULL,   `fname` varchar(50) default NULL,   `active` tinyint(1) unsigned default '1',   PRIMARY KEY  (`player_id`)[/code] AND rosterplayers [code]  `player_id` smallint(5) unsigned NOT NULL default '0',   `team_id` smallint(5) unsigned default '0',   PRIMARY KEY  (`player_id`)[/code] Each has a player_id field. What I want to do is retrieve a list of players that are NOT in the rosterplayers table. Make sense. I've tried several ways and it's just not working for me. Any help would be appreciated.
  14. Thanks, Nicklas. That's really, really close to what I'm looking for. The only problem I run into is if the string I'm trying to match has other <a href ....then it matches all of the links. I only want to match the ones with /nba/players/playerpage/...... Is there a way to narrow the regex match to only these?
  15. I've been trying to match this for quite a while...and with no luck. Can someone please help me out here. HTML to match (there's actually going to be about 10 players to match): [code]<tr  height=17  class=bg2 align=right valign=middle><td  align=middle>21</td><td  align=left><a href="/nba/players/playerpage/6552">Tim Duncan</a></td><td >6</td><td >6</td><td >21.5</td><td >49</td><td >91</td><td >53.8</td><td >31</td><td >57</td><td >54.4</td><td >0</td><td >1</td><td >0</td></tr><tr  height=17  class=bg2 align=right valign=middle><td  align=middle>20</td><td  align=left><a href="/nba/players/playerpage/139066">Manu Ginobili</a></td><td >6</td><td >6</td><td >13.0</td><td >25</td><td >64</td><td >39.1</td><td >20</td><td >25</td><td >80.0</td><td >8</td><td >24</td><td >33.3</td></tr>[/code] What I want to match is: /nba/players/playerpage/6552 (the href), Player Name (within the a tags), and then everything between the <td> </td> tags. So a complete match would look like this: [code]/nba/players/playerpage/6552, Tim Duncan, 6, 6, 21.5, 41, 91, 53.8, 31, 57, 54.4, 0, 1, 0[/code] Thanks to everyone in advance
  16. [quote author=hannah link=topic=111613.msg452379#msg452379 date=1160974680] Can this be done with PHP and mysql? [/quote] Yes it can
  17. Thanks for the help, guys!
  18. Sorry, [code]                  <td width="50%" class="playerbio">                     <b>Height/Weight: </b> 6-6/229<br>                     <b>Birthdate: </b> 04/22/1983<br>                     <b>Birthplace: </b> Fort Smith, AR, USA<br>                                       </td>                   <td width="50%" class="playerbio">                     <b>Team: </b> Jacksonville Jaguars<br>                     <b>College: </b> Arkansas<br>[/code] I want to match everything between the [code]</b> and <br> tags[/code]....6-6/229, 04/22/1983, Fort Smith, AR, USA, Arkansas
  19. I normally don't do this, but when it come to regular expressions...I am lost. I've look at the tutorials and have tried and tried, but I cant seem to get it. I'm trying to match a block of html like this: [code]                  <td width="50%" class="playerbio">                     <b>Height/Weight: </b> 6-6/229<br>                     <b>Birthdate: </b> 04/22/1983<br>                     <b>Birthplace: </b> Fort Smith, AR, USA<br>                                       </td>                   <td width="50%" class="playerbio">                     <b>Team: </b> Jacksonville Jaguars<br>                     <b>College: </b> Arkansas<br>[/code] anyone care to help. I will repay you with kind words  ;D
  20. Thanks, effigy. Everything is working great. You da man!
  21. Ok, I gotcha. I'm sorry to be a pain, but the text is different everytime. How would I match the text between the <span class="postbody"> and the first </ br> tag. I promise this is my last question on this. Thanks again
  22. I'm actually trying to match the text before AND the "read more" link.....not just the link. Currently, I can return only the "Read more" link with what you posted before.  The whole thing that I am trying to match looks like this. [code]In two preseason games, Carson Palmer (knee) went 13-of-20 for 173 yards and four touchdowns, leaving him with a gaudy passer rating of 131.9. Even though he's still working some out some kinks, he's good enough at this point to have the Bengals thinking of another title. &quot;We were fortunate to finish out the preseason undefeated,&quot; Palmer said. &quot;Hopefully this momentum will carry us through the first four games, into the bye, and on through the rest of the season.&quot; <br /> <br /> <a href="http://mydomain.com/players/playerpage/396173/rss" target="_blank" class="postlink">Read more...</a>[/code]
  23. This is what I have: [code]echo "<br><table align=\"center\" width=\"500\"><tr bgcolor=\"#000066\"><td style=\"font-family: Arial,Helvetica,sans-serif; font-weight: bold; font-size:12px; color:#ffffff; text-decoration:none; \">  $firstname $lastname in the news</td></tr>";   for($i=0;$i<$count;$i++)   { $bbcode = "[url=http://www.mydomain.com/phpBB2/viewtopic.php?t=".$topic_id[$i]."]Read more...[/url]"; $newurl = preg_replace('%\[url=([^]]+)\]([^[]+)\[/url\]%', '<a href="\1">\2</a>', $bbcode); echo "<tr><td><b><u>".$title[$i]."</u></b></td></tr><tr><td>".$newurl."</td></tr>"; } echo "</table>";[/code] For a post that looks like this, which I'm trying to match: [code]Colts QB Peyton Manning said he likes the team's decision to draft Joseph Addai to help replace Edgerrin James. "I'm biased toward Southeastern Conference players. I think he's been well battle-tested," Manning said. "He's going to be able to come in and help us. Dominic Rhodes will play as well, but everybody else is going to have to raise their level of play." Read more...[/code] ..returns this: [code]Manning likes addition of Addai (this is the title of the post) Read more...[/code]
  24. Hi effigy, Thanks for the response. That does work perfectly. One followup question though: What if there is a block of text prior to the url that I want to replace. how can I match that and show it along with the new, reformatted link. The block of text is always followed by a double line break [code]A whole bunch of text here. Blah blah. SDSdsdsad. [url=http://mydomain.com/nfl/players/playerpage/1234/rss]Read more...[/url][/code] and replace it with [code]A whole bunch of text here. Blah blah. SDSdsdsad. <a href="http://www.mydomain.com/whatever.php">Read more...</a>[/code] any help would be appreciated [/quote]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.