Jump to content

Barand

Moderators
  • Posts

    24,345
  • Joined

  • Last visited

  • Days Won

    795

Everything posted by Barand

  1. Barand

    Join

    on t4.schedule.date > '$today' WHERE t1.schedule.date < '$week' "; ^ ^ | |
  2. Barand

    Join

    Probably because of query errors. Check what $conn->error contains. Are you sure about the last join and the where condition?
  3. That you were not making it clear was a statement of fact. It was not a statement of blame that it was deliberate, rather one of inadequacy. You gave us four tables and claimed that the hierarchical relationship was obvious. Well, without indicating the relationships between those tables, it wasn't. In the tables you have "aid" and "mid" columns, which look like foreign keys, but your inadequate naming convention gave absolutely no clues about what they referenced. And your pyramid diagram was a complete mystery until you later told us what it represented. Until then we had to guess. Plus there are other mysteries in there that Benanamen has indicated.
  4. Glad you dropped by this thread, Jacques. Can you explain to us (ajoo isn't making it very clear) how your data model shown in reply#22 above implements the required checks and constraints for this process?
  5. Not a facility I have ever used but is this what you are looking for? Settings/Run & Debug/SRV Web Server/Server mappings
  6. Sorry, I don't. You could try contacting the Support team at Nusphere.
  7. PHPEd allows you to specify POST values Select "Run/Parameters" from the menu and enter the parameter names and values with type=post. Run the script using either the embedded IE or embedded Mozilla browsers (doesn't work with with embedded Chrome for some reason)
  8. That raises the question "Why are you storing the role in two different places?"
  9. Are you really sure that is what you wanted. You have two "role" columns which have the same value in the output. I suspect they had different input values before the joins. Change the alias name.
  10. Probably, but we do not know what you are trying to do. We only know your attempted solution, which is failing. And, as benanamen requested, we don't have your data
  11. GROUP BY role will give you a single row for each role. As you have two rows in each role, that single grouped role record can only contain one of the ids (usually the first, but not guaranteed to be). This will explain why you only get matches on ids 94, 97, 98 when the group by is used in the second subquery
  12. Without knowing the structures of the three tables I couldn't comment. If the three structures are identical then that would flag a problem. The presence of a UNION keyword is insufficient evidence on its own. There are valid reasons for using UNION - that's why it exists. Consider a college scenario. Two tables, pupil and lecturer. In the event of a fire in one of the buildings, the fire department asks for a list of names of who is scheduled to be in the building. There is going to be union in there somewhere.
  13. What is the output from the bb subquery? You have only shown us the cc subquery half of the join.
  14. That is way the two types of join are meant to work. A INNER JOIN B returns only rows where there is a match on the join condition in both A and B A LEFT JOIN B returns all rows from A with any matching data from B. If there is no matching B row then columns from B contain NULL
  15. If you are expecting only one row then you already fetched it with $count=odbc_fetch_array($result); By the time you get to the while() loop there are no more left to fetch.
  16. Use a for() loop, and make $page an array.
  17. Erm, if it really were egregious then you wouldn't miss it
  18. Not pretty, but it works (I think). You can use sub-elements of this solution to break down that single column into three columns in your redesigned table, viz. prestring quantity poststring Data mysql> select * from tablea; +----+-------------------------------+ | id | col_a | +----+-------------------------------+ | 1 | Lorem ipsum = 88 dolor | | 2 | De profundis = 102 clamavi | | 3 | matutina usque ad = 55 noctem | +----+-------------------------------+ Query and results: UPDATE tablea SET col_a = CONCAT ( SUBSTRING_INDEX(col_a, '=', 1) , ' = ' , SUBSTRING_INDEX(TRIM(SUBSTRING_INDEX(col_a, '=', -1)), ' ', 1) + 1500 , ' ' , SUBSTRING_INDEX(TRIM(SUBSTRING_INDEX(col_a, '=', -1)), ' ', -1) ) ; mysql> select * from tablea; +----+----------------------------------+ | id | col_a | +----+----------------------------------+ | 1 | Lorem ipsum = 1588 dolor | | 2 | De profundis = 1602 clamavi | | 3 | matutina usque ad = 1555 noctem | +----+----------------------------------+ 3 rows in set (0.00 sec)
  19. All you have shown us is a single line of incorrect code and I pointed out what is wrong with that code. You could try <option value="0" <?php if ($_POST['special'] === '0') echo 'selected'; ?> >None</option> On the basis of a single line I can not and will not comment on an application solution, as I have no idea what the significance of the "0" versus "" is in the overall context. But your proposed alternative sounds wrong.
  20. that's because zero is considered to be "empty" eg $a = 0; if (empty($a)) echo 'ok'; //--> ok
  21. Create a table of areas and another for zipcodes. In the zipcode table, include the area_id to group the zips into the areas. Create a forecast for the area. Select which zipcodes that forecast applies to and save. If it isn't all zips in the area then create another forecast and select zips. Repeat as necessary. +-------------+ +-------------+ | area | | zipcode | +-------------+ +-------------+ | area_id |------------------------+ | zip | | name | +-----------------<| area_id | +-------------+ +-------------+ | | | | | | | +-------------+ +---------------+ | | | forecast | | applies_to | | | +-------------+ +---------------+ | | | forecast_id |----------<| forecast_id | | +---<| area_id | | zip |>---------+ | date | +---------------+ | text | +-------------+
  22. I'd make a couple of changes move the WHERE condition to the JOIN condition for the answer table use a LEFT join for the txtanswer table SELECT question.*, question_options.*, answer.*,txtanswer.* FROM question LEFT JOIN question_options ON question.question_id = question_options.question_id LEFT JOIN answer ON answer.option_id = question_options.qtn_option_id AND answer.empid = 'EMP8969' LEFT JOIN txtanswer ON txtanswer.qtn_option_id= question_options.qtn_option_id And don't use *s in the SELECT, specify the required fields.
  23. It sets the value after checking if it has changed $curname = $sn; pseudocode: set curname to empty while fetch next record if name value changed if we have a current value output the data for the current name endif set curname to new name value endif process the new record endwhile
  24. Hi Newbie, You are also incapable of working out that my name in my posts is in exactly the same place as your name is in your posts. (Strange, but true.) $curname stores the current name. I then test the value of the new name against to see if it has changed, and then store the new value in $curname.
×
×
  • 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.