Jump to content

Barand

Moderators
  • Posts

    24,563
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. So where is your problem?
  2. I'd recommend using a DECIMAL type for currency rather than FLOAT e.g. price DECIMAL(10,2) so you have a fixed number of decimal places.
  3. Consider it a good staring point for the final model. Models tend to evolve as development of the project progresses.
  4. What have you tried so far?
  5. The relationship between order and and product is via orderItem
  6. +--------------+ +--------------+ +----------------+ | product | | product_type | | order | +--------------+ +--------------+ +----------------+ +---| product_id | +---| pType | | orderID |--+ | | pName | | | typedescrip | | memberID | | +------------------+ | | pType |>--+ +--------------+ | orderDate | | | order_item | | | pDescription | +----------------+ | +------------------+ | +--------------+ | | order_item_id | | +---<| orderID | | | productID |>---+ | qty | +------------------+
  7. Product_type -1----------< Product ie One to Many +--------------+ +--------------+ | product | | product_type | +--------------+ +--------------+ | product_id | +--------| pType | | pName | | | typedescrip | | pType |>------+ +--------------+ | pDescription | +--------------+ While I'm here, your members table needs a memberID as its primary key otherwise you have nothing to join on. Your model allows only single product per order - it that what you want?
  8. No "old farts" that I am aware of.
  9. Possibly. How can I know? Syntax is OK.
  10. You'll find that serializing data it not used very much these days, largely abandoned in favour of JSON data $data = [ 'count' => 1, 'total' => 5, 'average' => 5 ]; echo "Serialized: " . serialize($data); echo "JSON: " . json_encode($data);; gives Serialized: a:3:{s:5:"count";i:1;s:5:"total";i:5;s:7:"average";i:5;} JSON: {"count":1,"total":5,"average":5}
  11. So just, for example, "SELECT id,name, email FROM ..." so you only retrieve what you need. That's why you shouldn't use "SELECT * " in queries as that retrieves every column, need it or not, and slow your queries. [EDIT] PS That's one of the reasons not to use SELECT *.
  12. It seems reasonable to me, given the initial caveat.
  13. You say all but only select a single item. And you don't have a submit button! Where is the $iditemm value coming from? No idea - where is it supposed to come from?
  14. while (($p1 = strpos($str, 'S', $p2)) !== false) { // while there is a next 'S', get its position $p2 = strpos($str, 's', $p1); // find position of following 's' if ($p2===false) { // if there is no following 's' $p2 = strlen($str); // assume its position is the end of the string } echo substr($str, $p1, $p2-$p1+1) . '<br>'; // echo the characters between the S and s }
  15. Store the test dates - that will tell you who got there first.
  16. You'll affect performance more, and complicate the queries, by splitting your users across more than one table. It would also break a rule of DB design - don't store derived data
  17. +-----------+ | user | +-----------+ | user_id |--------+ | name | | | email | | +-----------------+ | phone | | | answer | +-----------+ | +-----------------+ | | answer_id | +----0<| user_id | | question_no | | selected_choice | +-----------------+ One user table. Query to find which answered 4 questions SELECT u.user_id , u.name FROM user u JOIN answer a USING (user_id) GROUP BY u.user_id HAVING COUNT(answer_id) = 4
  18. Is there any chance that you might answer that question sometime soon? (At my age an fear I am running out of the time needed to get you thinking about what your code is doing)
  19. There is an absence of DB query code in anything you have posted and you have not explicitly stated the origin of all those values that you are passing in the query string ($_GET data), so here is my guess... Does $_GET['did_ivr_disable'] contain the value from the database that you need? Or have you not thought about it?
  20. If you always set it to zero, what other result do expect? I did say that it should be the value from your DB.
  21. I'm equally sorry that we are new to telepathic communication and so have no idea what your code is that is giving the result below. Did you implement the method I showed you?
  22. That must be annoying.
  23. Exactly. As I said, determine which button needs to be shown as selected if the value in the database is 0, then the 0 button needs to be "checked". if the value in the database is 1, then the 1 button needs to be "checked". Example $currentValue = 0; // from DB $chk0 = $currentValue==0 ? 'checked="checked"' : ''; $chk1 = $currentValue==1 ? 'checked="checked"' : ''; echo "<input type='radio' name='myradio' value='0' $chk0> No &emsp; <input type='radio' name='myradio' value='1' $chk1> Yes";
  24. Determine which button needs to be shown as selected and set its "checked" attribute
×
×
  • 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.