Skip to content
Advertisement

Tag: php

MySQL Query join last comment to topic

I have a topic and topic_comments table. I want to join them both. The join is on topic.id = topic_comments.parent_id. I want to show the topic with latest comment and order by latest comment createdate. And not show duplicate topics. Can anyone help me? So far I have this: This however doesn ‘t show topics without comments. It only returns

PHP fails to insert into Mysql (auto increment)

I have made my Mysql Table link this: That problem occurs because i am not able to insert auto_increment into my mysql query. index.php I post to it by a HTML form and it does executes the query but i get no rows in that table. I thnk its because of auto_increment or Unique or Primary. i was told to

Laravel: getting a single value from a MySQL query

I’m trying get a single value from MySQL database using laravel but the problem I’m getting an array . this is my query result in MySQL command line: my laravel function: expected $data value is a string with value= Admin but what i get is : [{“groupName”:”Admin”}] Answer Edit: Sorry i forgot about pluck() as many have commented : Easiest

Calculate price of rental period

I am working on a project for which I need to calculate prices of holiday homes available in a selected rental period. I need some help with building a SQL query that combines the following tables and …

Advertisement