-
Posts
24,605 -
Joined
-
Last visited
-
Days Won
830
Everything posted by Barand
-
I see you have a column called "tags", which rings alarm bells for me, How are you storing the data in that column?
-
see http://pitmanshorthand.homestead.com/BasicsofPitman.html
-
Those 1's should be l (lowercase L)
-
You have given no information about the table in the query, other than its name, so how do you expect us to help?
-
Add a WHERE clause to your query
-
You need to join them via the lookup table SELECT postname , name FROM posts p JOIN lookup l ON p.id = l.postid JOIN postcategory c ON l.categoryid = c.id
-
One query killer you have in there is " ... LIKE '%XXX%' ... " That leading "%" will prevent the query from using an index so every record must be scanned. Without knowing the exact nature of the search (what is in the $parts array?) I can't say more, except, maybe, try a FULLTEXT search
-
One easy option is to create HTML or PDF files. Word will open those and you can save as DOCX
-
Sorry, I am unable to do that, I have never read one. Just reference manuals and experimentation.
-
Sorry, I copied and edited the wrong query SELECT c.name AS county_name , c.id AS county_id , c.population , group_concat(DISTINCT r.name separator '<br /> ') AS recruiter , group_concat(DISTINCT u.name separator '<br /> ') AS u_name FROM counties c INNER JOIN states s ON c.state_id = s.id LEFT JOIN recruiters r ON r.county_id = c.id LEFT JOIN universities u ON c.id = u.county_id WHERE c.state_id = $StateID GROUP BY c.name
-
try SELECT c.name AS county_name , c.id AS county_id , c.population , group_concat(DISTINCT r.name separator '<br /> ') AS recruiter , group_concat(DISTINCT u.name separator '<br /> ') AS uname FROM counties c INNER JOIN states s ON c.state_id = s.id LEFT JOIN recruiters r ON r.county_id = c.id UNION RIGHT JOIN recruiters r ON r.county_id = c.id LEFT JOIN universities u ON r.county_id = u.county_id WHERE c.state_id = 5 GROUP BY c.name results +--------------------+-----------+-----------+ | region | region_id | parent_id | +--------------------+-----------+-----------+ | Caribbean | 1 | 0 | | Eastern Caribbean | 1 | 1 | | Southern Caribbean | 1 | 1 | | Western Caribbean | 1 | 1 | | South America | 4 | 0 | | Amazon River | 4 | 4 | +--------------------+-----------+-----------+
-
What is the group table for when you have the region parent in the region table? Try SELECT reg_name as region , region_id , parent_id FROM clc_crz_regions WHERE parent_id=0 UNION SELECT r1.reg_name , r2.region_id , r1.parent_id FROM clc_crz_regions r1 INNER JOIN clc_crz_regions r2 ON r1.parent_id = r2.region_id WHERE r2.parent_id=0 ORDER BY region_id, parent_id, region +--------------------+-----------+-----------+ | region | region_id | parent_id | +--------------------+-----------+-----------+ | Caribbean | 1 | 0 | | Eastern Caribbean | 1 | 1 | | Southern Caribbean | 1 | 1 | | Western Caribbean | 1 | 1 | | South America | 4 | 0 | | Amazon River | 4 | 4 | +--------------------+-----------+-----------+
-
I meant to use that in your earlier query SELECT c.name AS county_name , c.id AS county_id , c.population , group_concat(r.name separator '<br /> ') AS recruiter , group_concat(u.name separator '<br /> ') AS u_name FROM counties c INNER JOIN states s ON c.state_id = s.id LEFT JOIN recruiters r ON r.county_id = c.id LEFT JOIN universities u ON c.id = u.county_id WHERE c.state_id = $StateID GROUP BY c.name
-
Article management - Category, subcategory - Checkbox
Barand replied to pospan's topic in PHP Coding Help
Easiest way is to store all in the category table. The parent id of of top-level categories will be NULL, in subcats it's the id of the parent category TABLE: articles TABLE: categories articleID +------ catID ---+ title | cat_name | content | parentCatID >--+ catID >-----+ -
what if you LEFT JOIN universities u ON c.id = u.county_id
-
unserializing once gave you a serialized string which you then unserialized to get the array. Looks like your original was serialized twice.
- 1 reply
-
- 1
-
-
Do you mean while($row = $result->fetch_assoc()){ $events[] = array( 'id' => $row['id'], 'title' => $row['event'], 'start' => $row['eventDate'] ); }
-
You do it the same way you did in this post of yours 2 years ago http://forums.phpfreaks.com/topic/287395-help-with-login-script-phphtml/?do=findComment&comment=1474436
-
Splitting a string based on the last instance of a character
Barand replied to sn00pers's topic in PHP Coding Help
Or strrchr $ipport = "2001:db8:a0b:12f0::1:25"; $end = strrchr($ipport, ':'); echo $end; //--> :25 -
Make a better job of the presentation of your code then maybe someone will have a look at it.
-
try using this to define the constant, instead of a class constant definition define('CERTIFICATE_CHAIN_PATH' , __DIR__ . '/gd_bundle-g2.crt');
-
You could use a <datalist>..</datalist> <datalist id='timeoptions'> <option>1:00</option> <option>1:15</option> <option>1:30</option> <option>1:45</option> <option>2:00</option> <option>2:15</option> <option>2:30</option> </datalist> <input type="text" name="fromtime[]" value="" placeholder="From Time (hh:mm)" class="forminput" list="timeoptions" />
-
$curl_response = curl_exec($curl); if ($curl_response === false) { trigger_error('cURL error: '.curl_error($curl), E_USER_ERROR); } echo $curl_response; curl_close($curl); result
-
My data mysql> select * from states; +----+-------------+------------+ | id | name | capital | +----+-------------+------------+ | 1 | Connecticut | Hartford | | 2 | Maine | Augusta | | 3 | Vermont | Montpelier | +----+-------------+------------+ mysql> select * from counties; +----+----------+------------+------------+ | id | state_id | name | population | +----+----------+------------+------------+ | 1 | 3 | Bennington | 37125 | | 2 | 3 | Addison | 36821 | | 3 | 3 | Caledonia | 31227 | | 4 | 1 | Fairfield | 916829 | | 5 | 1 | Hartford | 894014 | | 6 | 2 | Aroostook | 71870 | | 7 | 2 | Cumberland | 281674 | +----+----------+------------+------------+ mysql> select * from recruiters; +----+-----------+---------+ | id | county_id | name | +----+-----------+---------+ | 1 | 1 | Anne | | 2 | 1 | Bernard | | 3 | 2 | Charlie | | 4 | 2 | Dianne | | 5 | 3 | Emma | | 6 | 4 | Fred | | 7 | 4 | George | | 8 | 6 | Henry | | 9 | 6 | Ian | | 10 | 6 | Jane | +----+-----------+---------+ query SELECT c.name , c.population , group_concat(r.name separator ', ') as recruiters FROM counties c INNER JOIN states s ON c.state_id = s.id LEFT JOIN recruiters r ON r.county_id = c.id WHERE c.state_id = 2 GROUP BY c.name results +------------+------------+------------------+ | name | population | recruiters | +------------+------------+------------------+ | Aroostook | 71870 | Henry, Ian, Jane | | Cumberland | 281674 | NULL | +------------+------------+------------------+
-
Use placeholders for all the variables and not just two of them.