Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. enclose the statement you are passing to the unix system in single quotes. Statements in single quotes are taken literally by php. Php will substitute values for variables when they are inside statements wrapped in double quotes. $x = "some text"; echo "x = $x"; //prints x = some text echo 'x = $x"; //prints x = $x
  2. make sure there are semicolons at the end of each line.
  3. $_SESSION isn't a normal object. It's more of a super global array that transcends page loads for the user (for a period of time). You can create objects from classes in php just the same as java, just refer to the docs for syntax(http://www.php.net/oop5), you can then serialize those objects (http://www.php.net/serialize) and store them in $_SESSION, then on the next page load, unserialize (http://www.php.net/unserialize) the object and use it like before. There are some exceptions...database connections are per page load...they do not store in the session at all. But most other things will. If you are doing any OOP with php, make sure you are using php5 if at all possible.
  4. $pics = array("pic.jpg", "pic2.jpg", "pic3.jpg"); $rand = array_rand($pics); echo '<img src="' . $pics[$rand] . '">';
  5. You can combine the two if statements. Also, why are you echoing an include statement? <?php if ($one == $two && $two == $three) { echo "All three cards matched!!"; include('rand-cards.php'); if ($one == "images/slots/04.GIF") { echo "Card one was 04.GIF"; include('rand-cards.php'); } } ?>
  6. You are missing a substantial amount of code that defines several of your variables from your example...where does $row_FeatureID come from? "echo ['featureName'];" isn't even valid syntax. Why are you constantly going in and out of php? E.g. <?php echo "a"; ?><?php echo "b"; ?> etc. Just use one set of php tags... <?php $featureCount = 0; while ($featurecount < 20) [ $featureCount++; if ($_POST['featureID1'] == $featureCount) { echo "featureID1 matches featureCount"; } } ?>
  7. Are your php scripts executing slowly because they are taking a long time to manipulate the data from your queries, or is the database taking too long to retrieve the data? Either way, look very carefully at your queries. The first situation, make sure that you are only getting the data that you are actually using, rather than getting a lot of data that just ends up being discarded on the php side. The latter situation, assuming you are only retrieving data you are using, you need to use EXPLAIN to ensure that your queries are optimized properly. That means having effective indexes, and using your WHERE, GROUP, and ORDER BY statements correctly. Additionally, you may want to take a good, long, hard look at your php and ensure that you aren't doing a lot of unnecessary operations on a large data set. Sometimes a large dataset is unavoidable, in that case, make sure that you are doing things in a manner that is efficient...e.g., don't loop through mysql results to put them into an array. Then loop through the array to do one operation, then loop again to do another operation, if both operations can be done before the data is put in the array to begin with.
  8. You need to use recursion... Here is an example of what you are wanting to do: http://us.php.net/manual/en/function.readdir.php#75156 Notice how when the script is going through the files in the directory it's looking through, if it sees that the file is actually a directory it calls itself to parse that directory.
  9. The scope of the mysql connection is outside of the function. PHP is not like a lot of other languages (Javascript) where a variable declared at the "base" level is automatically available to all functions below it. You can either make the mysql connection global (not recommended) or pass the connection to your function... function mysql_error_check($db_connect){ ... }
  10. echo number_format ( ($number1 * (1 - $number2)) , 2);
  11. are you using a relative path or an absolute path to the file? I've experienced problems using any of the "stat" related functions with relative paths before. The simplest thing to do would be to check the file extension when it's uploaded and make sure it is of the type that you want to keep.
  12. That means it can't determine what type the file is, not that it's the wrong type.
  13. First, remove your connection credentials for mysql. Your server probably has register globals turned off. Try assigning the value to $acstion... $action = $_GET['action'];
  14. You do know this is a php forum right? He's not referring to a therapy session or anything. Sessions keep track of data on a per user basis on the server side. They are only maintained for a certain period of time, however, the "session" itself is the data, not a period of time.
  15. are you sure that it's being passed from page to page correctly? Place a "default" on your select statement... switch($action) { case "edit": ............. break; } case "delete": ............ break; default: echo 'Action not found...'; }
  16. The table existing doesn't mean that the column exists inside of the table. "just an error" is still an error that prevents your script from executing properly.
  17. Windows servers still obey relative paths... "./" will always mean "current directory" in every operating system
  18. according to the error, it doesn't...
  19. Does your database have a column named "email" in it?
  20. You're killing me...use some basic debugging skills here...there's a missing closing parenthesis on the end of the statement... $result=mysql_query($q,$connection) or die(mysql_error($connection));
  21. Where is $action defined at?
  22. Your original query is fine...it is perfectly acceptable to have backtics around table and column names. Having single or double quotes around them will cause an error... Anyway, I haven't seen anyone ask what the error is, and I don't see it posted... Change: $result=mysql_query($q,$connection); to $result=mysql_query($q,$connection) or die(mysql_error($connection); And post what the error you're getting is.
  23. if (($thisWeek - 1) < 1) { $thisWeek = 52; $thisYear = $thisYear - 1; } if (($thisWeek + 1) > 52) { $thisWeek = 1; $thisYear = $thisYear + 1; }
  24. Use a java uploder? I don't think javascript will work...it's sandboxed to the browser. start here: http://www.google.com/search?source=ig&hl=en&q=java+applet+uploader&btnG=Google+Search
×
×
  • 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.