TreeNode
Members-
Posts
59 -
Joined
-
Last visited
Never
Everything posted by TreeNode
-
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.
-
Assign the number of rows returned from a query $total_rows = mysql_num_rows($seasonQuery);
-
windows or linux?
-
unsupress your fopen command (remove the '@'), then look for an error
-
Be careful about sending 2 headers
-
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;
-
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.
-
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!)
-
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();
-
I don't see a <form> element in your html that states your method
-
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
-
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
-
PHP SOCKET SERVER CANNOT SEND MESSAGE TO THE CLIENT
TreeNode replied to owned's topic in PHP Coding Help
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. -
Looks right, there are other ways of course.
-
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).
-
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.
-
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
-
I want the 10th to 20th items (ordered by date)
TreeNode replied to essjay_d12's topic in MySQL Help
SELECT * FROM someTable ORDER BY theDate ASC LIMIT 9, 10 -
The session and its data is tied to the URL
-
also just in case... $username = trim($username); $password = trim($password);
-
$stampName = $stampName[$tn]; Notice the BIG N. Also, you might not want to overwrite your array with a single variable.
-
Using "value = <?print $listbox; ?>" on forms?
TreeNode replied to Solarpitch's topic in PHP Coding Help
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.