Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Use $str = preg_replace ('/\[size=([0-9]+)\](.*?)\[\/size\]/is', "<span style=\"font-size: {$1}px\">$2</span>", $str);
  2. Look into nl2br()
  3. Yes you can use vhosts for this. However for http://development.network.local and http://live.network.local to work you'll need to add them to your hosts file. eg 127.0.0.1 development.network.local 127.0.0.1 live.network.local Once the hosts file is setup. You can setup your vhosts example NameVirtualHost network.local:80 <VirtualHost live.network.local:80> ServerName live.network.local DocumentRoot "F:/live" </VirtualHost> <VirtualHost development.network.local:80> ServerName development.network.local DocumentRoot "F:/development" </VirtualHost> Save any changes you made to Apache's configuration. Make sure Apache is restarted afterwards. http://development.network.local should serve files from F:/developement and http://live.network.local should server files from F:/live
  4. This is because its only the value of the variable that is being passed to the function. Not the variable itself. Yes you can do so by using the global keyword within the function. However this is considered bad programming practice. I would recommend you to read up on variable scope. You call the makebold function here: echo makebold($text); What will happen here is PHP will run the code in the makebold function first. It'll then echo the value returned from that function. So If you removed the following return($text); from your function then nothing will be returned, and thus nothing will be echo'd. You see where the problem is now?
  5. There one two problems I can think of, 1. Apache is not configured correctly for handling .php files. How did you install Apache and PHP, and how is Apache configured? 2. Your scripts use short tags (<? ?>, or <?= ?>). PHP disables short tags by default when installed. You can enable short tags via the php.ini by enabling a setting called short_open_tag. If your script uses short tags and they are disabled then you can get irregular results like this. It is recommended that you do not use short tags.
  6. Xampp is designed to allow you to install Apache, PHP and MySQL quickly and easily on your computer. All software that comes with XAMPP is open source and comes with their own License(s). Xampp should only be used as a development server only.
  7. Cookies cannot be used directly after they have been set. The page will have to be reloaded in order for the cookie to come available. This is nothing to do with PHP but how the HTTP protocol works.
  8. mysqli_ was introduced when PHP5 was released. It allows you you take advantage of MySQL5's features. the mysqli_* functions behave differently compared to the older mysql_* functions. I would recommend you to read the manual for working with MySQLi.
  9. You should look into using a proper IDE when creating your PHP scripts, as these will include all sorts of utilities for debugging PHP code. Dreamweaver is best used for HTML/CSS etc. There are many different types of IDE's out there. The top of line IDE would be Zend Studio, however there are many cheaper variants such as PHP Designer 2008 which can be had for about $30 (dont know the actual price). Or you could use Eclipse with the PDT addon which is free.
  10. Are you restarting Apache after making any changes to the php.ini?
  11. the php.ini This is why you have to rename the php.ini-recommended to just php.ini
  12. It wont display the Nationality as you have only told MySQL to return the name of the driver Change your query to: Now to display the nationality you'd use $nationality= $contact->nationality; echo $nationality; Within your while loop.
  13. They manage two different types of SQL databases. phpMyAdmin is used for managing MySQL Databaes. SQLiteManager is used for managing SQLite Databases
  14. Maybe it could be been before then. I cant remember which. I know it happened around the same time we switched from IPB to SMF.
  15. The default configuration file in phpmyadmin/libraries/ folder should get you going (you'll have to copy config.default.php to the root of your PMA folder, and then rename it to config.inc.php). Also rather than set a default username/password PMA uses to login to MYSQL. Open your config.inc.php and find the following line: $cfg['Servers'][$i]['auth_type'] = 'config'; Change 'config' to 'http' instead. Now whenever you go to use PMA a login box will appear asking for your MySQL username/password.
  16. Do you mean that is what is shown when view your php folder in Windows Explorer? If so you have not correctly renamed the php.ini. Open the php.ini-recommended into notepad. Then go to File > Save As.. and type the following into the file name box: "C:\php\php.ini" (including the quotes). After click save. A php.ini file should be created in your PHP installation folder. Use this new file to configure PHP. I would recommend you to change a system setting which stop Windows from removing the file-extensions from file names. To do so open any Folder and go to Tools > Folder Options > View. Now Scroll down the list of Settings and uncheck the setting labelled "Hide extensions from known file types". Click Ok. Windows should now show files extensions along side filenames, eg filename.ext rather than just filename
  17. Yes PHPFreaks was the only Admin. Ober/Ron became Admins after we moved from IPB to SMF.
  18. You'll have to loop through the $fileArray array then apply explode on each item within the array. foreach($fileArray as $line) { $bits = explode("\t", $line); echo '<pre>' . print_r($bits, true) . '</pre><hr />'; }
  19. Can you explain whats the script is supposed to do? and what you're trying to do.
  20. Yes. You could use a for loop for this. Eg: for($i = 0; $i < $total_pages; $i++) { echo ' <a href="?page='.$i.'">'.($i+1).'</a> |'; } Have a guess where it should go.
  21. Change $content = "Hello, World! {newpage} Hey! A new page... {newpage} Kool {newpage} Another too! {newpage} Umm, bye!"; $pages = explode('{newpage}', $content); echo $pages[$page].'<br>'; to $content = range(1, 1000); $pages = array_chunk($content, 25); echo implode('<br />', $pages[$page]).'<hr>';
  22. Its is not PHP causing it. Its you. PHP does what it gets told to do. We can't really suggest anything until we actually see your code that is causing the issue.
  23. I don't think CV actually fixed your code, but give an example of how clear your code becomes when you indent.
  24. Dont know if you saw my post above ^^^
  25. This is an old script I created when I started out in PHP <?php $page = (isset($_GET['page'])) ? $_GET['page'] : 0; $content = "Hello, World! {newpage} Hey! A new page... {newpage} Kool {newpage} Another too! {newpage} Umm, bye!"; $pages = explode('{newpage}', $content); echo $pages[$page].'<br>'; $total_pages = count($pages); $prevpage = $page - 1; $nextpage = $page + 1; if ($page > 0) { if($page < $total_pages - 1) { $page_div = ' | '; } else { $page_div = ''; } echo "<a href=\"?page={$prevpage}\">Prev</a>{$page_div}"; } if ($nextpage < $total_pages) { echo "<a href=\"?page={$nextpage}\">Next</a>"; } ?>
×
×
  • 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.