wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
I had this same issue myself when installing MySQL on Vista. To sort this I installed an earlier version of MySQL rather than the latest version. Make sure before running the installer you right click on the installer and select Run as Administrator.
-
Making a cleaner & fancier index/directory
wildteen88 replied to sysopgrace's topic in Apache HTTP Server
Apache has many options for customising the generated Index pages. You'll need to have access to Apache's httpd.conf configuration file to alter the Index view. There is not a default template file you can edit. Have a read of IndexOptions directive for customising the index page. -
If you want to open the blog page on the page that popup displayed then target="parent" (or is it taget="_partent") should work.
-
That revised code should work, however it'll only remove the 'file' key from the P1040050.jpg array.
-
You could use array_combine to combine the two arrays together. <?php $_SESSION['geheugenBussen'] = array("DDR2-533","DDR2-667","DDR2-800","DDR2-900","DDR2-1000","DDR2-1066","DDR2-1100 en hoger","DDR2-1333"); $_SESSION['geheugenBussenCat'] = array("417","423","424","425","428","427","429","1277"); $combined = array_combine($_SESSION['geheugenBussen'], $_SESSION['geheugenBussenCat']); echo "<select>\n"; foreach($combined as $key => $value) { echo " <option value=\"{$value}\">$key</option>\n"; } echo "</select>"; ?>
-
Can you explain a bit more. I am not understanding your question.
-
[SOLVED] problem with excact value matching in mysql
wildteen88 replied to gli's topic in PHP Coding Help
You'd have to run a SQL Query against your database, exmaple: $qry = "SELECT * FROM your_table WHERE `username`='$username'"; $result = mysql_query($qry) or die('Query error:- ' . mysql_error()); // now to see if your query returned a match, you'd check to see the number of returned rows equals to one: if(mysql_num_rows($result) == 1) { echo '<b>'.$username.'</b> Exists!'; } else { echo '<b>'.$username.'</b> Does not exist!'; } -
Strange, first remove all existing files in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs leaving just your phpinfo.php file Open your browser and go to http://localhost This time you should see an Index of / page displayed and lists all folders/files currently in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs. Can you see your phpinfo.php file? What happens when you click on the link to that file.
-
For best results I prefer to configure Apache with the PHP module. So remove these lines: ScriptAlias /php/ "C:/php/" Action application/x-httpd-php "/php/php.exe" and replace them with: LoadModule php5_module "C:/php/php5apache2_2.dll" Save the httpd.conf and restart Apache. Job done.
-
When configuring Apache you can place the configuration lines anywhere in the httpd.conf there is no standard, so don't worry about where you place the configuration lines you book tells you too. When configuration Apache with the PHP module make sure you use the correct module for the version of Apache you have installed. If you have Apache 2.2.x installed then you should use the provided php5apache2_2.dll module that comes with PHP, instead and not the older php5apache2.dll module (which is for Apache2.0.x only). Your book may not explain this as it was most probably published before Apache2.2.x was released. I mentioned this as it is a common pitfall for using the incorrect module for the version of Apache installed. Also PHP5 does not come with a sapi folder so I don't know why your book is instructing you to add the following line to the httpd.conf: LoadModule php5_module "c:/php/sapi/php5apache2.dll" It should be: LoadModule php5_module "c:/php/php5apache2.dll" NOTE: Make sure whenever you make any changes to the httpd.conf that you restart Apache (Via the Start menu or taskbar icon). You should place your PHP files in your "document root" by default it is C:/[path/to/apache]/htdocs
-
How are you configuring Apache, Sounds like you are using PHP as CGI. It is better to configure PHP with Apache using the provided Apache module that comes with PHP (php5apache2_2.dll).
-
Umm, can you give a more informative example. Not understanding your question! Do you want something like the following: home > some category > page Like this forum has, eg: PHP Freaks Forums > PHP and MySQL > PHP Help > Topic: Need a code..... If you do then search for PHP breadcrumbs tutorial
-
Try http://127.0.0.1/ If that doesn't work your Windows Hosts file must be corrupt. localhost is an alias to 127.0.0.1
-
You only need to call session_start() only once . You don't call it everytime you want to use a session variable. You should call session_start() before any output. If you have any form of output you'll get either a blank page or an "header already sent" error message. If you don't want PHP to continue the script at a certain pioint use die(); or exit;
-
You can export your existing database table structure and data by using phpMyAdmins export feature (open a database in phpMyAmdin and click the Export tab). Using this feature will allow you to download an .sql file to your computer. To transfer your database, login to PMA on your new host, and create a new empty database then click the Import tab. Follow the Import instructions. After phpMyAdmin will rebuild your database structure and populate your database.
-
Parse a specific file with no extension as PHP
wildteen88 replied to haku's topic in Apache HTTP Server
You can use Mod rewrite, rename the index file to index.php first then apply the following rewriterule: RewriteRule ^index$ index.php [NC,L] Calling mysite.com/index will call index.php -
If you want to export your MySQL database then you can use a PHP application called phpMyAdmn, most hosts provide this script as part of their hosting plan, you can access it via your sites Control Panel.
-
Maybe Apache is not reading your .htaccess file. You can tell this by placing some invalid commands into the .htaccess file eg: foobar123 # an invalid command RewriteEngine on RewriteRule ^go/([0-9a-zA-Z]+)$ redir/index.php?goto=$1 [L] When you go to your site or folder the .htaccess is in you should get an 500 Internal Server Error message appear. If you dont Apache is not configured to read .htaccess files. I tried the rewriterule and they both work fine.
-
Should work find as long as you have a index.php file in the redir/ folder. Try specifying the filename too: RewriteEngine on RewriteRule ^go/([0-9a-zA-Z]+)$ redir/index.php?goto=$1 [L]
-
If you're using Linux then PHP extensions will not be extension_name.dll by extension_name.so Also extension_dir should be an absolute path to PHP's extension folder, eg: Change the path in red to your PHP4 installation path. Also make sure that when PHP got installed that the --with-gd flag was used. You can check this when running phpinfo() and looking at the Config Command line (think it is called that). Another thing as you're using Red Hat linux you should be able to install the GD PHP extension via Red Hats package manager (this is will only work if PHP was originally installed from the package manger).
-
Thorpes code will work for PHP pages too! Another thought, Rather than use file_get_contents you could just save all output to a variable, say $html_output in your PHP scripts by converting your echo/print statements. Then at the bottom of the page just do: echo htmlentities($html_outut); Or a better way would be to use output buffering.
-
You wont need to to alter your chmod permissions for mod_rewrite to work. However this can be archived using just PHP too, however you wont be able to hide the file name from the url, if you do it with PHP you're url's can only be like: mysite.com/index.php/SomePageName/PageNumber/something_else With mod_rewrite you can hide the filename (index.php).
-
Changing a 'save as' dialog to save to server? [Code Inside]
wildteen88 replied to TRemmie's topic in PHP Coding Help
What errors are you getting? Post any errors you're getting here. Your code maybe failing because I used a function called file_put_contents which is only available forn PHP5 or higher. Are you using PHP4? If you are you'll need to use fopen, fwrite and fclose instead. I have modified my code. You should see an error if the code still doesn't work: <?php // the following lines tell PHP to show an errors during runtime ini_set('display_errors', 1); error_reporting(E_ALL); if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] ) && isset($_GET['name'])) { // get bytearray $pdf = $GLOBALS["HTTP_RAW_POST_DATA"]; $path = $_SERVER['DOCUMENT_ROOT'].'/pdfproject/'; $pdf_name = $_GET['name']; // check that the /pdfproject folder is writable if(is_writable($path)) { echo '<p>"' . $path . '" is writable!<br />'; // check that the file doesn't exists first before creating it if(!file_exists($path.$pdf_name)) { // file doesn't exists, so create the file. echo '"'.$pdf_name.'" doesn\'t exist!<br />'; echo 'Creating PDF "' . $path.$pdf_name . '"... '; // create an empty file $hander = fopen($path.$pdf_name, 'w'); // attempt to write data to created file if (fwrite($handler, $pdf) === TRUE) { echo 'SUCCESS'; } else { echo 'FAIL'; } // close the file fclose($handler); } else { echo 'File already exists ('.$path.$pdf_name.')'; } } else { echo $path . 'is not writable! Unable to create PDF'; } } else { echo 'An error occured.'; } ?> -
When using escape characters such as newlines (\r or \n) you should use double quotes. PHP will treat characters in single quotes as is. Following line $value = preg_replace('/[\r\n\t]+/', '', $value); should be: $value = preg_replace("/[\r\n\t]+/", '', $value);
-
Please have a look in the FAQ/Code Snippet Repository board you'll find an FAQ Thread which explains the -> operator.