Jump to content

mikosiko

Members
  • Posts

    1,327
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mikosiko

  1. I really doubt that you have a field named "$taskvalue" in your table $query = "UPDATE membertable SET $taskvalue = 'done' WHERE id = $memberid";
  2. Hey... that link should be a sticky around here .... welcome
  3. other alternative UPDATE hotels SET est_postcode = CONCAT(LEFT(est_postcode,char_length(est_postcode) -3),' ',SUBSTR(est_postcode,-3)) WHERE INSTR(est_postcode,' ') = 0
  4. very unlikely... the only way to do it is if you have in your php files: - The query to re-create your DB schema (unlikely, but could be done manually). - The queries to re-create your TABLE(s), INDEXES, and any other object that you used in your DB Schema. (unlikely, but possible) - The queries with the all the INSERT's necessarily to re-create your last valid data for each TABLE (very unlikely, but maybe no data could be an acceptable option) Moral: Always take backups
  5. Yes... incomplete FOREIGN KEY constraint http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html
  6. if ( _ERROR_VERBROSE_ === 1 ) it is typo here? VERBROSE or VERBOSE?
  7. here is a good place to start working on your problems http://php.net/manual/en/language.functions.php
  8. you are not naming your table province in the select, but just making reference to one of it fields, hence the error.
  9. just a note... even when LIMIT will work you normally should use a WHERE clause to specify exactly the scope of your sentence
  10. +1 with xypt comments... and the code below, that you have in one of your scripts explain why you didn't answer correctly in the post that you have in MYSQL forum mysql_query("INSERT INTO customers (fname, lname, address, city, state, zip, phone, fax, email, re_enter_email, payment_Method, paypal_username, ship_first_name, ship_last_name, ship_address, ship_city, ship_state, ship_zip, ship_email, ship_re_email, pet_name, age, breed, nutritional_needs, special_instructions, product_name, quantity, price, sales_tax, subtotal, shipping_cost, total) VALUES ('$fname', '$lname', '$address', '$city', '$state', '$zip', '$phone', '$fax', '$email', '$re_enter_email', '$payment', '$paypal_username', '$ship_first_name', '$ship_last_name', '$ship_address', '$ship_city', '$ship_state', '$ship_zip', '$ship_email', '$ship_re_email', '$pet_name', '$age', '$breed', '$nutritional_needs', '$special_instructions', '$product_name', '$quantity', '$price', '$sales_tax', '$subtotal', '$shipping_cost', '$total')"); mysql_query($query) or die("Query Error : " . mysql_error()); ECHO "MY query is".$query; you were told to do this: $query = "INSERT INTO customers (fname, lname, address, city, state, zip, phone, fax, email, re_enter_email, payment_Method, paypal_username, ship_first_name, ship_last_name, ship_address, ship_city, ship_state, ship_zip, ship_email, ship_re_email, pet_name, age, breed, nutritional_needs, special_instructions, product_name, quantity, price, sales_tax, subtotal, shipping_cost, total) VALUES ('$fname', '$lname', '$address', '$city', '$state', '$zip', '$phone', '$fax', '$email', '$re_enter_email', '$payment', '$paypal_username', '$ship_first_name', '$ship_last_name', '$ship_address', '$ship_city', '$ship_state', '$ship_zip', '$ship_email', '$ship_re_email', '$pet_name', '$age', '$breed', '$nutritional_needs', '$special_instructions', '$product_name', '$quantity', '$price', '$sales_tax', '$subtotal', '$shipping_cost', '$total'); echo "MY query is : ".$query; mysql_query($query) or die("Query Error : " . mysql_error()); way different.
  11. what have you tried already?... post your code
  12. in this way: echo "My raw query is : " . $query; // POST back the result of this line Where in your code are you defining the values for the variables used in this line?... echoing your raw query will show you if all of them have a valid value or not, hence if your query is valid or not. more clear?
  13. what exactly is the error? what this means? in any of your posted code I can see were are you defining the variables used here: VALUES ('$fname', '$lname', '$address', '$city', '$state', '$zip', '$phone', '$fax', '$email', '$re_enter_email', '$payment', '$paypal_username', '$ship_first_name', '$ship_last_name', '$ship_address', '$ship_city', '$ship_state', '$ship_zip', '$ship_email', '$ship_re_email', '$pet_name', '$age', '$breed', '$nutritional_needs', '$special_instructions', '$product_name', '$quantity', '$price', '$sales_tax', '$subtotal', '$shipping_cost', '$total')"; again... echo your raw query and analyze from there.
  14. are you getting any error? is any of your $_POST variables null? // in addition those should be sanitized echo your raw query and check is it is correct.... to do that move your query string out of mysql_query() $query = "INSERT INTO customers (fname, lname, address, city, state, zip, phone, fax, email, re_enter_email, payment_Method, paypal_username, ship_first_name, ship_last_name, ship_address, ship_city, ship_state, ship_zip, ship_email, ship_re_email, pet_name, age, breed, nutritional_needs, special_instructions, product_name, quantity, price, sales_tax, subtotal, shipping_cost, total) VALUES ('$fname', '$lname', '$address', '$city', '$state', '$zip', '$phone', '$fax', '$email', '$re_enter_email', '$payment', '$paypal_username', '$ship_first_name', '$ship_last_name', '$ship_address', '$ship_city', '$ship_state', '$ship_zip', '$ship_email', '$ship_re_email', '$pet_name', '$age', '$breed', '$nutritional_needs', '$special_instructions', '$product_name', '$quantity', '$price', '$sales_tax', '$subtotal', '$shipping_cost', '$total')"; //Echo raw query and check for any visible error echo $query; // execute your query string... adding at least some basic error trap mysql_query($query) or die("Query Error : " . mysql_error());
  15. Did you run OPTIMIZE in your table after the changes? http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html
  16. Only to answer your specific question and address the error that you shown: This line in your code: $id = "('" . implode( "','", $checkbox ) . "');" ; should be: $id = implode("'),('",$checkbox); after that if you echo your $sql you should see something like this: INSERT INTO <your-table-here> ( <your-field-here> ) VALUES ('value1'), ('value2'), ('value3'),..... ('value-n') ; Agree with Keith that you have design issues in your DB
  17. you need an UPDATE with JOIN..... no INSERT http://dev.mysql.com/doc/refman/5.0/en/update.html
  18. The best you can do for a start is to modify the design of your table "orders" taking all those 20 repeating elements out off there into other table ("orders_detail" maybe). Per example: ORDERS `orderid`, `firstname`, `surname`, `phone`, `email`, `address`, // address and comments shouldn't be BLOB type `comments` ORDERS_DETAIL `id` --> Auto-Increment field `orderid` // This will allow you to associate the details to the order `code` varchar(15) NOT NULL, ---> Is this the "Product" code?... if so.. the next field shouldn't be here `desc` varchar(155) NOT NULL, /// see previous note `br` int(5) NOT NULL, `pg` int(5) NOT NULL, `qty` int(3) NOT NULL, `unitp` varchar(6) NOT NULL, // unitp and tprice should be numeric and tprice could be calculated on usage.. no necessarily you must include it on the table. `tprice` varchar(6) NOT NULL after the re-design your form should be modified to: (simple description) - Capture the Order data - Capture the array of detail lines - Validate/Sanitize your data - Insert your Order record capturing and storing the LAST_RECORD_ID() of your inserted order. - Process your orders detail array, and insert them in your "order_detail" table using the LAST_RECORD_ID() stored before.
  19. RESTRICT is the default option for ON DELETE and ON UPDATE, therefore they are not included as part of the table description.
  20. this presentation posted by fenway in the "The MYSQL sticky" long time ago is a must to be read... around slide 48 and up apply to your case, specifically slide 68 to 77 show and explain a third alternative "Closure Table" http://www.slideshare.net/billkarwin/sql-antipatterns-strike-back hope that help
  21. Yes you did... but is ok.. I do understand your frustration... been there many times myself. good to know that you found the solution
  22. Huh?... what?.... posting your real tables description (the relevant part) and some data and your expected output should help to those that could try to help you
  23. gotcha... I was thinking in a per-user photo gallery... I see now that you are implementing a general photo gallery independent of the user.. the 1st solution is adjusted to that scenario. +1 with the 2 columns Keith's suggestion for the images table
  24. In your case I will design your table images with 3 columns image_id, filename, status (null=active or 1=deleted)... that will make the queries simple
  25. read http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format and look what you wrote
×
×
  • 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.