-
Posts
24,602 -
Joined
-
Last visited
-
Days Won
830
Everything posted by Barand
-
How to create query in log in that compares the id using php ?
Barand replied to aixen083's topic in PHP Coding Help
Which of those two fields should match the value in $id_number? (If the answer is both, why are you storing it twice?) -
How to create query in log in that compares the id using php ?
Barand replied to aixen083's topic in PHP Coding Help
Which of those two fields should match the value in $id_number? (If the answer is both, why are you storing it twice?) -
How to create query in log in that compares the id using php ?
Barand replied to aixen083's topic in PHP Coding Help
Which of your tables contains "id_number" column. You didn't mention that before (I assume that "password" and "status" are in the voters table) -
I confess I am not sure how your scoring is implemented and how it really fits into the model. Would the score be related to the work_xxxxxx tables? I agree with Psycho that those statements imply hierarchy
-
It sounds like the attached model would serve and would allow "work" definitions such as +-----------+-----------+--------------+--------+-----------+ | work_name | Division | Company | Team | Project | +-----------+-----------+--------------+--------+-----------+ | Work 1 | Southeast | | | | | Work 1 | Northwest | | | | | Work 1 | | | Team 3 | | | Work 1 | | | Team 2 | | | Work 1 | | | Team 1 | | +-----------+-----------+--------------+--------+-----------+ | Work 2 | Northeast | | | | | Work 2 | | Danish Bacon | | | | Work 2 | | Body Shop | | | | Work 2 | | | Team 3 | | | Work 2 | | | Team 2 | | +-----------+-----------+--------------+--------+-----------+ | Work 3 | | Ajax Stores | | | | Work 3 | | | | Project C | | Work 3 | | | | Project A | +-----------+-----------+--------------+--------+-----------+ All I have to do now is figure out how to get your averages from that structure
-
Perhaps this is an occasion for separate queries. How different are the tables?
-
$sql = "SELECT item_id , category , sub_category , sub_sub_category , name , price FROM items ORDER BY category, sub_category, sub_sub_category"; $res = $db->query($sql); $data = array(); while (list($id, $cat, $subcat, $subsubcat, $name, $price) = $res->fetch_row()) { $data [$cat][$subcat][$subsubcat][$id] = ['name'=>$name, 'price'=>$price]; }
-
The fields in each column should be of matching types too
-
If you do a union like that then select dummy fields in the table with less data SELECT a, b, c FROM tablea UNION SELECT x, y, NULL as c FROM tableb
-
This is the same problem you posted in your other thread. Apply the same technique I gave you there. http://forums.phpfreaks.com/topic/294644-how-to-create-query-in-log-in-that-compares-the-id-using-php/?do=findComment&comment=1505910 Or do you want us to write the code for you every time?
-
Don't try building the json string in the query. Store query results in the array structure you want then json_encode that.
-
As cyberRobot had already told him to check the file locations a couple of times before you chimed in then no biscuit this time
-
How to create query in log in that compares the id using php ?
Barand replied to aixen083's topic in PHP Coding Help
The id of the logged-in voter who wants to see the candidates in his/her organization. I have no idea how you are storing it and what your variable is but I thought that was a self-explanatory name for example purposes. -
No surprises there. If the username and password were wrong for mysqli then they will still be wrong for a PDO connection. You need to check the usernames and password on the server.
-
Your code "dies" if there is *not* an error! So you therefore echo "success" but the error gets displayed anyway Note: You can also specify the database with a 4th parameter in your connection.
-
How to create query in log in that compares the id using php ?
Barand replied to aixen083's topic in PHP Coding Help
Change it to ON c.org_id = v.org_id -
I would have thought the relation table redundant in this scenario. It look like a hierarchy +-------------+ | division | +-------------+ +------------+ | div_id |-----+ | team | | div_name | | +------------+ +------------+ +-------------+ | | team_id |-----+ | score | | | team_name | | +------------+ +-----<| div_id | | | score_id | +------------+ +-----<| team_id | | date | | score | +------------+
-
How to create query in log in that compares the id using php ?
Barand replied to aixen083's topic in PHP Coding Help
something like this SELECT c.firstname , c.lastname FROM candidates c INNER JOIN voters v USING (org_id) WHERE v.voters_id = $loggedInID -
Variable assignment: Curly braces inside question marks?
Barand replied to peterhuynh's topic in PHP Coding Help
or $message = "$nonce$token{$path}0.1buy965.45"; $path requires the {..} to prevent it being interpreted as $path0 which would be a valid variable name -
You can use the MySQL function STR_TO_DATE() to convert your dates to the correct format SELECT sale_date FROM `customer-sale` WHERE STR_TO_DATE(sale_date,'%d/%m/%Y') BETWEEN '2015-02-05' AND '2015-02-10' You can use that same function in an UPDATE query to convert your dates to the correct format. Add new DATE type column to store the correct format then UPDATE `customer-sale` SET newdate = STR_TO_DATE(sale_date, '%d/%m/%Y')
-
As you have been told by myself and mac_gyver, if an organisation has multiple courses, those courses would not go in the organisation table.
-
The set up you describes is the first in the three below. The one you probably want is the third ORGANISATION COURSE ------------ ------------ (MANY-to-ONE) org_id +----- course_id courses are org_name | course_name run by many org_description | organisations course_id >----+ ORGANISATION COURSE ------------ ------------ (ONE-to-MANY) org_id -----+ course_id organisations org_name | course_name run many org_description +----< org_id courses ORGANISATION ORG_COURSE COURSE (MANY-to-MANY) ------------ ------------ ----------- organisations run org_id ---+ id +--- course_id many course and org_name +-< org_id | course_name courses run by course_id >--+ many organisations
-
If you want to find overlapping dates then use a query like this SELECT a.room_id as rooma , a.start_date as starta , a.end_date as enda , b.room_id as roomb , b.start_date as startb , b.end_date as endb FROM book a INNER JOIN book b ON a.end_date > b.start_date AND a.start_date < b.end_date AND a.room_id < b.room_id
-
What is the code you have tried so far?
-
try $arr = json_decode('{"bids": [[ 100, 24 ], [ 300, 10 ], [ 200, 34 ]], "asks": [[ 300, 23 ], [ 100, 34 ], [ 200, 21]]}', 1); rsort($arr['bids']); sort($arr['asks']); echo '<pre>',print_r($arr, true),'</pre>';