Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. That is a feature of ASP.NET...it's called "View State"...essentially it's an array that is serialized, then base64 encoded, then sent as a hidden form field to the browser so that the next time the page is posted to the server it can see what the previous values were for any form fields. Such a thing does not exist by default in php, however I'm sure there are many user classes that do the same thing. Search www.phpclasses.org....
  2. PHP doesn't store variables beyond the execution of the page, so once it is done and has sent the result to the browser, all data is lost. The easiest way is to store the data in a user session. Alternatively, store it in a database.
  3. Just before the line that reads return($files); insert this line: sort($files); http://www.php.net/sort http://www.php.net/natsort http://www.php.net/natcasesort
  4. You are using the same name for the temporary variable in your while loops... <?php $sql1="SELECT problem.category as problem, SUM(answer.usage) " . "FROM `answer`,`problem` " . "WHERE answer.ID = problem.ID AND answer.week ='week 17' " . "GROUP BY problem ORDER BY SUM(answer.usage)"; $result1 = mysql_query($sql2) or die(mysql_error()); while ($thisrow = mysql_fetch_array($result1)) { $category=mysql_fetch_array($result1, 'problem'); echo ' <table> <tr> <th>' . $thisrow['problem'] . '</th> <td>' . $thisrow['SUM(answer.usage)'] . '</td> </tr>'; $sql2="SELECT problem.problem, SUM(answer.usage) " . "FROM problem, answer " . "WHERE problem.ID = answer.ID " . "AND problem.category = '$category' " . "AND answer.week ='week 17' " . "GROUP BY problem.problem " . "ORDER BY SUM(answer.usage) DESC"; $result2 = mysql_query($sql2) or die(mysql_error()); while ($thisrow2 = mysql_fetch_assoc($result)){ echo ' <tr> <td width="450px">' . $thisrow2['problem'] . '</td> <td width="50px">' . $thisrow2['SUM(answer.usage)'] . '</td> </tr>'; } echo ' </table>'; } ?>
  5. I think you have a curly bracket in the wrong place...and where is $noform_var being set? Try this... <?php if($_POST['submit'] == 'submit') { if (!$_POST['forename'] || $_POST['forename'] == "") { $message = '<p> Please select a forname <p>'; } else { $conn = mysql_connect("....", ".....", "......") or die(mysql_error()); mysql_select_db(".......", $conn) or die(mysql_error()); $forename = ($_POST['forename']); $addstudent = "INSERT INTO tbl_student (forename) VALUES ('$forename')"; $result = mysql_query($addstudent) or die(mysql_error()); if (mysql_affected_rows() == 1) { $message = '<p>Entry added. Would you like to <a href=\"student.php\">add another</a></p>'; } else { error_log(mysql_error()); $message = '<p>Something went wrong</p>'; } } } else { $message .= ' <FORM method="post" action="' . $_SERVER['PHP_SELF'] . '"> <input type="text" size="20" name="forename"> <input name="submit" type="submit" value="Add Student"> </FORM>'; } ?> <html> <head> <style type="text/css"></style> </head> <body> <table border=0 cellpadding=10 width=100%> <TR> <TD><H1>Add Student Form</H1> <br><br> <?php echo $message; ?> </body> </html>
  6. Look at the browser code for your page...I bet the css link line looks something like: <LINK REL=StyleSheet HREF=\"/css/pchanm.css\" TYPE="text/css">\n Change the single quotes to double around your echo statements... function css_menu_getcookie() { if ($_COOKIE['menucss']) { return "<LINK REL=StyleSheet HREF=\"". $tc_webpath . "/css/" . $_COOKIE['menucss'] . ".css\" TYPE=\"text/css\">\n"; } or reverse the quotes.... function css_menu_getcookie() { if ($_COOKIE['menucss']) { return '<LINK REL=StyleSheet HREF="'. $tc_webpath . '/css/' . $_COOKIE['menucss'] . '.css" TYPE="text/css">' . "\n"; } The single quotes will cause the "\n" to be taken literally, so it will output \n rather than a newline character.
  7. This may contain some information that will help: http://us3.php.net/manual/en/install.unix.commandline.php#53793 http://phplens.com/phpeverywhere/fastcgi-php
  8. The easiest way is to set the value of your form fields to the post value... <input type="text" size="25" name="last_name" value="<?php echo $_POST['last_name']; ?>" /> However, if you have error reporting set to E_ALL a notice will be generated the first time the user visits the page because $_POST isn't set before the page is submitted. Just reduce the error reporting level to make it go away.
  9. Does your local server have short php tags turned on...I don't think it is by default, so you would have to change it in php.ini? Change the "<?" to "<?php" and see if you get the same result.
  10. Generally speaking, ternary operations are used for assignment (the php manual's example does this). I would use a regular if statement for what you are describing because you aren't doing anything with the "else" portion of the ternary... if (!$sqlConnect) die("No database connection"); The curly brackets are optional with a "one-liner"
  11. The original PNG files should not lose anything...the jpeg that is output will not have transparency
  12. Either read the data in the text file to a variable, then write that variable back to the file first, or change: $fp = fopen("admin/db.txt", "w"); to: $fp = fopen("admin/db.txt", "a"); Notice the change from "w" to "a" as the second parameter to fopen. http://www.php.net/fopen#id3485037 is a table that lists what all of the letters mean.
  13. As adobe puts it on this page...http://www.adobe.com/support/fireworks/optimize/optimize_jpeg/ :
  14. Have you tried it? I would guess that it will work, but in order to execute the code you would have to store it as a string of text (if you execute it like you have it now, the array element will store the result of the "function") then use eval on the array element... $array = array( 'example' => 'is_dir(/example/example2))?print "yes":print "no";', 'example2' => 'echo "I am a test";' ); eval($array['example2']);
  15. Why is order a text field? that is why you are having a problem with your ORDER BY statement. Change it to INT.
  16. If you are outputting an jpg, regardless of what the "bottom" file is, it will not have transparency.
  17. If you don't specify a value for the checkbox in your html, the $_POST will contain an element where the key is equal to the name (as always) and the value is "on" if it is checked, or simply empty if it is not.
  18. Or use urldecode.... http://www.php.net/urldecode
  19. Change: $result=mysql_query($query); to: $result=mysql_query($query) or die(mysql_error()); See if you are getting an error.
  20. I could be wrong, but I think that jpg is incapable of having transparency...use either png or gif.
  21. What is the max upload file size? If the file you are uploading is above that, it will not complete the $_FILES array. See this page: http://us2.php.net/manual/en/features.file-upload.php
  22. I think it's a matter of traffic and the size of the variable. If you read a 10 MB text file into a variable on a page, and 10,000 users access that page at the same time, that obviously eats a lot of RAM as the system tries to process all the page loads, so it would be prudent to keep that very large variable in memory for as sort a period of time as possible.
  23. Zend Studio is an IDE, it helps you write code. Zend Platform is what you write code for...not sure what page your looking at but these describe them nicely: http://www.zend.com/products/zend_platform http://www.zend.com/products/zend_studio
  24. Use cron if you have a linux server or Task Scheduler if you have a windows server.
×
×
  • 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.