Category "mysql"

Checking if a table has any rows, and return string if it doesn't

If there is a table, test, how can we return "No data" if the table has only title but no other rows? IF (SELECT 1 FROM test) < 1 THEN (SELECT ' No data');

Fatal error: [] operator not supported for strings

I'm getting information from database, saving it in array and echoing it in a form with loop structure and I'm having problems when I try to save the modified i

Volume not persistent in Google Cloud

I'm trying to build a mysql pod on Google Cloud. However, when I create a database and then restart the pod, the database that I created is not persisted. I fol

Second select load from database after first one is selected

I have 2 select items. In the first one I'm loading the options from a MySQL database table using PHP. The second one I want to load the fields from another t

How do I connect Dreamweaver to a MySQL Database?

I've been trying to connect Dreamweaver to a MySQL Database for a while. These are the login data: $mysql_host = "mysql16.000webhost.com"; $mysql_database = "

Python BeautifulSoup Empty Rows in CSV File

I am working on a scraper to pull street names and zip codes from a site and all of that is working great and it builds a CSV file just fine for me. But when I

Database design, variable number of columns [closed]

I have a simple application in which users submit data into a table. There are currently 3 fields the user can pass values to at the moment.

How to add a primary key to a MySQL table?

This is what I tried but it fails: alter table goods add column `id` int(10) unsigned primary AUTO_INCREMENT; Does anyone have a tip?

"Database hosts array is empty." after deploying Laravel project on AWS Elastic Beanstalk

I deployed my project to an AWS EC2 instance using Elastic Beanstalk. I used this tutorial https://www.youtube.com/watch?v=ISVaMijczKc as a reference while depl

MySQL error #1054 - Unknown column in 'Field List'

Whenever I try to input data into my tblorder I get the error message #1054 - Unknown column 'FK_Customer_ID' in 'field list'. I have tried breaking my code do

SQL to convert multiple rows into a single row of variable length

I am writing a module for drupal6/PHP5 using MySQL (and optionally PostgreSQL). To represent arbitrary sample properties and instrument readings in an experimen

How to correctly set Mock Row and Query for go-sqlmock

I'm setting up testing in golang. I use go-sqlmock to test mysql connection. But sqlmock.NewRows and mock.ExpectQuery does not work well with error. I want to k

Laravel - How to properly generate unique slugs from article titles?

I need to generate unique slugs based on titles of articles. For matching slugs I want to append a number to the end to make them unique. I made this function b

SQLAlchemy secondary relationship not using JOIN

I created a Many to Many relationship on SQLAlchemy, but for some reason when I access it it's not emitting a JOIN clause, but rather selecting from a cross pro

Join the same table temporary table in MySQL

I like to join a temporary table in MySQL which fails, the idea quite simple: CREATE TEMPORARY TABLE temp_table LIKE any_other_table; -- srsly it does not matt

MySQL Pivot Query with Sum of column value

Table 1(reports) - Structure with Data id distributorId clientId amount 1 1 162 2500 2 2 163 3500 3 3

How to do a silent install of MySQL in Inno Setup?

I would create a setup program for my Java application. It uses a MySQL database. So the installation of my program must include the installation of MySQL serve

phpMyAdmin Accepts NULL in the NOT NULL field

I've created a table with some NOT NULL columns using phpMyAdmin. CREATE TABLE `TEST` (`ID` INT PRIMARY KEY AUTO_INCREMENT, `Firstname` V

Short-circuit UNION? (only execute 2nd clause if 1st clause has no results)

If I do: SELECT * FROM A WHERE conditions UNION SELECT * FROM B WHERE conditions I get the union of the resultset of query of A and resultset of

Grouping into interval of 5 minutes within a time range

I have some difficulties with mySQL commands that I want to do. SELECT a.timestamp, name, count(b.name) FROM time a, id b WHERE a.user = b.user AND a.id =