Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Everything posted by DeanWhitehouse

  1. thanks, didn't know they had to be like that.
  2. change $row = mysql_fetch_array($sql); to $row = mysql_fetch_assoc($sql);
  3. i have created this function <?php function bbcode($code) { $str = preg_replace("/\[center\](.*?)\[\/center\]/","<center>\\1</center>",$code); $str = preg_replace("/\[b\](.*?)\[\/b\]/","<b>\\1</b>",$code); $str = preg_replace("/\<center\>(.*?)\<\/center\>/","<center>\\1</center>",$code); echo $str; } bbcode(" [center]1[/center] "); echo "2"; ?> But all this does is echo the string , in this case [center]1[/center] but it should echo out 1 centered. like below , any one have any ideas, is my function wrong? 1
  4. Is this how i call from a function? <?php function bbcode(code) { $str = preg_replace("/\[center\](.*?)\[\/center\]/","<center>\\1</center>",$str); $str = preg_replace("/\[b\](.*?)\[\/b\]/","<b>\\1</b>",$str); $str = preg_replace("/\<center\>(.*?)\<\/center\>/","<center>\\1</center>",$str); } echo bbcode([b]cake[/b]) ?>
  5. ok, last problem, i want to use this on lots of pages , from a forum, to members profiles. how would i do this without writing it on every page , i was think something like function bbcode(code) { $str = preg_replace("/\[center\](.*?)\[\/center\]/","<center>\\1</center>",code); $str = preg_replace("/\[b\](.*?)\[\/b\]/","<b>\\1</b>",code); } then to call, i would do bbcode(cake); ?? is that correct
  6. forum, bbcode , i am planning on limiting what html they can use, to <center>,<b> etc. but i don't know how to search the string for it , strbck is the closet function i have seen
  7. ok, thanks for that , now how can i search to see if the string contains any html code. e.g <center> ? or do i not nead to , i want it so that if they enter <center> or [center ] it centers the text
  8. can someone show me the basic preg-replace for bbcode. so when they enter <center> or it centers the text. Thanks, Blade
  9. use something like this <?php $date = date('Y-m-d', strtotime("-6 days")); if($HeaderDate == $date) { echo "Time to change"; } ?>
  10. this should be in the freelance section.
  11. all the gets should be $_GET['page']
  12. it should be this action="<?php $_SERVER['PHP_SELF']?>">
  13. not sure if this will work, but put at the top error_reporting(0); or it might be error_report(0);
  14. Don't forget Tizag.com
  15. ok, well i just want to do username search, and the db has a row called Username a standard query would be SELECT * FROM users WHERE Username = 'bob'
  16. I don't know where to start and i like this forum more than google, but as far as i know / have read , i need to query the db but not like normal, using different terms, what are they? Thanks, Your Friendly neighbour hood Blade
  17. ahh ok, soz, yer you would have <iframe all the code src= " <?php $dbh=mysql_connect ("hostname", "username", "password") or die('Cannot connect to the database because: ' . mysql_error()); mysql_select_db ("databasename"); $id = $_GET['member_id']; if($id == 1) { echo "clients/client1.php"; } if($id == 2) { echo "clients/client2.php"; } if($id == 3) { echo "clients/client3.php"; } if($id == 4) { echo "clients/client4.php"; } ?> "></iframe>
  18. yes, have an if statement in the iframe, where u set the url, and change the url based on the id number e.g. if($idnumber == 1) { echo "link to page"; }
  19. why have u got the post, surely then the if statement cant be run , the statement should be in the main bit of code.
  20. so first off, you want the code to count how many days until the header needs to be changed and then after this amount of days you want to display the text("You must now add a new Header")? Can u please paste the code with the header in aswell.
×
×
  • 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.