View Full Version : Help please ;]
Posting here becuase no1 looks at coding section, which sucks.
Whats wrong with this?
<?
function BBCODE($bbcode)
{
$bbc_a=array(
",
"" target=_blank>",
"",
" <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b> <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b>CODE:</b></td></tr></table></b></td></tr></table>",
"</div></fieldset>",
"<img src="",
"" border="0">",
"<i>",
"</i>",
"",
"",
"<b>",
"</b>",
"<u>",
"</u>"
);
$bbc_b=array(
"<a href='",
"'>Link</a>",
"<strong> <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b>CODE:</b></td></tr></table></strong><div style=\"margin:0px 5px;padding:5px;border:1px dashed #000000;width:90%; overflow:auto; width:90%\"></em>",
"</em></div>",
"<img src='",
"'>",
"<i>",
"</i>",
"<strike>",
"</strike>",
"<b>",
"</b>",
"<u>",
"</u>"
);
$bbc_num=count($bbc_a);
$loop=0;
while($loop<$bbc_num)
{
$bbcode=str_replace($bbc_a[$loop], $bbc_b[$loop], $bbcode);
$loop++;
}
return $bbcode;
}
?>
I can't figure it out ;[
My error is..
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/****/public_html/users/bbcode.php on line 6
Line 6:
"" target=_blank>",
+rep for all help.
I added indents and made it look better and fixed it.
<?
function BBCODE( $bbcode )
{
$bbc_a = array(
",
"\" target=_blank>",
"",
" <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b> <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b>CODE:</b></td></tr></table></b></td></tr></table>",
"</div></fieldset>",
"<img src="",
"\" border="0">",
"<i>",
"</i>",
"",
"",
"<b>",
"</b>",
"<u>",
"</u>"
);
$bbc_b = array(
"<a href='",
"'>Link</a>",
"<strong> <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b>CODE:</b></td></tr></table></strong><div style=\"margin:0px 5px;padding:5px;border:1px dashed #000000;width:90%; overflow:auto; width:90%\"></em>",
"</em></div>",
"<img src='",
"'>",
"<i>",
"</i>",
"<strike>",
"</strike>",
"<b>",
"</b>",
"<u>",
"</u>"
);
$bbc_num = count( $bbc_a );
$loop = 0;
while( $loop<$bbc_num )
{
$bbcode=str_replace( $bbc_a[$loop], $bbc_b[$loop], $bbcode );
$loop++;
}
return $bbcode;
}
?>
Tried it and now i get:
Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/thirty/public_html/users/bbcode.php on line 6
Tried it and now i get:
Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/thirty/public_html/users/bbcode.php on line 6
Works on my localhost..
Try this
<?
function BBCODE( $bbcode )
{
$bbc_a = array(
"",
"\" target=_blank>",
"",
" <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b> <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b>CODE:</b></td></tr></table></b></td></tr></table>",
"</div></fieldset>",
"<img src="",
"" border="0">",
"<i>",
"</i>",
"",
"",
"<b>",
"</b>",
"<u>",
"</u>"
);
$bbc_b = array(
"<a href='",
"'>Link</a>",
"<strong> <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b>CODE:</b></td></tr></table></strong><div style=\"margin:0px 5px;padding:5px;border:1px dashed #000000;width:90%; overflow:auto; width:90%\"></em>",
"</em></div>",
"<img src='",
"'>",
"<i>",
"</i>",
"<strike>",
"</strike>",
"<b>",
"</b>",
"<u>",
"</u>"
);
$bbc_num = count( $bbc_a );
$loop = 0;
while( $loop<$bbc_num )
{
$bbcode=str_replace( $bbc_a[$loop], $bbc_b[$loop], $bbcode );
$loop++;
}
return $bbcode;
}
?>
Okay.. That worked ;]
but i get a new error now
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/thirty/public_html/users/bbcode.php on line 11
Line 11:
"" border="0">",
<?
function BBCODE( $bbcode )
{
$bbc_a = array(
"",
"\" target=_blank>",
"",
" <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b> <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b>CODE:</b></td></tr></table></b></td></tr></table>",
"</div></fieldset>",
"<img src=\"",
"\" border=\"0\">",
"<i>",
"</i>",
"",
"",
"<b>",
"</b>",
"<u>",
"</u>"
);
$bbc_b = array(
"<a href='",
"'>Link</a>",
"<strong> <fieldset style='width: 450'><div style='overflow:auto; width:450px'><table width='100%' cellpadding='0' cellspacing='0' style='border-bottom:1px dashed #000000;'><tr><td><b>CODE:</b></td></tr></table></strong><div style=\"margin:0px 5px;padding:5px;border:1px dashed #000000;width:90%; overflow:auto; width:90%\"></em>",
"</em></div>",
"<img src='",
"'>",
"<i>",
"</i>",
"<strike>",
"</strike>",
"<b>",
"</b>",
"<u>",
"</u>"
);
$bbc_num = count( $bbc_a );
$loop = 0;
while( $loop<$bbc_num )
{
$bbcode=str_replace( $bbc_a[$loop], $bbc_b[$loop], $bbcode );
$loop++;
}
return $bbcode;
}
?>
Yay! finally lmao!! +rep
Also could you tell me wth is wrong with:
$fetch2 = mysql_query("SELECT * FROM `forum_thread` WHERE `id` = '$_GET[id]' ORDER BY DESC");
while ($thread = mysql_fetch_array($fetch2))
{
$threadtitle = "$thread[title]";
$bbctt1 = BBCODE($threadtitle);
if($thread[sticky] == Yes)
Is really annoying.
The error is get is:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/thirty/public_html/users/forum.php on line 63
Line 63:
while ($thread = mysql_fetch_array($fetch2))
Thanks
$fetch2 = mysql_query("SELECT * FROM `forum_thread` WHERE `id` = '{$_GET[id]}' ORDER BY `id` DESC");
?
Invent
17-06-2007, 03:55 PM
Maybe because there is no thread with that ID?..So the mysql_fetch_array() has nothing to fetch.
i have made loads of threads and they are all in the DB, but they aren't showing ;l
Blob it worked but it only shows the first one and not the rest.
i have made loads of threads and they are all in the DB, but they aren't showing ;l
Blob it worked but it only shows the first one and not the rest.
Isnt the id supposed to be unique so no other one will have it?
Yes and when you add a new thread it inserts it into the database with a new id but for some reason it will only display the first one in each.
EDIT: Yeah i no what you mean.
I have serious coded this forum all wrong lol
think i will just scrap it
$fetch2 = mysql_query("SELECT * FROM `forum_thread` WHERE `id` = '{$_GET[id]}'");
Nope don't work ;[
This is the only problem i have the category's work and so do posts.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.