Jump to content

toplay

Staff Alumni
  • Posts

    973
  • Joined

  • Last visited

    Never

About toplay

Profile Information

  • Gender
    Not Telling

toplay's Achievements

Member

Member (2/5)

1

Reputation

  1. If you're not doing it yourself (i.e. addslashes), then check your PHP magic quotes setting. See below. "If magic_quotes_runtime is enabled, most functions that return data from any sort of external source including databases and text files will have quotes escaped with a backslash." http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime http://www.php.net/manual/en/function.set-magic-quotes-runtime.php
  2. What do you mean by "nothing"? An empty string is not considered a NULL value. An empty string and a NULL value are two different values. If you don't want to allow empty cells, then I suggest you code for it (validate data before inserting/updating table(s)). Good luck.
  3. It's clearly documented in the manual found here: http://us2.php.net/manual/en/function.mysql-fetch-array.php It specifies that an associative array be returned (instead of a numeric index). EDIT: Mchl beat me to it.
  4. This is a very specific question on how to go about clearing PHP memcache area from within MySQL stored procedures/functions. I'm not sure if it's possible or not. I'm using PHP 5+ and MySQL 5+. The PHP memcache works fine. I can also use the MySQL memcache to set, get and delete it's own keys within MySQL fine. I'm setting the servers (IP's) used for caching the same on the PHP and MySQL side. However, the problem I'm having is trying to delete a memcache (key) that was created from PHP using MySQL stored procedure and it doesn't delete it. I know what the PHP key is, but when I use it in a SELECT memc_delete('key here'); it returns an integer of 16 and doesn't delete the PHP cache associated with that key. It's like as if the PHP and MySQL caching mechanism have their own specific areas of memory (for caching) even though they both have the same caching server IP's set. Any pointers/help would be appreciated. Thank you. FYI: http://dev.mysql.com/doc/refman/5.0/en/ha-memcached-interfaces-mysqludf.html http://us2.php.net/manual/en/ref.memcache.php
  5. jrws, on the first page load $_POST['submit'] is not set, so it will execute the "else" logic which displays your echo. You want to put that error check/message inside the first 'if' condition after checking if the post variables are empty and display an appropriate error for that. When they're not empty you do the query and if the query fails then give error of login/pswd not good. See now? EDIT: ShaunO beat me to it.
  6. Why do you think it's not working? What is the expect result you want/expect? Sample below is from manual: $result = mysql_query($query); // Check result // This shows the actual query sent to MySQL, and the error. Useful for debugging. if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); }
  7. It gives the error message because you're using a lowercase 's' in submit for the name in the form. Change this: if(isset($_POST['Submit'])){ to this: if(isset($_POST['submit'])){ so it matches your form "name" value: <input type="submit" value="Submit" name="submit" />
  8. You should check for errors after the query to see what's wrong. However, I think it's because "count" is a reserved word in MySQL, so change the column name to something else, or enclosed in backtick marks like this: $query = "UPDATE trk_tracking SET `count` = `count` + 1 WHERE id = " . $totalAds[$counter];
  9. Since you're using just $counter in the "where" clause it will only update id's 0 (which is invalid if ID is an auto increment column) through 11. The variable that you show as containing the array of id values is what you should be using. For example: $query = "UPDATE trk_tracking SET count=count+1 WHERE id = " . $myArray[$counter]; You show 24 values (0-23) in your array, so the "for" loop needs to iterate through that number of entries. For example: for ($counter = 0, $max=count($myArray); $counter < $max; $counter++) { } hth and good luck.
  10. Just put an 'if' before the echo of which ID you want to display. Example: $id_looking_for = 1; // run the query: select * from table_name order by `score` desc // check for errors $rank = 0; while ($row = mysql_fetch_array($result)) { $rank++; // adds 1 if ($id_looking_for == $row['id']) { echo 'Rank: ', $rank, ' Score: ', $row['score']; // put HTML break to end line break; // get out of loop } }
  11. Remove the comma after p_s column. Change this: `p_s`, ) to this: `p_s`)
  12. // run the query: select * from table_name order by `score` desc // check for errors $rank = 0; while ($row = mysql_fetch_array($result)) { $rank++; // adds 1 echo 'Rank: ', $rank, ' Score: ', $row['score']; // put HTML break to end line }
  13. Use this query: select * from table_name order by `score` desc and as you read each row from the table keep a counter and use that to display the ranking.
  14. I follow you on the first part, but lost you on the second part. select * from table_name order by `score` desc or maybe you mean: select * from table_name where `id` = 'x' order by `score` desc # Assuming multiple rows returned Be a bit more clear when posting. Thanks.
  15. LOL ... you're kiddin right? Once again, that's what the "type" column is for in my example!
×
×
  • 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.