-
Posts
2,527 -
Joined
-
Last visited
Everything posted by DeanWhitehouse
-
thanks, didn't know they had to be like that.
-
change $row = mysql_fetch_array($sql); to $row = mysql_fetch_assoc($sql);
-
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
-
[SOLVED] Basic preg-replace for bbcode
DeanWhitehouse replied to DeanWhitehouse's topic in Regex Help
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]) ?> -
[SOLVED] Basic preg-replace for bbcode
DeanWhitehouse replied to DeanWhitehouse's topic in Regex Help
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 -
[SOLVED] Basic preg-replace for bbcode
DeanWhitehouse replied to DeanWhitehouse's topic in Regex Help
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 -
[SOLVED] Basic preg-replace for bbcode
DeanWhitehouse replied to DeanWhitehouse's topic in Regex Help
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 -
can someone show me the basic preg-replace for bbcode. so when they enter <center> or it centers the text. Thanks, Blade
-
[SOLVED] Test if function already declared?
DeanWhitehouse replied to sandozlabz's topic in PHP Coding Help
can u not do if(!isset(Function)) { declare } -
use something like this <?php $date = date('Y-m-d', strtotime("-6 days")); if($HeaderDate == $date) { echo "Time to change"; } ?>
-
this should be in the freelance section.
-
all the gets should be $_GET['page']
-
it should be this action="<?php $_SERVER['PHP_SELF']?>">
-
dont echo it,
-
not sure if this will work, but put at the top error_reporting(0); or it might be error_report(0);
-
Don't forget Tizag.com
-
yes, or cookies
-
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'
-
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
-
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>
-
where is the iframe code?
-
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"; }
-
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.