Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. Not sure what that is, RussellReal. It doesn't even output anything, maybe you're misreading what he wants? Try: <?php $str = 'loremipsum'; $split = str_split($str); foreach($split as $key => &$letter) if(!($key % 2)) $letter = strtoupper($letter); echo implode($split); Or <?php $str = 'loremipsum'; for($i = 0;$i < strlen($str);$i++) if(!($i % 2)) $str{$i} = strtoupper($str{$i}); echo $str; Just having some fun
  2. By on the fly I assume you mean something like: <img src="thumb.php?image=something.jpg&width=100&height=100" alt="" /> ? If so, and you wanted to link them to the original image you could just do: <a href="something.jpg"><img src="thumb.php?image=something.jpg&width=100&height=100" alt="" /></a>
  3. Just remember to press the "topic solved" button in the bottom left (For now and future reference).
  4. Whoops, my apologies, I made a typo. Use this: $lyrics = wordwrap(stripslashes(nl2br(mysql_result($lyricsqry2, 0, lyrics))), 100, "<br />\n", true);
  5. That's exactly what my edit is meant to do, did you even try it?
  6. Try changing: $lyrics = wordwrap(stripslashes(mysql_result($lyricsqry2, 0, lyrics)), 100, "<br />\n", true); to $lyrics = wordwrap(stripslashes(nlb2(mysql_result($lyricsqry2, 0, lyrics))), 100, "<br />\n", true);
  7. Because it's a string no entered data would have a conflict with any reserved words.
  8. Unfortunately neither of those are what I'm looking for. I'll need the source of the PHP file (Not the source being outputted, the actual PHP file) of the file where lyrics are being displayed, not submitted.
  9. You're getting this because there is no index of action in the super-global $_GET. More specifically, there is no 'action' variable defined in your query string. file.php // Error file.php?action=something // No error Edit: Solution: Check to make sure it's set before assigning that value to $action" if(isset($_GET['action'])) { $action = secure($_GET['action']); }
  10. Essentially, yes. But I think he's asking more specifically exactly where in the code; I'm guessing he's not familiar with it.
  11. Change array_push($values,"`".$value."`"); to array_push($values,"'".$value."'"); String values should have either single or double quotations around them, not back-ticks. Edit: PFMaBiSmAd said it before me.
  12. How would I know? It's your site You'll need to put it where ever you're getting information back from the database and want to display the line breaks correctly. If you post the source of a page that you need this to be done on we can show you specifically where in the code.
  13. The problem is with your quotes on this line: $SQLstring = "INSERT INTO $TableName VALUES(NULL, "$Name", "$Email")"; Since you're using double quotes ( " ) for the string inside of it you'll either need to use single quotes ( ' ) or escape the double quotes. $SQLstring = "INSERT INTO $TableName VALUES(NULL, \"$Name\", \"$Email\")"; or $SQLstring = "INSERT INTO $TableName VALUES(NULL, '$Name', '$Email')";
  14. When retrieving the lyrics from the database preform nlbr2() on them. Essentially what this function does is replaces "\n" with html breaks (<br /> ).
  15. Try something like: Say you have this update query that will update 20,000 rows: mysql_query("UPDATE `table` SET row='value'"); You could do: mysql_query("UPDATE `table` SET row='value' ORDER BY id LIMIT 9999"); sleep(5); mysql_query("UPDATE `table` SET row='value' ORDER BY id LIMIT 10000, 10000");
  16. Why don't you break it up and add a sleep() for a few seconds somewhere in between the queries?
  17. You don't necessarily need regex for this. If the URL is always going to be in that format you could do this: $url = 'http://www.example.com/1-link-to-the-page.html'; echo implode('/', explode('/', $url, -1)) . '/';
  18. <?php $file = file_get_contents('http://www.phpfreaks.com/forums/index.php/topic,270900.0.html'); preg_match_all('~<img(.+?)src="(.+?)"~', $file, $matches); print_r($matches[2]); ?> That works, but to be honest it's probably not the best way, my regex is rusty.
  19. Your query is only selecting MAX(id), which won't help you if you're trying to display other information. You should let your query handle the ordering and limiting, you should do something like this: $getnews = mysql_query("SELECT * FROM posts ORDER by `id` DESC LIMIT 5"); if (!$getnews) { die('Could not connect: ' . mysql_error()); } while($row = mysql_fetch_assoc($getnews)) { echo "<table width=500> <tr><td bgcolor=#FFFFFF colspan=2> <b><center>{$row['title']}</b></center></td></tr> <tr><td colspan=2 bgcolor=222222> <div align=left><font color=#FFFFFF><b> {$row['name']}</b> posted this {$row['date']}</font></div> </td></tr> <tr><td valign=top align=left width=75><img src=images/seth.jpg><br></td><td align=left valign=top >"; echo nl2br($row['body']); echo "<BR><BR></td></tr></table>"; }
  20. Can you please post your full source? It's hard to figure out the full problem when I'm partially blind-sighted. This doesn't look right though: $myContractsArrayString= implode(',',$myContractsArray); $contractAdminArray=array(); //add any personal contracts to the new array before building up further. array_push ($contractAdminArray, $myContractsArrayString);
  21. Alex

    White Pages

    You'll have to show us your code.
  22. Oh, then it's clear why it isn't working.. in_array() checks all the elements of the array. You only have one element that contains a string.. You should explode the string in that element by ',' then check the array. Or use stripos() to check the string.
  23. Why not just use array_unshift()?
  24. Only thing that I can think of is maybe because they're off different data types, but even that shouldn't cause a problem. do this, right before the in_array() and post what it outputs: print_r($contractAdminArray);
×
×
  • 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.