Skip to content
Advertisement

Tag: mysql

Detect emoticons in string

I found that you need PHP 7 and MySQL 5.5 to use emoticons in a string that you want to upload to the database. I don’t have these specification on my server so I want to give an error message in laravel or php. Is there a way to detect emoticons in php? If so then I can create a

Laravel Carbon Group by Month

Can anyone see what I’m doing wrong? I’m trying to output all the months but group them so they are unique. I’m getting the following back In my database I have five news articles all created_at 05/01/2017 so it’s right that I only get one response but I’m not getting the number of the month back? Answer You can use

How to create an array from a MySQL query?

I have a HTML search form made with PHP that connects to a MySQL database, finds a table with columns and rows and then displays this data with an echo under the table. The columns are id, name, short, short_withtag and url. The problem is, if I enter a keyword like pie (such a term existing in all of the

Group by query in in laravel 5.3

I have fired this query: but I got the following error: PDOException in Connection.php line 332: SQLSTATE[42000]: Syntax error or access violation 1055 ‘baseproject_new.articles.user_id’ isn’t in GROUP BY When run the query in mysql I got the result, but when I run the page I got the error. When I use the same query in laravel it will give me

mysql query return boolean but I expect to return id

This is my query: What is wrong in this query? I’m expecting like in nested where id is compared to 108 and result will be greater than 108 but it returns boolean calling function with parameters like nextIdUserInquiry(108, $con, ‘N’); and whole function body is below and mysql error is that Call to a member function fetch_assoc() on boolean in

laravel errno 150 foreign key constraint is incorrectly formed

Can anybody help me to solve this problem? There are 3 tables with 2 foreign keys: Error after running migration: Answer In case of foreign keys, the referenced and referencing fields must have exactly the same data type. You create the id fields in both users and firms as signed integers. However, you create both foreign keys as unsigned integers,

laravel Could not open input file: artisan (5.3)

I’m new to Laravel ad i have just created new project using official laravel documentation. After installing when i run php artisan migrate it will showing Could not open input file: artisan error in console Listing of commands that i run composer create-project –prefer-dist laravel/laravel laravelDemo which will create new folder laravelDemo cd laravelDemo php artisan migrate I’m using Ubuntu

Search function when one field is blank

I need to know if there’s a more efficient way to do a search when a user leaves a blank field My question is how do I do this? My own conclusion was to use a variety of and so on then corresponding each with its own SELECT * FROM…. but this seems so bothersome and not that dynamic especially

php changed database date value

review this piece of code: $values = $mysqli->query(“select * from `my_table`”); while($value = $values->fetch_array()) { print_array($value); } however one column having a date structure …

Check For Existing Table Using variable

I was wondering how to incorporate a variable into a PHP statement to check if a table exists. For some reason the query does not accept the variable. Here is what I have: Answer The statement needed a tilde around the variable. Here is the final statement: $query101 = “select 1 from `$id` LIMIT 1”;

Advertisement