wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
[SOLVED] append or create data in mysql cell mysql OR php
wildteen88 replied to ratcateme's topic in PHP Coding Help
I am not really understanding your problem really. But it seems like you want to remove empty items from an array, if so look into the array_filter function. This function will remove empty items from an array -
[SOLVED] using php within a link within php
wildteen88 replied to runnerjp's topic in PHP Coding Help
Doh! Mis read the post. -
[SOLVED] using php within a link within php
wildteen88 replied to runnerjp's topic in PHP Coding Help
You mean \" right? -
[SOLVED] Expire date with diffeent colors
wildteen88 replied to web_master's topic in PHP Coding Help
You might want to look into use strtotime or even mktime. eg: $thirty_days_ago = strtotime('-30 days); echo date('Y-m-d', $thirty_days_ago); -
[SOLVED] forum issue or maybe php issue ??
wildteen88 replied to runnerjp's topic in PHP Coding Help
The problem is an HTML issue and not a PHP related one. Check through the HTML output for any errors. -
[SOLVED] Expire date with diffeent colors
wildteen88 replied to web_master's topic in PHP Coding Help
Use if/elseif rather than seperate if's if(date("Ymd") <= $ninety_day) { $expire_style = "txt-expreg-3month"; } elseif(date("Ymd") <= $sixty_day) { $expire_style = "txt-expreg-2month"; } elseif(date("Ymd") <= $thirty_day) { $expire_style = "txt-expreg-1month"; } -
[SOLVED] using php within a link within php
wildteen88 replied to runnerjp's topic in PHP Coding Help
You need to escape any double quotes within a string which starts/ends in double quotes. <?php if($gettopic3['forumlock'] == 0) { echo "<a href=\"index.php?page=reply&id=$id\"><img src=\"http://www.runningprofiles.com/images/post_reply.gif\" border=\"0\" /></a>"; } else { echo 'forum is locked'; } ?> -
Have a look in apache's access.log and/or error.log too.
-
How is your array formatted? Post the output of print_r
-
Post your current code. I'm not quite understanding your question seems you may be over complicating things.
-
Ensure that your router is correctly port forwarding port 18080. Im not a linux expert but perhaps something not quite setup right on Debian.
-
Name your submit button submit and it'll work.
-
Use array_values prehaps.
-
Try: <?php if(isset($_POST['submit'])) { $path = $_SERVER['DOCUMENT_ROOT'] . '/userpages/'; $file_name = $_POST['page_title']; $file_contents = "<b>Email Address:</b> <br> {$_POST['user_email']} <br /> <br /> <b>About Me:</b> <br /> {$_POST['about_you']} <br /> <br /> <hr height=\"5\" width=\"100%\">"; // Let's make sure the file exists and is writable first. if (is_writable($path)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($path . $file_name, 'a')) { echo "Cannot open file $file_name"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $file_contents) === FALSE) { echo "Cannot write to file $file_name"; exit; } echo "Success, created $file_name"; fclose($handle); } else { echo "The file $path is not writable"; } } else { echo 'Form not submitted! $_POST contents:'; echo '<pre>' . print_r($_POST, true) . '</pre>'; } ?> This is will print messages at different stages. It should identify where your script is failing.
-
Looking back at your original thread your script is not being instructed to output anything, thus you get a blank page when form is submited. As for no file being created then you you should add fclose($fp); at the bottom of your script before ?> in createfile.php
-
What happens if you use your servers ip address (not the internal LAN address) instead rather than dyndns.org address are you able to connect then.
-
Is your error_reporting to set to E_ALL? PHP should display all error types and not a blank page if error_reporting is set to E_ALL.
-
The problem is probably not do with the code but is more likely to do with the file path used in fopen. That code is being ran from the /home/findzer/public_html/userpages directory in a file called createfile.php (as the error states). Now the path you use in fopen is userpages/what-ever-file.html, As this is a relative file path PHP will add your path onto the current working directory (path above) and so the path PHP will use to open the .html file will be: /home/findzer/public_html/userpages/userpages/what-ever-file.html Which is obviously wrong. I'd suggest you to use: $fp = fopen('./' . $page_title . '.html', 'a'); // OR $fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/userpages/' . $page_title . '.html', 'a');
-
[SOLVED] Class static functions not allowed?
wildteen88 replied to pigmonkey's topic in PHP Coding Help
PHP4 does not support keywords such as public, private, static. PHP4 has very limited OOP support. PHP5 is the preferred version for developing in OOP. You can see which OOP features PHP4 supports here. The same can be found for PHP5 here. -
Where is your php.ini file currently? Make sure it is in your PHP installation folder. Once you have the moved the php.ini IIS will need to be restarted.
-
You must provide the port number after localhost, for exmaple if you changed Apache to listen to port 8080 you'll need to use http://localhost:8080 if you do not specify the port in the address then port 80 will be used.
-
seems session_destroy for logout crashes server?
wildteen88 replied to n3mesis125's topic in PHP Coding Help
garbage collection does not run all the time by default the gc process has something like a 1% of running on each session_start request. -
OK first of remove any files which you have moved outside of the php directory. Download the php zipped binaries distrubuton from php.net rather than the installer. Extract the contents of the zip to where you install PHP to (I presume C:\php) making sure you overwrite existing files/folders. Now restart IIS. Make a new file call this file phpinfo.php add the following code <?php phpinfo(); ?> Now run this file from your website. Look for the line that begins with Loaded Configuration File The file path stated to the right of that line should be the correct path to the php.ini your are editing. If its set to (none) then PHP is not reading your php.ini and thus the mysql extension is not loading. Make sure your php.ini is in your PHP folder. If PHP is added to the PATH correctly it should load the php.ini from your PHP Installation folder. Restart ISS and re-run the phpinfo.php script and PHP should now be reading your php.ini If its now reading the php.ini it should now be able to load the mysql extension(s) too. Check by scrolling down the pageooking for the MySQL and MySQL Improved sub headings/sections.
-
remove the echo statemtns in your function. Use return instead maybe: function Category() { $html = '<select name="category">'; $query = "SELECT * FROM {$db_prfix}multi_cat"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { if ($row['status'] == '1') { $html .= ' <option value=' . $row['id'] . '>' . $row['name'] . '</option> '; } } $html .= '</select>'; return $html; } $content = file_get_contents("multi_templates/signup.html"); $content = str_replace('%{cat}%', Category(), $content); echo $content; If the menu is still going above your table then there must be a bug in the generated HTML.
-
Have you enabled the extension=php_mysql.dll line in the php.ini too? Umm, I must update my FAQ for this problem as I now discourage moving files outsite of the PHP folder and recommend adding PHP to the PATH instead.