Jump to content

mikosiko

Members
  • Posts

    1,327
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mikosiko

  1. take a look here for my answer and adjust your code accordingly: http://www.phpfreaks.com/forums/index.php?topic=325652.msg1534675#msg1534675
  2. IMHO... wrong approach.... according to the scenario that you described your application is not running fine... 30,000 records shouldn't be causing the problems that you mention neither your "server"... personally I will focus in: - Review your Data Model design (bad design could be lead to inefficient SQL's among other things) - Review your Table/Views/etc design - Review your Index strategy and selectivity - Isolate and test your problematic SQL's (Explain/Profiling) your 20 minutes report issue is based on some of these factors most likely imho.
  3. probable explanation: http://bugs.mysql.com/bug.php?id=29087 there is a patch published.... also check if you have a record with "username" containing a blank space at the end. fenway gave you a very good advice regarding varchars/PK's
  4. try changing this portion in you code: to this one: mysqli_free_result() is not the solution... error is due to the fact that any stored procedure potentially return more that one resultset (one being just a execution status), therefore you MUST USE/DUMP all the resultsets before call/execute other SQL sentence, otherwise you will get the indicated error (out of sync)
  5. triggers doesn't work in a way that allow you to do what you are asking for... worth to read: http://dev.mysql.com/doc/refman/5.0/en/triggers.html and be sure to read this too: http://dev.mysql.com/doc/refman/5.0/en/stored-program-restrictions.html
  6. telepathy or the magic crystal ball doesn't work today.... post your code
  7. I agree with Pikachu... backticks??..... depend to whom you ask.... in my case... I will say... DEPEND... if you are designing/programming ONLY for MYSQL worth to be in the safe side and use the backticks... but if you are programing to eventually point to a different DB (different SQL) then backticks will be a PITA... personally I never use them and apply extra caution to choose my tables and field names. just my 0.2cents
  8. If I understood correctly your problem I believe that you are extremely over thinking the problem/solution... but just to be sure why you don't post: - Real data example of your Transaction table. - Real data example of your Transaction_Banco table (choose records related to Transaction) - Real data example of your Transaction_Tracker table (choose records related to Transaction) -and finally using the posted data required before post the data output that you want to have. that way we can clarify better the problem and help you more. BTW: Those select look very nasty to me
  9. @Keith your query doesn't solve what the OP requested in his first post, which was:
  10. I strongly recommend you to read how SQL JOINS work..
  11. no, is not..... most likely the field doesn't have exactly 'bat.zip' on it.... use Like with wildcard http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_like
  12. @punk_runner Your design is correct imho, and should be the one that give you the most flexibility
  13. Hmmm... if you have the USER GENDER available before show him/her pictures is not as simple as do this: SELECT * FROM user_pictures WHERE picture_type='1' AND user_gender_pic != $UserGender AND picture_status='1' ORDER BY RAND() LIMIT 10 been $UserGender ... well... is obvious what should be right?
  14. the best way is using LOAD DATA INFILE read description here http://dev.mysql.com/doc/refman/5.0/en/load-data.html you could run the command twice... first time just IGNORE 5 lines... second time... for you to figure it out
  15. the first select that you have seems to be correct..... few days ago I did answer a question almost identical as yours.... look here http://www.phpfreaks.com/forums/mysql-help/problem-with-multiple-result-sets/ and look for the code I did provide
  16. I will bet that your problem is here $query = " INSERT INTO `gume`.`korisnik` (`id`, `korisnicko_ime`, `lozinka`, `ime`, `prezime`, `adresa`, `grad`, `postanskiBroj`, `fiksni_telefon`, `mobilni_telefon`, `email`) VALUES (NULL, '$username', '$hashed_password', '$ime', '$prezime', '$adresa', '$grad', '$postanskiBroj', '$fiskni, $moblini', '$email' )"; .... look here: '$fiskni, $moblini' that should make your INSERT to fail.... and because in your next line $result = mysql_query($query, $connection) or die(mysql_error); you are using the mysql_error() function incorrectly... the script just die... no error message at all
  17. for further analysis/help I suggest you to post: - Your Table description including all the indexes definition. - Your problematic queries - The explain plan for each one
  18. where is defined the index $city['cityid'] that you using here $adcount = 0+$city_adcounts[$city['cityid']]; ? and if it is defined in another place of your code (no showed) then... is the value matching some of the cityid's that your select get? also ... you are not showing how the "echo $adcount" part fit in the rest of your code, hence you also could have that variable out-off-scope.
  19. you can try in "Settings" -> "Preferences" -> "New Document/Default Directory" -> Encoding and choose "UTF-8 without BOM"
  20. did you try: .... FROM rooms LEFT JOIN visit_data ON rooms.room = visit_data.room AND visit_data.areaid = 'ED' WHERE rooms.areaid = 'ED'
  21. .... here is an small and very simple to caught fish... $sql = "SELECT Ques_Text, Ans_Text FROM Questions NATURAL JOIN Answers"; $result = mysql_query($sql) or die("Query Error : " . mysql_error()); $old_Ques = ''; // Variable to Hold the LAST DISPLAYED Quest Value while ($row = mysql_fetch_array($result)) { if ($old_Ques != $row['Ques_Text']) { // Condition to DISPLAY or not the QUEST echo "<br /> Question : " . $row['Ques_Text']; $old_Ques = $row['Ques_Text']; } echo "<br />Ans : " . $row['Ans_Text']; // DISPLAY the remaining field(s) }
  22. the select that you are showing is the right one... important thing is how you DISPLAY the information... display is just a matter of simple logic.... I've seen/give several examples answering the same question here before.... just search...
  23. mikosiko

    Delete all

    not clear if you want to: - delete all the records from one table or - delete the database completely with all that it contains I hope you understand the difference between table and database
  24. Did you test changing those DEPENDENT SUBQUERYS for JOINS ?
  25. that is incorrect... trust me (if you can/want) or run a couple test... p.e in your PHP call your SP and after that try to execute other query (no SP)... for further discussion maybe you should post your SP and the calling code... even when you have everything figure out and working the topic could be of help for somebody else. glad to try to help
×
×
  • 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.