Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. This is becuase when you add a doctype the browser goes in to standards mode. Meaning it follows the standards set by W3C with the doctype you are using. What it appears to be is it adding extra padding in the black box. Could you post a live example of the webpage.
  2. The PHP CLI binary is most probably is the php-cli.exe file that comes with the Windows PHP Distribution over at php.net
  3. We aint here to write scripts for you. We are here to help you with the developement of your scripts, sorting out errors, or answering your questions about the PHP lanaguage etc. We can provide little code snippets but not fully fledged scripts. If you want someone to write you a script post a request in the PHP Freelancing forum.
  4. or use [url=http://php.net/urlencode]urlencode[/url]
  5. No. PHP runs on a per request basis. Meaning PHP will run when a request to a PHP file is made. A schedule is the only option to run a PHP script at a  specific time.
  6. Yes yiou can use a technique called WEFT. Search for it in google. Also this is a HTML question rather then PHP so i'll move it
  7. use [code=php:0]if($hanger > 1) {     // decrease by 1     $hanger--; }[/code] Now to run it every 24 hours you'll want to setup a cron tab (unix servers) or Schedule (Windows)
  8. I have saved you the hassel of correcting the errors for you. I also noticed you had a few syntax errors and unneeded code. Download the attachment below Note do not indent or put anything before or after any instance of HTML; otherwise you'll get errors. Plus whilst going through your code I noticed you dont valid urser input. Never use raw user input. Otherwise your SQL Queries will be prone for SQL Injection attacks, which is not good. At lease use mysql_real_escape_string to help prevent this on your input vars for example: [code]$name = mysql_real_escape_string($_POST['name']);[/code] [attachment deleted by admin]
  9. Use HEREDOC syntax if you have a lot of HTML to echo But yeah do what shocker-z sys. You need to escape your double quotes in your echo statement. You cannot use double quotes in an echo statement if you start of your echo with a double quote. This is the correct way: [code=php:0]echo "<form action=\"page.php\" method=\"post\">";[/code] Or use HEREDOC for large HTML Blocks: [code=php:0]echo <<<HTML <form action="page.php" method="post">   .. html here .. </form> HTML;[/code]
  10. This: [code]mysql_query("INSERT INTO downloads (name, descr, pic, type, link) VALUES ('$name','$descr/n/n$format/n$size','$pic','$type','$link')"); or die(mysql_error());[/code] Should be this: [code]mysql_query("INSERT INTO downloads (name, descr, pic, type, link) VALUES ('$name','$descr/n/n$format/n$size','$pic','$type','$link')") or die(mysql_error());[/code]
  11. It should load up index.php automatically. If your server has had index.php added to the DirectoryIndex directive. If it wasnt configured you might be able to add this to the htaccess file: [code]DirectoryIndex index.php[/code]
  12. If its a folder you should have a forward slash after admin so its like this: mysite.com/admin/ if you want to use admin to go to the admin folder then use this: [code]RewriteRule ^admin$ admin/[/code]
  13. Add or die(mysql_error(); to the end of this: [code]mysql_query("INSERT INTO downloads (name, desc, pic, type, link) VALUES ('$name','$desc/n/n$format/n$size','$pic','$type','$link')");[/code] So its now this: [code]mysql_query("INSERT INTO downloads (name, desc, pic, type, link) VALUES ('$name','$desc/n/n$format/n$size','$pic','$type','$link')") or die(mysql_errot());[/code] However I think its becuase you have a coloumn name called desc and desc is a reserver MySQL keyword. use backticks around the desc so its this: `desc` [code]mysql_query("INSERT INTO downloads (name, `desc`, pic, type, link) VALUES ('$name','$desc/n/n$format/n$size','$pic','$type','$link')") or die(mysql_errot());[/code]
  14. I get Parse error: parse error, unexpected T_VARIABLE, expecting '(' in /home2/wwwplat/public_html/display.php on line 12 When going to the link provided. Also everything seems to be fine with the code. Prehap this: [code]extract(mysql_fetch_array($result,EXTR_SKIP));[/code] needs to go inside the while loop like so: [code]while ($row = mysql_fetch_assoc($result)) {     extract($row);[/code]
  15. No, &amp ; (without the space) is the html entity of & (ampersand) The link will be this in your html: [code]mysite.com/page.php?var=foo&amp;var2=bar[/code] However when you hover over the link it'll display as: [code]mysite.com/page.php?var=foo&var2=bar[/code] It allows you to keep your page XHTML valid. However I dont think this will help, as this will only afect urls to your site and not urls going to other sites (amazon).
  16. You'll want to use: $wordz = explode("\n", $toc); rather than $wordz == explode('\n',$toc); == is the comparision operater, checks whether something on the left is equal to something on the right. = is the assignment operator Also notice I use double quotes around \n. This becuase PHP will treat \n as a string if use single quotes, rather than as a new line character.
  17. by trim you mean remove. If you do then use str_replace [code=php:0]$var = 'foo'; $str = 'This is foo Q speaking'; echo str_replace($var, '', $str);[/code] If not could you provide more info on what you are trying to do. Along with an example.
  18. There is one more option which I dont like when it comes to this. Its to use output buffering. Add ob_start(); at the top of process.php. so it is just under <?php and add ob_end_flush(); at the bottom of process.php so its just before ?> Do you get any errors now?
  19. How strange. Everthink is fine there. Not sure then. Is this the ony error message you get. Do you get any notice messages or any other error messages. The only thing I can see that isnt ok which is this: [code]mysql_query('$errorquery');[/code] Change that to: [code]mysql_query($errorquery);[/code]
  20. According to the error some from of output was detected around line 141 in process.php. Post the code from lines 136 through to 146 here.
  21. Yes use list and explode like so: [code=php:0]list($num1, $num2, $num3) = explode(" ", $num_formated); echo 'Number 1: ' . $num1 . "<br />\n"; echo 'Number 2: ' . $num2 . "<br />\n"; echo 'Number 3: ' . $num3 . "<br />\n";[/code] That replaces this: [code=php:0]// disply the number: echo 'Old: ' . $num . "<br />\n"; echo 'New: ' . $num_formated;[/code]
  22. As you are using XHTML Doctype you must close all tags. If you have tags that dont have a closing tag you have to have [b](space)/[/b] before > So for the link tag it should be this: <link href="final.css" rel="stylesheet" type="text/css" /> the same for meta, input, hr, br tags etc or any other tag that doesnt have a closing tag. As for the errors with the Amazon Ads. You cant really fix them.
  23. Topic closed. You alread have the same question asked in the [url=http://www.phpfreaks.com/forums/index.php/topic,105481.0.html]PHP Help forum[/url]. Please do not post multiple copies of the same thread in different forums.
  24. If you are getting no errors then its working. Is that your full code. If its then that code wont display anythink. All it does is connect and select the database thats it. It wont return anythink. The only time it'll return something is when you start to query the database. Like so: [code=php:0]<?php $dbhost = 'localhost:3306'; // this is fine, as '':3306 specifies the port number MySQL is running on $dbuser = 'testuser'; $dbpass = 'testpass'; $conn = @mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql' . mysql_error()); $dbname = 'testdb'; mysql_select_db($dbname); // now query the database $sql = "SELECT * FROM table_name"; $result = mysql_query($sql, $conn) or die('Unable to perform query - ' . $sql . ' - ' . mysql_error()); // start the table: echo '<table>'; // now display the results: while($row = mysql_fetch_assoc($result)) {     echo '<tr><td>';     echo implode('</td><td>', $result);     echo '</td></tr>'; } // close the table: echo '</table>';[/code] Now change [i]table_name[/i] from the SQL query ($sql) to the table that is in the database (testdb). It'll now run the query and display everthing that is in that table.
  25. As long as 25 is in range of 00-99 then this should work: [code=php:0]<?php $num = '62500'; // reverse the number so we can work right to left $num_rev = strrev($num); // format the number // number fomrat in reverse // xx yy zzzz $num_format_rev = preg_replace("/([0-9]{2})([0-9]{2})([0-9]{1,4})/", "$1 $2 $3", $num_rev); // now reverse the formated number $num_formated = strrev($num_format_rev); // disply the number: echo 'Old: ' . $num . "<br />\n"; echo 'New: ' . $num_formated; ?>[/code]
×
×
  • 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.