Jump to content

TreeNode

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Everything posted by TreeNode

  1. Well, now that you have the total rows you can have your conditional-loop statement include that... I might also be confused since you seem to be asking a few different things.
  2. .... which means you don't know if "eveerything works fine" unless you have something like: $mysqli = mysqli_connect("localhost", "root", "", "test"); if (mysqli_connect_errno()) echo "Error Connecting to the MySQL database!";
  3. Assign the number of rows returned from a query $total_rows = mysql_num_rows($seasonQuery);
  4. unsupress your fopen command (remove the '@'), then look for an error
  5. the error is from not having an actual connection to your mysql database, make sure you're using the write username/password
  6. If you need to connect to a database remotely, try this: Grant all privileges on *.* to USERNAME@IP identified by "PASSWORD"; USERNAME is the username that you would like to create. IP is the public IP address of your remote connection. PASSWORD is the password you would like to use for this username. You now must flush MySQL's privileges. Run this command: FLUSH PRIVILEGES;
  7. I did a short write-up about dynamic stored procedures in my blog: http://www.treenode.net/ I hope this helps. Thanks!
  8. There's too many unknowns about your issue. For example, you could be viewing the the cached version of the page you were just looking for, to check this click logout, hit the back button, hit refresh. You can add meta information to not cache your site.
  9. That depends on your server setup (php.ini) with session variables... most likely they will stay but its always best to include it (just in case!)
  10. You might want to destroy your sessions variables as well. Here's what I use to uber kill the session and its variables: unset($_SESSION['username']); unset($_SESSION['password']); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } $_SESSION = NULL; session_destroy();
  11. I don't see a <form> element in your html that states your method
  12. It's important that you know that the real rule is that no output can come before the session_start(), so, the very first thing must be the opened PHP tags, not even a space or newline can come before the <?php
  13. if you do: while (my_row = mysql_object->fetch_array(...)) { } it will continue till there is no more data left to output from your query, so yes, it is better to setup a loop because you're data might change eventually
  14. While asynchronous is meant to include both way of communication, the basic AJAX code will not allow for this, but there are a few frameworks that already do: http://www.trapets.com/page.jsp?node=559 The more realistic solution is to just stick with polling the server on a variable rate that does not affect your hardware, and upgrade when things get out of hand. Here's some more info: http://www.pushlets.com/doc/whitepaper-all.html Good luck, I would like to someday do this myself. I'm sure in a few years AJAX 2.0 will be server-side initiated requests.
  15. Looks right, there are other ways of course.
  16. Your logic is wrong. If it's not the same, <>, then set the session variable, otherwise it never reaches the $_SESSION['Test'] = $_POST['textfield']; line... unless of course you enter in nothing for the first time vising the site (without the session variable set already).
  17. Precendence can be controlled by using (parenthesis), try separating your union out by using such. Also, you might want to reduce the ambiguous of which fields you have in the WHERE clause, so use aliasing... FROM other_stats AS ost.customer_id = 46... Also, there are a few flags that can be applied to the union, such as DISTINCT or ALL. Finally, MySQL 4.1.x doesn't effecienly use unions correctly, if not at all.
  18. pseudo: $db = mysql_connection(h, u, p) or new_mysqli(h, u, p); $SQL = "SELECT title, time, date, location FROM movieTable WHERE title = 'Spiderman 3' ORDER BY date, time ASC"; $result = mysql_query($SQL) or $db->query($SQL) if (mysql_num_rows($result)) or ($result->num_rows) { $result_row = mysql_fetch_array($result) or $result->fetch_array(MYSQLI_ASSOC); $title = $result_row['title']; $location = $result_row['location']; do { $time = $result_row['time']; $date = $result_row['date']; echo $title . ", " . $time . ", " . $date . ", " . $location . "<b_r>"; } while ($result_row = mysql_fetch_array($result) or $result->fetch_array(MYSQLI_ASSOC)); } else NO RESULTS
  19. SELECT * FROM someTable ORDER BY theDate ASC LIMIT 9, 10
  20. The session and its data is tied to the URL
  21. also just in case... $username = trim($username); $password = trim($password);
  22. $stampName = $stampName[$tn]; Notice the BIG N. Also, you might not want to overwrite your array with a single variable.
  23. Here's how I do it: <select name="state"> <?php $user_state = $_POST['state']; $state_list = array( "AL" => "Alabama ", "AK" => "Alaska ", "AZ" => "Arizona ", "AR" => "Arkansas ", "CA" => "California ", "CO" => "Colorado ", ... ); foreach ($state_list as $key => $value) { $selected = ""; if ($key == $user_state) $selected = 'selected="selected"'; // Loop HTML ?> <option <?=$selected?>value="<?=$key?>"><?=$value?> </option> <?php // End HTML } ?> </select> Keep in mind that I have short-tags enabled.
×
×
  • 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.