Jump to content

mactron

Members
  • Content Count

    30
  • Joined

  • Last visited

Everything posted by mactron

  1. Yes I know, but I would like to link to categories also...
  2. Works like a charm, but I can't set the link pointed to the each category based on category id. Among GROUP_CONCAT(), what is another way to resolve the issue? I would be thankful to you if you could provide me some reference. Thanks!!
  3. echo $model->category_id . " " . $model->model_category_name ; ?>
  4. Now I'm getting error in PHP:: Notice: Undefined property: stdClass::$category_id in C:\laragon\www\sys\admin\people.php on line 19 Notice: Undefined property: stdClass::$model_category_name in C:\laragon\www\sys\admin\people.php on line 19
  5. Should I write another query for categories?
  6. Me again.. I'm fetching data from MySQL but each person in people.php is displayed two times instead one.. The issue must be inside models_category_tbl table, because each person have more then one result. Any advice is appreciated. What should I do? I would like to display people something like that: 1 John Doe 1 IT developer, 3 mechanic models/model = person category = occupation/skills MySQL: model_index table +---------+------------+-------------+-------------------+---------------+----------------+ |model_id | model_name | model_title | model_description | model_
  7. From insert query for posts.. $id = $this->conn->lastInsertId(); I would like something like this.. +----+---------+-------------+ | id | post_id | category_id | +----+---------+-------------+ | 1 | 2 | 3 | | 2 | 2 | 5 | | 3 | 3 | 1 | | 4 | 3 | 2 | +----+---------+-------------+ The hole problem is inside my array.
  8. I'm trying to insert array of posts categories into MySQL. I'm getting category IDs from drop down list.. ERR: Notice: Notice: Array to string conversion in C:\laragon\*********\includes\functions.php on line 477 Array Array ( [0] => Array ( [0] => 4 [1] => 5 ) ) PHP try { $sql = "INSERT INTO posts_category_ids (post_id, category_id) VALUES"; $insertQuery = array(); $insertData = array(); foreach ($filter_category as $row) { $insertQuery[] = '(?, ?)';
  9. I'm working on a simple CMS system. So my question is how to add categories of blogs inside database correctly. If I understand EAV I need to add two tables; one table for names, descriptions of categories and one table for categories IDs and posts IDs. I'm correct? Cheers blog_tbl +------+---------+--------+---------------+-------------------+---------+ | b_id | b_title | b_text | b_seo_title | b_seo_description | slug | +------+---------+--------+---------------+-------------------+---------+ | 1 | Title 1 | txt 1 | 70 charsets | 170 charsets | title-1 | |
  10. I will do that way but I'm worried about too many JOINS. I already have 3 queries with 3 JOINS in each.
  11. Ahh I see, another table & another JOIN..
  12. Sorry, but what do you mean with multiple, I would simple update that columns ..
  13. Yeah I'm using InnoDB .. What about if someday I decided to add likes, dislikes and views for each person. That's mean 3 additional columns inside people_tbl and 13 columns in total. I'm worried about JOINS because I already use three JOINS in one query. I have heard people complain that JOINS may be pretty slow. Thanks!
  14. Done with JOINs and work like a charm. Thanks! Just another question .. I would like to add photo of each person, so I will have two additional columns inside my persons_tbl (person_avatar_path, person_avatar_name). Is it better to create new table for avatars?
  15. I have three tables, people_tbl, people_category and people_country, but let's get focused on 1st and 2nd table only. people_tbl = people and their info (please check MySql architecture above) people_category_tbl = occupation Witch my code below, I fetch the data between both tables. All the data are correctly fetched and completely relevant. Actually everything works just fine, but I'm curious If I'm on the right path. is there anything that I can fix, improve.. Should I use only one query with JOIN syntax? Thanks! func.php <?php class PeopleData extends dbh{ publ
  16. Try $msg = "<script type="text/javascript"> $(document).ready(function(){ demo.initChartist(); $.notify({ icon: 'pe-7s-gift', message: 'TESTING!' },{ type: 'info', timer: 4000 }); }); JS; print '<script>'.msg.'</script>'; P.S. Your code is not safe. Use PDO instead MySQLi.
  17. Hello, I have a table with people and some details insde. So, my question is if my MySQL architecture down below is good or not. Should I devide the table into two tables and kept only p_id, p_name and p_slug inside my table (people_tbl). Thank you! p = person p_description = bio p_category = occupation (people_category_tbl) people_tbl +------+---------+---------+---------------+-------------+-------------------+-----------+------------+---------+ | p_id | p_name | p_title | p_description | p_seo_title | p_seo_description | p_country | p_category | p_slug | +------+----
  18. persons_tbl person_id | person_name | person_surname | person_description | person_slug -----------+--------------+-------------------+--------------------+------------- 1 | John | Doe | bla bla bla | john-doe 1 | Jane | Doe | bla bla bla | jane-doe 2 | Greg | Stue | bla bla bla | greg-stue -----------+--------------+----------------+--------------------+------------- persons_web_tbl person_web_id | person_web_linkedin | person_web_twitter | person_web_facebook | person_web_website | person_id -------------
  19. persons_web_tbl will look something like that person_web_id | person_web_linkedin | person_web_twitter | person_web_facebook | person_web_website | person_id
  20. From form ... I have two person tables, both get data from forms. I just added $person_web_twitter = "add something" and echo "found"; to test the class.. table 1 -> table person_tbl as an index of all people. table 2 -> persons_web_tbl where I will store people's links such as websites, twitter & facebook profiles. So, that's wrong approach?
×
×
  • 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.