wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
You'd use preg_replace to do this, using [tt]\ [code\](.*?)\[/code\][/tt] as the regex pattern, eg <style type="text/css"> .code { white-space: pre; font-family: Courier New; border: 1px solid #333; background-color: #EEE; padding: 10px; } </style> <?php $text = <<<TEST <h1>HTML Tutorial</h1> <p>You should start every HTML page with: [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> </body> </html>[ /code]</p> <b>Unaffected <i>HTML</i></b> TEST; $text = preg_replace('#\[code\](.*?)\[/code\]#ies', "'<div class=\"code\">'.htmlspecialchars('$1').'</div>'", $text); echo $text; ?> NOTE: change [nobbc]</html>[ /code]</p> to </html>[/code]</p> (forum was messing up my post)
-
include does not return a value, so you cant assign it to a variable. Instead your should use file_get_contents.
-
Why do you want to skip the first two entries from the result set? Do you not want the query the return the first two rows from the games table? However your code as it is not recommended, but it should work.
-
What line(s) have you modified (or added) in index.template.php. From what I can tell the error is coming from the template_main_below() function. The problem area is from line 541 and 562, due to your (closing) braces not matching up. The following code corrects this //Close table for towerright ads if (function_exists("show_towerrightAds") && function_exists("show_towerleftAds") && function_exists("show_bottomAds")) { $ads = show_towerrightAds(); if( !empty ( $ads ) ) echo '</td><td valign="top">', $ads['type']==0 ? $ads['content'] : eval($ads['content']) ,'</td></tr></table>'; unset($ads); //Close table for towerleft ads $ads = show_towerleftAds(); if( !empty ( $ads ) ) echo '</td></tr></table>'; unset($ads); //Show ads on the bottom of the page $ads = show_bottomAds(); if( !empty ( $ads ) ) { if($ads['type']==0) echo $ads['content']; else eval( $ads['content'] ); } unset($ads); }
-
Your query has 16 columns listed but only 15 values.
-
I do not think the following is not needed 1987: if (!get_magic_quotes_gpc()) { 1988: $return = addslashes( $return ); 1989: } Seems out of place to me, definitely take it up with Mambos dev team.
-
The form has to submit to php script for processing you cant submit a form directly to a database. I presume your HTML and PHP code are in the same file?
-
[SOLVED] Update Column only in an sql statement
wildteen88 replied to johntp's topic in PHP Coding Help
If you only want to update a single column within a row you use the UPDATE query, eg $query = "UPDATE visitors SET TimeOut='$TimeOut' WHERE EmployeeID = '$Employee'"; -
Where is your form supposed to submit to, for processing? As currently your form does not have an action. Without the action your form will just submit to itself (reloading the page).
-
<br /> and <br> are both the same. Except <br /> is used with XHTML (More stricter version of HTML) mysql_fetch_array and mysql_fetch_row are also the same, except they return different types of arrays.
-
Numbers which end with a minus are not negatives, negatives start with a minus. Also when you do $var = (int)$var; (int) will remove any non-numeric characters from $var, eg $var = '123abc456'; echo (int) $var; PHP will return $var as 123
-
Your while loop is wrong, $row = mysql_fetch_row($result) should be the condition, not $result. Change $row = mysql_fetch_row($result); while ($result) { to while ($row = mysql_fetch_row($result)) {
-
I believe that uses Lightbox. This not AJAX.
-
No, MySQL has another INT dataype which is BIGINT. This can hold a much larger number (-9223372036854775808 to 9223372036854775807)
-
No to set the default controller you use $front->setDefaultControllerName('index') In you your "bootstrapper" (before your call $front->dispatch()) However the above should not be necessary, as zend should call the index controller (or action) by default if its not specified in the url. To test go to mysite.com, and Zend should call the indexAction within the indexController automatically without you specifying it in the url.
-
How can I simply debug scripts on windows Vista?
wildteen88 replied to Mike521's topic in PHP Installation and Configuration
Yes you can install what is called the AMP stack so you can fully test your PHP scripts before going live. You can install it manually by installing Apache, PHP and MySQL manually. However you can install a pre-configured package called WAMP which will do it all for you. -
What level is error_reporting set to? it should be set as E_ALL (PHP represents this as 6143)
-
Either add error_reporting(E_ALL); ini_set('display_errors', 'On'); at the top of your scripts. Or add the following to an .htaccess file in your sites root folder (where you upload your sites files). php_value error_reporting E_ALL php_flag display_errors On
-
Have a look at the following thread for the required JavaScript.
-
Are you uploading files in access of 4GB (4000M) via your form! You should not transfer large files over HTTP. Your should instead use FTP.
-
LOCKED You already have the same thread here: http://www.phpfreaks.com/forums/index.php/topic,213540.0.html
-
Yes you'd set a session variable ($_SESSION['currentPage']) they was on before logging in. Once they have logged in you check to see the currentPage session variable exists. If it exists you redirect the user to the page they was previously on.
-
Not much. PHP5 is backwards compatible with PHP4. However PHP5 is much more feature rich (in terms on of Object Oriented Programming - OOP for short) compared to PHP4. To see the differences check out the PHP manual, such as this.
-
_MAIL_; should be on its own line (nothing should be before or after it).