Jump to content

jazzman1

Staff Alumni
  • Posts

    2,713
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by jazzman1

  1. Take a look at examples: http://php.net/manual/en/function.preg-match.php
  2. Do you understand what does a piece of code mean? if(!mysql_query("INSERT INTO Users (email, username, password, birth) VALUES ('$Email', '$Username', '$Password', '$Birth')"))
  3. He is the best and knows to much. I like him (i'm not a gay)
  4. Post some data of these sql files, to make a query test with a real data, just to avoid from multiple posts.
  5. Where is the users table?
  6. This query works just fine, I tested few minutes ago : UPDATE candidate_TEMP c INNER JOIN historical_rejection r ON c.candidate_id = r.candidate_id SET c.ats_jobseeker_rejection_code_id = CASE WHEN rejection_reason = 'Sample Rejection 1' THEN 1028 WHEN rejection_reason = 'Sample Rejection 2' THEN 1016 ELSE c.rejection_code_id -- I want to keep the 0/null value that exists if I don't list a matching one for it END WHERE (rejection_code_id = 0 OR rejection_code_id IS NULL) RESULT:
  7. jazzman1

    JOIN WHERE

    Use 'or die(mysql_error())' at the end of your mysql_query() call.
  8. I know, just echo before to send it. We want to see only the string
  9. $this->db->select("CONCAT_WS(' ', ".$this->master_model->users_table.".first_name", $this->master_model->users_table.".last_name) AS author)");
  10. Could you echo it ?
  11. Where is the last parenthesis of this: SELECT `news_articles`.`news_article_id`, `news_articles`.`news_article_title`, DATE_FORMAT(news_articles.news_article_posting_date, '%M %D, %Y') AS news_article_posting_date, CONCAT_WS(' ', `users`.`first_name`, `news_article_categories`.`news_article_category_name` FROM (`news_articles`) JOIN `users` ON `users`.`user_id` =`news_articles`.`news_article_author_id` JOIN `news_article_categories` ON `news_article_categories`.`news_article_category_id` =`news_articles`.`news_article_category_id`
  12. There is no a separator specified in the first argument. Ops, there is empty string, sorry about that. Where do you close CONCAT_WS ?
  13. You need to spend a little time to learn how sql works. Get rid off the first sql MAX operator. I was creating this query when I use a firebird database. Copy/paste this: SELECT c.cat_title,c.cat_description, t.topic_title, COUNT(t.id) AS threads, SUM((SELECT COUNT(p.id) FROM posts p WHERE p.topic_id = t.id)) AS posts, (SELECT u.username FROM posts p RIGHT JOIN user u ON u.id = p.user_id WHERE p.post_time IN (SELECT MAX(p1.post_time) FROM posts p1 WHERE p1.cat_id= c.id)) AS username, (SELECT MAX(p2.post_time) FROM posts p2 WHERE p2.cat_id= c.id) AS datetime FROM topics t RIGHT JOIN cats c ON c.id = t.cat_id GROUP BY t.cat_id ORDER BY c.id ASC
  14. I had the same problem yesterday
  15. To get category id just adding another view c.id. To get a thread id(topic id) , see replay # 51 SELECT c.id, c.cat_title, c.cat_description, COUNT(t.id) AS threads,
  16. You need to have an id for the thread linked to the last post and the id of last poster. For example: when you click over the last post, the link could be linked to the proper thread's id. You have to create another query to list this result. PS, this something new, I've never seen before. if ($setting['seo'] == 'yes') { $catlink = $setting['siteurl'].'forumcats/'.$id.'/1.html'; } else { $catlink = $setting['siteurl'] . 'index.php?act=forumcats&id='.$id ; }if ($setting['seo'] == 'yes') { $topiclink = $setting['siteurl'].'forumtopics/'.$id.'.html'; } else { $topiclink = $setting['siteurl'] . 'index.php?act=forumtopics&id='.$id; } What result do you expect to have this $id ?
  17. Just add it in the top after c.cat_title: SELECT c.cat_title, c.cat_description, COUNT(t.id) AS threads,...................
  18. Hm...I've made a simple test with abs() based function. May be David is right function addNum($a, $b, $c){ $d = 5; return abs($a).abs($b).abs($c).abs($d); } echo addNum(1, 2, 3);
  19. @Amit20, you return a function into the function with 4 arguments. There is no logic and this one could be wrong in this particular case. If you want to return something like boolean value or text message, try this , if( mail($to,$subject,$message,$headers) { return "mail sent successfully message"; } else { return "mail message cannot be sent successfully"; } P.S When you use return statement to see the message you need to echo this function. For this case, instead of return just replace them with echo "mail sent successfully"; and for failed echo "mail message cannot be sent successfully"; exit; Use the exit function to stop the script if there is something wrong.
  20. I sent you the sql file by e-mail, if you have any problems into it, just let me know
  21. Well, in this case you need to grab 2 more fields, last_poster_id and tread_id for each posts. That one could be easily done adding two more sub queries: SELECT c.cat_title,COUNT(t.id) AS threads, SUM((SELECT COUNT(p.id) FROM posts p WHERE p.topic_id = t.id)) AS posts, (SELECT u.user_name FROM posts p RIGHT JOIN users u ON u.id = p.user_id WHERE p.post_time IN (SELECT MAX(p1.post_time) FROM posts p1 WHERE p1.cat_id= c.id)) AS user_name, (SELECT u.id FROM posts p RIGHT JOIN users u ON u.id = p.user_id WHERE p.post_time IN (SELECT MAX(p1.post_time) FROM posts p1 WHERE p1.cat_id= c.id)) AS last_poster_id, (SELECT MAX(p2.post_time) FROM posts p2 WHERE p2.cat_id= c.id) AS datetime, (SELECT MAX(p5.topic_id) FROM posts p5 WHERE p5.cat_id= c.id) AS thread_id, (SELECT p3.post_body FROM posts p3 WHERE p3.post_time IN (SELECT MAX(p4.post_time) FROM posts p4 WHERE p4.cat_id= c.id)) AS last_post FROM topics t RIGHT JOIN categories c ON c.id = t.cat_id GROUP BY t.cat_id ORDER BY c.id ASC RESULT: +---------------+---------+-------+-----------+----------------+---------------------+-----------+----------------------------------------+ | cat_title | threads | posts | user_name | last_poster_id | datetime | thread_id | last_post | +---------------+---------+-------+-----------+----------------+---------------------+-----------+----------------------------------------+ | Announcements | 3 | 5 | Davie34 | 2 | 2012-09-01 07:36:18 | 3 | POST 6, THREAD 1, CREATED FROM DAVIE33 | | Support | 2 | 1 | jazzman | 1 | 2012-09-03 07:34:25 | 4 | POST 4, THREAD 4, CREATED FROM JAZZMAN | | General | 1 | 0 | NULL | NULL | NULL | NULL | NULL | | Pictures | 0 | 0 | NULL | NULL | NULL | NULL | NULL | +---------------+---------+-------+-----------+----------------+---------------------+-----------+----------------------------------------+
  22. How do you use sendMail function ? I can not see to call anywhere in your script! Ops...... sorry I've seen it - $isSent = sendMail('abc@gmail.com',$file_name,UPLOAD_DIR);, but.... this one is completely wrong
  23. No, you can not delete cookies from another site! It smells like cross-site scripting (XSS)
  24. Give us a link to this portal, please.
  25. To get the last post of the last poster user: SELECT c.cat_title,COUNT(t.id) AS threads, SUM((SELECT COUNT(p.id) FROM posts p WHERE p.topic_id = t.id)) AS posts, (SELECT u.user_name FROM posts p RIGHT JOIN users u ON u.id = p.user_id WHERE p.post_time IN (SELECT MAX(p1.post_time) FROM posts p1 WHERE p1.cat_id= c.id)) AS user_name, (SELECT MAX(p2.post_time) FROM posts p2 WHERE p2.cat_id= c.id) AS datetime, (SELECT p3.post_body FROM posts p3 WHERE p3.post_time IN (SELECT MAX(p4.post_time) FROM posts p4 WHERE p4.cat_id= c.id)) AS last_post FROM topics t RIGHT JOIN categories c ON c.id = t.cat_id GROUP BY t.cat_id ORDER BY c.id ASC RESULT: +---------------+---------+-------+-----------+---------------------+----------------------------------------+ | cat_title | threads | posts | user_name | datetime | last_post | +---------------+---------+-------+-----------+---------------------+----------------------------------------+ | Announcements | 3 | 3 | Davie34 | 2012-04-10 11:41:24 | POST 3, THREAD 1, CREATED FROM DAVIE33 | | Support | 2 | 1 | jazzman | 2012-09-03 07:34:25 | POST 4, THREAD 4, CREATED FROM JAZZMAN | | General | 1 | 0 | NULL | NULL | NULL | | Pictures | 0 | 0 | NULL | NULL | NULL | +---------------+---------+-------+-----------+---------------------+----------------------------------------+
×
×
  • 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.