Tagged Questions
0
votes
1answer
9 views
Covering index does not show the performance as expected
I have two tables same structure. I added index for columns of one table and Covered index for other tales. Table structure follows
CREATE TABLE IF NOT EXISTS `customer` (
`id` bigint(20) NOT NULL ...
-4
votes
0answers
9 views
Database design sample needed [on hold]
Some one please send me a sample database for maintaining user account and retails store database designs, in order to map user account through customer id and track the order and sales.
Thanks
0
votes
0answers
8 views
Appropriate syntax for attaching an sqlite database
I'm testing my SQL statements to see if they tune out alright in my iOS code. What I am attempting to do is attach a database to my main DB. The way I am testing my databases is simply putting both of ...
0
votes
3answers
20 views
MySQL: condition on result of GROUP_CONCAT?
I have an SQL setup akin to the following:
ARTICLES
id (PK)
name
TAGS
id (PK)
tag
...and a third table logging associations between the two, since there can be multiple tags to each article:
...
0
votes
1answer
21 views
How would I set out these simple tables with primary keys etc in MySQL?
I’m trying to create a relational database whereby I can award students ‘Awards’ throughout their time at school. I have chosen mySQL to do this and have a system ready as soon as I have sorted the ...
0
votes
1answer
18 views
MySQL IF statements usage
I am using the following code to attempt to create a concatenated string of days of the week.
DELIMETER $$
CREATE FUNCTION recurringDay(mon SMALLINT(1), tue SMALLINT(1), wed SMALLINT(1), thu ...
-2
votes
0answers
39 views
How to arrange foreign keys to eliminate dead lock in MySQL
It seems deadlock is inevitable in MySQL, even its official documentation says restarting transaction is the trick.
My DB has ~100 tables, I use foreign key heavily so that every column referring to ...
2
votes
0answers
51 views
Post only returning older result
So I have a posting system. The issue is when the user posts say Hi, it doesn't show up till they submit another post. Then Hi shows up, but the other post doesn't. So I guess you could call it a ...
1
vote
2answers
16 views
(AS3 & PHP) sending multiple values from php to flash
I'm trying to send multiple values from PHP to Flash. I know how to send back one value, and that's by using PHP's print or echo, and then in flash using e.target.data., for example...
PHP:
print ...
0
votes
0answers
45 views
Need advice on database structure
I'm trying to create database for my project and I think i'm doing it wrong. So i'm asking maybe someone could give me some advice on how to do it correctly.
Shortly about the project:
I'm creating ...
1
vote
2answers
55 views
Checking for duplicate records
So I have a following system and want to check if joe is following joe, the usernames are unique. So I basically want to prevent the user from following themselves. Here's what I have right now
...
5
votes
3answers
67 views
MYSQL result not returning correctly
So I have a piece of code that will check if you have followed a user or not. And basically let you follow them if you haven't. So here it is
if($_SESSION['loggedIn'] == true){
$result = ...
-4
votes
0answers
16 views
how to extract data from four tables using joins r procedures [on hold]
i have four tables. i want to exttract nly dis columns.but am confused to who to do.
select ...
-6
votes
0answers
36 views
One query in php for all database [on hold]
Is it possible to develop single code which can work for multiple databases.
More specifically,
-Is it possible to write a single SQL query that can be executed in work in multiple databases like ...
-2
votes
1answer
26 views
why I can't see my database in …\MySQL Server 5.6\data
I create two database and tables in mysql ,but I can't see any data
file in "\MySQL Server 5.6\data" . In "\MySQL Server 5.6\data" just mysql file and
performance_schema. I really want to post ...
-1
votes
0answers
42 views
if statement not recognizing $_POST values from database
Can someone tell me why "You have already voted" is not being posted, I have tried to post ip if someone votes so that if they vote once they cannot vote again, and then at the end of the code I tried ...
0
votes
0answers
17 views
how to commit on other database
Hi everyone please help me to get this done.
I want to know if i can commit other database table after insert trigger
e.g.
DELIMITER &&
CREATE TRIGGER After_insert_pe1_ptc AFTER ...
0
votes
2answers
18 views
DECIMAL type rounding extra decimals and not truncating mysql
DECIMAL type should represent 'Exact', but it's rounding the number, eg:
CREATE TABLE `foo`(p1 DECIMAL(5,2));
INSERT INTO `foo` VALUES (587.487);
SELECT * FROM `foo`;
it stores 587.49 instead of ...
0
votes
0answers
16 views
Mysql Down Crashed [on hold]
I have been having a great problem dealing with our database server, I have already run cache on our site to minimize the request on our database server but still this doesn't help to prevent the ...
0
votes
0answers
38 views
Get and count number of true or false from MySQL database
From this MySQL statement, I would like to get and count those columns that is true to be displayed out in a page.
My following codes are:
$query = "SELECT COUNT(*) FROM application WHERE shortlist ...
3
votes
3answers
43 views
Only getting one record returned
So I'm trying to retrieve a list of likes. Here's my code
//Echo total likes of #68
$stmt1 = $con->prepare("SELECT COUNT(*) FROM likes WHERE liked_post_id = :id;");
$stmt1->bindValue(':id', ...
0
votes
1answer
32 views
how to build a one to one relationship
I have a restuarant table that has a manualAddress_id column
I have a ManualAddress table that has a restaurant_id column
The relationship is one to one.
Should I remote any of those columns?
...
1
vote
2answers
25 views
Not getting a result from DB
So I'm checking to see if a user already liked a post. Here's what I'm doing
$id = 65;
//Get likes count
$stmt = $con->prepare("SELECT * FROM likes WHERE liked_post_id = :liked_post_id");
...
0
votes
1answer
28 views
Writing Eloqent Query to find posts with most votes Laravel
I have been having trouble writing an Eloquent query that finds my post with the most votes. I have a votes table and a posts table. The votes table has an id column, a post_id column, a user_id ...
0
votes
0answers
9 views
Restore database from .frm and .ibd
I had a WordPress website running a long while ago. I used WAMP server. Then, I uninstalled WAMP. Today I would like to work again on my website; all that remains of my database is this (I cannot find ...
0
votes
1answer
34 views
Implementing matching in database
I am working on a project where people choose certain slots everyday. Then I match people who are in the same slot with each other. I am using a separate table for implementing this. The design that I ...
-1
votes
1answer
35 views
Why does MySQL always give error access denied even though user exists?
I'm trying to simply run php artisan migrate --seed on a new Laravel project but everytime I try, I get the error:
SQLSTATE[HY000] [1045] Access denied for user 'appuser'@'localhost' (using password: ...
0
votes
2answers
30 views
SQL - Count occurrences across multiple columns
I have a hypothetical database comprised of patients and their comorbidities (or diagnosis codes as they are often termed):
PATIENT_ID | HOSPITAL | DIAG_01 | DIAG_02 | DIAG_03 | DIAG_04 ...up to ...
0
votes
1answer
14 views
Optimization of Mysql table size
I am considering a problem.
In C language, we are suggested that the size of struct should be multiples of 2-byte.
e.q.:
struct text{
int index;//assume int is 4 byte.
char [8] word;
...
-1
votes
0answers
29 views
Select value from comma separated column [duplicate]
My table looks like this
userId List
2 1,2,3,4,5,6,7,8,9
3 4,9,10,51,5,26,7,3
10 41,14,25,63,65,23
I want to do a query that would be something like this:
SELECT userID ...
0
votes
0answers
15 views
what are .nbk files for database?
I have a database.nbk file which is supposed to contain the database content for an organizational framework. I have to map the data inside it to mysql database. Unfortunately I have no idea what this ...
-1
votes
3answers
19 views
select value from multiple columns mysql
On my site a user enters an account number and I have a script to show the business name belonging to that account number, however the account number could be in 2 columns.
I have the below code to ...
0
votes
1answer
25 views
Python: How to group dictionaries based on a key value pair
Say I have a list of dictionaries in Python containing audio metadata in this format:
metadata = {'title': meta['title'][0],
'artist': meta['artist'][0],
'album': ...
0
votes
1answer
30 views
Failed To Insert Into MYSQL
It Does Nothing? Doesn't even display an error code? The sign up form is in the same document. I've tried $_POST & $_REQUEST. Is this where the problem is?
if ( $_SERVER ['REQUEST_METHOD'] ...
-3
votes
0answers
29 views
How to minus two value Read from the database
$s=mysql_query("SET NAMES 'utf8'");
$sql="SELECT * FROM `prg omran`.`touristplace` INNER JOIN `prg omran`.`price`";
$result=mysql_query($sql);
if(!$result)die(mysql_error());
...
0
votes
1answer
12 views
how can I select the month part only in a DATE datatype column using CI active record?
**How could I select the month part only in a DATE data-type column using CodeIgniter's active record class? What would be my query?
I'm also confused what do i need to use,.. LIKE or WHERE clause?
...
-1
votes
0answers
25 views
How to search & modify MySQL with log4j2?
Im totally new to log4j or log4j2... though I have figured out how to connect to mySQL DB from googling around. But I'm having trouble outputting logs to the database.
How exactly can I use log4j2 ...
0
votes
1answer
24 views
Writing INSERT query for multiple tables
I am writing a recipe database app and I have the database schema sorted but I am not struggling to figure out what query to write to insert the recipe into the database.
I have 3 tables
ingredients
...
0
votes
1answer
19 views
PHPMyAdmin retrieving data with special symbols
I am making a website which has a database where I store data which contains the symbols ÅÄÖ (I don't know if they will show up here, but if they don't, they are "special symbols"). However when I ...
-4
votes
1answer
21 views
Search at the database and print to the another page [on hold]
Users search something at the database and take some result. And then user clicks any result(for example: red car) and the result page comes with a header Red Car.
My problem is how can I print red ...
0
votes
3answers
24 views
Edit mySQL database contents based on username?
So I have a very perfunctory understanding of PHP/mySQL (as in, the extent of my understanding is how much I was able to retain from a few tutorials) and am looking to expand a bit on those tutorials. ...
-3
votes
1answer
25 views
single mysql select query to select last 1 hour row or last row [on hold]
I want to write single MySQL query to select last 1 hours rows and if there is no rows in last 1 hours to select last row
I can do it using 2 separate query. first i run query to select last 1 hour ...
0
votes
4answers
42 views
Cannot find error in my php script. Can someone point it out to me
I have written a php script on my web server to insert values into the table table3. The variables used to get values are username and image. username contains varchar type data and image contains ...
0
votes
2answers
15 views
database: how to create the update cascade tables and query data?
I want to create a database have two tables. I want to create a update cascade relationship between two tables. If the SNAME was changed in EMPLOYEE, then WORKREPORT will change his SNAME too.
...
1
vote
0answers
40 views
Php/Mysqli error with insert
I'm trying to rebuild my php/mysql website with mysqli methods. I would to insert a new record in my table SEZIONE, it attributes are:
ID_STAGIONE number (primary key),
ORDINE number,
TITOLO ...
1
vote
1answer
26 views
#1413 error in mysql while creating a trigger
using mysql in phpmyadmin i started creating a trigger..
but i got this error
MySQL said: #1413 - Duplicate handler declared in the same block
I dont know whch is going wrong.. also i am creating ...
0
votes
0answers
12 views
Fatal error: Call to a member function prepare() on a non-object [duplicate]
I am trying to fetch data from the database using PDO but am keep getting the error " Fatal error: Call to a member function prepare() on a non-object ".
I have searched it everywhere but failed to ...
0
votes
0answers
19 views
Wordpress huge database size
I have a wordpress site with below plugins:
wp-types
seo by yost
I have only 21000 post from my custom post type but my database size is 353 MB.
My biggest table is:
post table: 21165 Records ...
0
votes
1answer
13 views
add a value in table 1 from table 2 where multiple columns matches
I have a table 1 with 16 unique values considering columns A, B and C.
CREATE TABLE `monitor_periodo` (
`ano` varchar(255) DEFAULT 'NULL',
`mes` varchar(255) DEFAULT 'NULL',
`data` ...
2
votes
1answer
28 views
Links that expire
So basically I'm doing a password reset and want to set a time limit. Here's the code I have
$time = time();
$hash = md5($id . $time . "somerandomsalt"); // check this again in activation.php
$link ...