Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. the mail function requires 4 parameters - to, subject, body and headers. Change mail($to, $subject, $body); to $header = "From: ". $name . " <" . $email . ">\r\n" mail($to, $subject, $body, $header);
  2. Use: if ((!isset($_POST['viewed'])) || (isset($_POST['viewed']) && $_POST['viewed'] !="yes"))
  3. These are not errors. Errors cause PHP to terminate script execution. The three notices displayed are easily fixed. Notice: Use of undefined constant viewed - assumed 'viewed' in E:\domains\r\rainbowchildcare.org.uk\user\htdocs\rainbow.php on line 32 This is caused by calling a key from an associative array without placing quotes around the key, eg $_POST[viewed] is incorrect it should be $_POST['viewed'] Notice: Undefined index: viewed in E:\domains\r\rainbowchildcare.org.uk\user\htdocs\rainbow.php on line 32 This is caused because PHP couldn't find the key (in this case 'viewed') within the $_POST array. To fix, change: if ($_POST[viewed] !="yes") to if (isset($_POST['viewed']) && $_POST['viewed'] !="yes") Notice: Undefined variable: SERVER in E:\domains\r\rainbowchildcare.org.uk\user\htdocs\rainbow.php on line 34 This caused because PHP couldn't find the variable $SERVER. I presume here you meant to use the $_SERVER superglobal.
  4. this will require much more complex code. It is always best to parse BBCode tags in pairs and never on a singular basis. That way if users mistype a tag or place a tag where it shouldn't be your layout wont screw up. You should look into adding a "Preview" area so the user can check whatever they are about to post looks correctly and apply any amendments before posting their message.
  5. Add another parameter to your links call this parameter odir. add the following the code: Change: $order = (in_array($order, $allowed))? $order : "Feld1"; to $order = (in_array($order, $allowed))? $order : "Feld1"; $odir = ($_GET['odir'] == 'asc') ? 'desc' : 'asc'; Change: else { $order = "Feld1"; } to else { $order = "Feld1"; $odir = 'asc'; } Change ORDER BY $order")or die("Anfrage fehlgeschlagen: " . mysql_error()); to ORDER BY $order $odir")or die("Anfrage fehlgeschlagen: " . mysql_error()); Change: <td><a href = '{$_SERVER['PHP_SELF']}?orderby=Feld1'>ABCD</td> <td><a href = '{$_SERVER['PHP_SELF']}?orderby=Feld2'>EFGH</td> <td><a href = '{$_SERVER['PHP_SELF']}?orderby=Feld3'>IJKL</td> <td><a href = '{$_SERVER['PHP_SELF']}?orderby=Feld4'>MNOP</td> to: <td><a href = '{$_SERVER['PHP_SELF']}?orderby=Feld1&odir={$odir}'>ABCD</td> <td><a href = '{$_SERVER['PHP_SELF']}?orderby=Feld2&odir={$odir}'>EFGH</td> <td><a href = '{$_SERVER['PHP_SELF']}?orderby=Feld3&odir={$odir}'>IJKL</td> <td><a href = '{$_SERVER['PHP_SELF']}?orderby=Feld4&odir={$odir}'>MNOP</td>
  6. That error usually indicates there was a problem with your query. Change $sql = mysql_query ("SELECT pm_count FROM users WHERE username='$user'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; to $sql = "SELECT pm_count FROM users WHERE username='$user'"; $result = mysql_query($sql) or die('Query error:<br />' . $sql . '<br />' . mysql_error()); $row = mysql_fetch_array ($result); $pm_count = $row['pm_count'];
  7. FYI the script used to display the code with line numbers/syntax highlighting is called GeSHi.
  8. Locked. Do not post the same question twice. http://www.phpfreaks.com/forums/index.php/topic,217431.0.html
  9. include database.php in the other file you want to use the class then initiate a new instance of the class, eg include 'Database.php'; // create a new instance of the MySQL class $mysql = new MySQL; $mysql->connect('localhost', 'user', 'pass'); $mysql->close();
  10. You shouldn't have to apply css hacks for browsers other than IE. The problem I'm seeing is you're testing in just one browser (firefox) as you're developing your site design. You should always code bit by bit and test any changes you make in a variety of browsers at the same time, such as IE, Firefox, Safari, Opera, Google Chrome etc. As well as testing your design within a browser always ensure your HTML/CSS validates.
  11. Plan a .htaccess file within /foo with the following ErrorDocument 404 /foo/error404.html When a 404 error occurs within http://www.example.com/foo then Apache will serve error404.html from /foo.
  12. It'll run the code from where the condition is true (where the case matches), if animal was set to 'dog' then CV's code will return "dogcatpig"
  13. You'll be better of using arrays rather than variables, after this is what arrays are used for. However to answer you question you can use variable variables: ${'lastQ'.$i} = "";
  14. Yes that is possible, eg <?php $animal = isset($_GET['animal']) ? $_GET['animal'] : ''; switch($animal) { case 'dog': case 'cat': // etc echo 'You requested : ' $aniaml; break; default: echo 'Select an animal: <a href="test.php?animal=cat">Cat</a> | <a href="test.php?animal=dog">Dog</a>'; } You can also do: case 'dog': // more code here // PHP will execute all code here, plus the code in the next case case 'cat': // etc echo 'You requested : ' $aniaml; break; basically what is happening is PHP will execute all code within a switch/case until it comes across the break; keyword.
  15. The best way would be to study the Apache manual. Installing a local copy of Apache would be recommended too so you can mess about with Apache's setup at your own will.
  16. What type of files are you uploading? There are tons of tutorials on the web for uploading files with PHP.
  17. In your query you return the field mail from the signature table. However you're telling mysql_result to retrieve the email field. mysql_result can only return the fields you specify in your query. Prehaps you mean $email=mysql_result($result,$i,"mail");
  18. You're not explaining yourself clearly. I'm not understanding you, however the example code you posted is not recommended for use. Perhaps you mean <?php require("includes/db.php"); $sql = "select * from users WHERE id != 5 order by `s_phish` desc"; $result = mysql_query($sql, $link) or die(mysql_error()); ?> <?php echo mysql_num_rows($results) . ' results returned:<br />'; while ($row = mysql_fetch_array($result)) { echo '<pre>'.print_r($row, true).'</pre>'; } ?>
  19. Can you tell us how you're running the code? Make sure you're not running it directly in your web browser (via Open With.. or File Open etc), as web browsers do not understand PHP. You need to run your code in a PHP enabled server environment, your university should provide information about this to you. Also most importantly make sure all PHP code is saved in a file ending in a .php file extension.
  20. You need to call mysql_select_db after mysql_(p)connect Also do not mix and match PHP tags within your script, use one or the other.
  21. Do you mean you want two divs side by side? If so you should look in to CSS floats. I found the following tutorial very useful when learning CSS.
  22. Locked.
  23. @mjdamato you cannot use PHP tags/code within an echo: echo "<img src=\"/images/userprofiles/<?php echo $Image;?>\" width=\"100px\" height=\"150px\">\n"; That line should be echo "<img src=\"/images/userprofiles/$Image\" width=\"100px\" height=\"150px\">\n";
  24. Are you wanting something to happen when the user submits the form in your contact page (other than send the email ofcourse)? Such as a confirmation message or something. If so you'll need to add more code to your flash app for this to happen. Also as you're using mail() you'll need to make sure PHP is configured to use an SMTP server in order for any emails to be sent. You should check with your host about this.
×
×
  • 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.