mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
Getting count of how many different data there is on a mysql database.
mikosiko replied to 00stuff's topic in PHP Coding Help
I did edit my previous answer... check it again -
Getting count of how many different data there is on a mysql database.
mikosiko replied to 00stuff's topic in PHP Coding Help
that is a csv file not your table description with column names, type, size ,etc..etc have your tried your code without that "and $product_count < 3" ?? -
Getting count of how many different data there is on a mysql database.
mikosiko replied to 00stuff's topic in PHP Coding Help
post your inventory_file table exact definition -
are you looking to return the product that have exactly the same attributes (nothing more, nothing less)?
-
Maybe you can use LOAD DATA INFILE to load the data in your table instead of read the file with PHP (assuming that, as gizmola said, you have a defined table in you db to hold the information).
-
just checking.... did you use the code like this: $a[$j] = mysql_fetch_object($result)->predicted; // assuming that "predicted" is a field name in your table users.. // otherwise replace it for a valid fieldname.. I would say that you should want to replace it for "voornaam". or did you changed "predicted" for the field that you want? (assuming "predicted" is not one of your table fields of course).. beyond that... you should debug your code to validate if your query is effectively returning data... - Modify this lines adding the commented lines $query = "SELECT * FROM users WHERE voornaam ='$q%'"; $result = mysql_query($query) or die('Query1 failed: ' . mysql_error()); $totalRows = mysql_num_rows($result); // add this line and check what do you get. echo "Rows Returned : " . $totalRows; for ($j=0; $j<$totalRows; $j++) { $a[$j] = mysql_fetch_object($result)->predicted; } // dump your array to see what do you got var_dump($a);
-
and even implementing Zanus suggestion the issues pointed-out by requinix in your other thread still unsolved... what he was suggesting was to replace this part of your code: for ($j=0; $j<$totalRows; $j++) { $a[$j] = mysql_fetch_row($result); } for this for ($j=0; $j<$totalRows; $j++) { $a[$j] = mysql_fetch_object($result)->predicted; // assuming that "predicted" is a field name in your table users.. otherwise replace it for a valid fieldname.. I would say that you should want to replace it for "voornaam". }
-
use for both tables: SELECT * FROM `trade-adverts` WHERE type IN ('standard', 'premium') AND categoryid = 1 AND live = 1 AND approved = 1 AND dateexpired >= '".$todaysdate."' ORDER BY id DESC SELECT * FROM `adverts` WHERE type IN('standard', 'premium') AND categoryid = 1 AND live = 1 AND approved = 1 AND dateexpired >= '".$todaysdate."' ORDER BY id DESC now if you want to combine both tables in just one query you have to use a JOIN between them using the PK - FK in case both tables are related or use a UNION if they are not.
-
other option (better IMHO): SELECT invoices.* FROM invoices LEFT JOIN jobs ON invoices.jobRef = jobs.id WHERE jobs.id IS NULL
-
options: - If you know the attributes that you are looking for the select should be: SELECT * FROM ProdAts WHERE Attribute IN = (45,23, etc..etc); - if you want to know which attributes are in more than one product: SELECT attribute, count(id) FROM ProdAts GROUP BY attribute HAVING count(id) > 1 - if you want to get a list of the products associated to each attribute (list could be exploded at display time) : SELECT attribute, GROUP_CONCAT(product) AS productlist GROUP BY attribute - if you don't want a list: (no tested in my side but should work) SELECT a.attribute, a.product FROM ProdAts a WHERE a.attribute IN (SELECT attribute FROM ProdAts GROUP BY attribute HAVING count(attribute) > 1) ORDER by a.attribute;
-
seems that you don't have any index in your table users_profile... you should have at least one on the column user_id
-
ok... you want the short answer... NO
-
that was covered in the first part of my first answer UNION and JOIN are 2 different animals... use one or other is going to depend on your objectives (and we don't know them yet)
-
and?... what the EXPLAIN plan say?
-
Huh?... don't follow.... performance issue?... what the EXPLAIN plan say?... indexes involved?
-
post your table description
-
wait a second... I just read this in your post: file should be in the server side
-
In Windows I normally use either: "C:\\Documents and Settings\\my_comp_name\\Desktop\\my_file_name.ext" (double \ to scape the interpretation) or "C:/Documents and Settings/my_comp_name/Desktop/my_file_name.ext" both options work for me
-
you have at least this options: - Drop the file in the same directory where PhpMyAdmin is installed or - Indicate the full path to the file in the command.... like : LOAD DATA LOCAL INFILE '<full path to the file>'... etc..etc (I personally prefer this option)
-
DROP EVENT player_update; and also you can disable the EVENT scheduler SET GLOBAL event_scheduler=OFF; (or 0)
-
as I said... if you executed those 2 codes one after the other the first one should remain active and 2nd one will give you an error (assuming that you are connecting to Mysql with the same user in the same DB). suggestions: - You should activate the EVENT scheduler using mysql configuration file (activate it just one time in one place). - You should create your EVENTS only one time using any GUI that you are familiar with (PHPMYADMIN, MYSQL-WORKBENCH are some options) - Thereafter you can use ALTER EVENT syntax in case that you need to modify your EVENT definition or change its STATUS (enable or disable it) read the link that I did provide for you in my 3rd post.
-
guessing.... you created your first script version saying: <?php mysql_query ("SET GLOBAL event_scheduler = 1"); mysql_query("CREATE EVENT player_update ON SCHEDULE EVERY 5 MINUTE DO UPDATE player SET ShipYard = 5");?> right? then you updated your code to say: <?php mysql_query ("SET GLOBAL event_scheduler = 1"); mysql_query("CREATE EVENT player_update ON SCHEDULE EVERY 2 MINUTE DO UPDATE player SET ShipYard = 1");?> and executed it again... right? if so... your second code should have gave you an error saying "The event player_update already exists"... which probably you didn't see it because you don't have the error reporting active in your code (include the 2 lines in my signature after your <?php line and you will see the error) .,.. therefore the original event (update every 5 second) still active.
-
in your EVENT creation code you are not specifying when the event should STARTS... therefore it is executed upon creation and should be executed thereafter depending on the EVENT's definition. check the EVENT syntax post your current code and what exactly are your objectives for further help
-
How to upload excel file to mysqul with a html/php form.
mikosiko replied to 00stuff's topic in PHP Coding Help
One option : save the excel data as a CSV file and then use LOAD DATA INFILE sentence... I don't see why you should need a form to load the data... maybe to further display/modify but not for loading. -
that means that the EVENT scheduler wasn't enabled to begin with... plus the syntax error (in case that one was not a typo)