mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
take a look here for my answer and adjust your code accordingly: http://www.phpfreaks.com/forums/index.php?topic=325652.msg1534675#msg1534675
-
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.
-
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
-
Error: Commands out of sync; you can't run this command now.
mikosiko replied to hitech123's topic in MySQL Help
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) -
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
-
telepathy or the magic crystal ball doesn't work today.... post your code
-
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
-
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
-
@Keith your query doesn't solve what the OP requested in his first post, which was:
-
I strongly recommend you to read how SQL JOINS work..
-
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
-
@punk_runner Your design is correct imho, and should be the one that give you the most flexibility
-
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?
-
How to import a comma seperated values file to a mysql table - please help
mikosiko replied to geroid's topic in MySQL Help
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 -
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
-
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
-
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
-
My code is not doing the result I want it too
mikosiko replied to new_webmaster's topic in PHP Coding Help
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. -
did you try: .... FROM rooms LEFT JOIN visit_data ON rooms.room = visit_data.room AND visit_data.areaid = 'ED' WHERE rooms.areaid = 'ED'
-
.... 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) }
-
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...
-
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
-
Did you test changing those DEPENDENT SUBQUERYS for JOINS ?
-
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