Jump to content

mikosiko

Members
  • Posts

    1,327
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mikosiko

  1. will be better to use a LEFT JOIN between both tables and filter when tbl_processed.id is null
  2. did you test the provided query?
  3. if you post your tables, some real data covering all your scenarios and expected results sure somebody could be give a more accurate answer... seems that your are looking to produce a PIVOT (or Crosstab) report... for that there are tons of examples if you google for them, all with different degrees of complexity... you must find the one that serve your goals best and test/implement it. in the meantime and having in mind only the information available (therefore the solution could not be exactly what your need) you could try this... sure it could give you more than one idea to solve your issue SELECT lo.location, GROUP_CONCAT(pd.dates ORDER BY pd.dates) AS TheDates FROM locations AS lo LEFT JOIN pudates AS pd ON lo.id = pd.locationid GROUP BY lo.location with this output and post process in php you should be able to get the right display Note: pay attention to the GROUP_CONCAT() limitations ... group_concat_max_len ... default 1024 but can be adjusted
  4. ask her.... maybe just provide your code and you tables schema (mysqldump) will be enough , otherwise you probably will need to host your website someplace to show it.
  5. not clear what you are asking for.... try to give a better explanation and sure somebody will offer some answers
  6. maybe this help you http://koivi.com/fill-pdf-form-fields/tutorial.php is a couple techniques explained there, scroll down until the part "Using a PDF form to allow users to fill in the data." ... that is an example for what are you looking for basically you need: - A PDF file with dynamic fields and actions - A way to display that PDF to your users ... one restriction that you could find is if your users don't have a pdf viewer integrated in their browsers to display it on-line. - in case that the user is capable to view and fill the pdf in their browser you will need a script to capture and process the data (the script is defined inside of the pdf file) good luck
  7. many times GROUP BY ... WITH ROLLUP could be used too... http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html
  8. to start check for syntax error on this lines... echo your $sql to see. ... //Use data to insert into db $sql = sprintf("INSERT INTO gifts_tbl (player_id) VALUES ('%s)", mysql_real_escape_string($name) ); ...
  9. not sure which is your last code... but looking this part or the code in your first post.... .... //LOOP TABLE ROWS while($row = mysql_fetch_assoc($result)){ echo "<tr ".$tr_class.">\n<td><a href='remove_rec.php?id=". $rows['ID'] . "'><p>Delete</p></a>"; echo "</td>"; .... don't you see the evident error? .... your resultset name is $row not $rows , hence $rows['ID'] doesn't have any value
  10. so.. everyone here won a free party ticket? OT: just curiosity... "pinchará" is a regular word in that business or just an inaccurate translation?
  11. quick and untested... enough for you to work on any error... pay attention to the comments, and also I will suggest to enable the ON DELETE constraints at least if you want to maintain automatic referential integrity, otherwise you must implement it manually yourself. <?php define('DB_NAME', 'mjornsen_kontakt'); define('DB_USER', 'mjornsen_*****'); define('DB_PASSWORD', '*******'); define('DB_HOST', 'localhost'); $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if (!$link) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db(DB_NAME, $link); if (!$db_selected) { die('Can\'t use ' . DB_NAME . ': ' . mysql_error()); } // you MUST sanitize your $_POST variables before to use them in any query to prevent sqlinjection: // things to look at: trim(), type cast, validation (email the obvious one), mysql_real_escape_string().. full of examples in this forum $value = $_POST['name']; $value2 = $_POST['ename']; $value3 = $_POST['email']; $value4 = $_POST['firma']; $value5 = $_POST['melding']; // First insert the firma record because your person table has a FK to it $sql3 = "INSERT INTO firma (firmanavn) VALUES ('$value4')"; if (!mysql_query($sql3)) { echo('Error Inserting Firma Record: ' . mysql_error() . ' SQL : ' . $sql3); exit(); // to prevent the script to execute any further } // Get the last_id from the previous successful insert on firma table $firmaid = mysql_insert_id(); // and then use it to insert the person's record $sql = "INSERT INTO person (fornavn, etternavn, email, firmaid) VALUES ('$value', '$value2', '$value3', $firmaid)"; if (!mysql_query($sql)) { die('Error Inserting a Person Record: ' . mysql_error() . ' SQL : ' . $sql); exit(); // to prevent the script to execute any further } // Get the last_id from the previous suscessfull insert on person table $personid = mysql_insert_id(); // and then use it to insert the henvendelser record // Notice that here you are not including your field `date`, it is declared as NOT NULL in your table, therefore you should provide a value. $sql2 = "INSERT INTO henvendelser (id, melding) VALUES ($personid,'$value5')"; if (!mysql_query($sql2)) { echo('Error Inserting a henvendelser Record: ' . mysql_error() . ' SQL : ' . $sql2); } mysql_close(); ?>
  12. the error means that you are trying to insert a record in your table henvendelser but you are not providing the person id to whom that record belong... you must use mysql_insert_id() to get that id after you insert a person (same logic apply to your table firma) http://php.net/manual/en/function.mysql-insert-id.php include usage examples
  13. show the EXPLAIN of your time consuming SELECT before to go any further
  14. post your current query and the relevant code that use it here ... are you running that query in a loop?
  15. if partitioning as PFMAbismad suggested is not an option for you (most likely it should), then could you explain exactly why you are worry about this "records separation"?; 800,000 records is nothing... are your queries slow? (show them if that is the case)... assuming that you have the right indexes in your table, you shouldn't have problems with it if your queries are written correctly ... what define is your records are active or not? if you provide more information about your issue and goals people here could give you more targeted/accurate advice
  16. In the mean time... Did you modify the phpmyadmin config.default.php or the config.inc.php (if any) as the documentation suggest?... and if you did that... did you restart Apache after that? In other note... Have you tried MYSQL Workwench?.... http://www.mysql.com/products/workbench/ it is a much better option than the one that you have now.
  17. this are 2 lines in your posted code: mysql_select_db("fathersh_childsearch", $con); @mysql_select_db($database) 'or die ("Unable to select database: " . mysql_error())" seems ok to you? ... mysql_select_db() twice? and the second with more than evident errors?
  18. yes... http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html other suggestions: - is always a good idea to echo your raw sql (echo $query3) to debug your code. - don't use the error suppressor character (@) that only hide possible errors... don't hide them.. control them. - try to be consistent in the usage of Logical Operators (use AND, OR .. or && and ||) mixing them doesn't look good; even when is not a mistake per se, just a matter of coding habits.
  19. there is not such thing. what the EXPLAIN of that sentence shows? are there indexes defined for both tables?... which ones?
  20. assuming that you already have created the table, then to upload your comma delimited data on it you simply can use LOAD DATA INFILE usage and examples here http://dev.mysql.com/doc/refman/5.1/en/load-data.html
  21. did you try to run myisamchk over the table?... results?... what else have you tried? this could be helpful http://www.techrepublic.com/article/checking-and-repairing-mysql-tables/5193721
  22. http://dev.mysql.com/doc/refman/5.0/en/show-create-table.html
  23. table description.. or definition or structure or whatever you want to call it... that sentence starting with... CREATE TABLE <table_name> etc...etc...tc...
  24. Mysql version? storage engine for the table? (Myisam , Innodb...) , table description (full create table)? a quick google search shows severals answers... from reported bugs (could be old) to some workarounds depending on conditions... examples: http://www.progtalk.com/viewarticle.aspx?articleid=2281 http://bugs.mysql.com/bug.php?id=5686 // around the end of the multiples posts is one possible workaround good search
  25. well.. among other issues there is not DELETE in the posted code
×
×
  • 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.