Hello.
I am coding a friendship system and it has two tables.
members
id
username
password
friends
id
user_id
friend_id
status
Let's say that i want a query that can select the friends IDs of the member $userId how possible to make this in one query?
I found a solution which is to make 2 queries. The fist selects the friends W...
I've been working on optimizing my site and databases, and I have been using mysqltuner.pl to help with this. I've gotten just about everything correct, except for the table cache hit rate, no matter how high I raise it in my.cnf, I am still hitting about 0% (284 open / 79k opened).
My problem is that I don't really understand exactly ...
I have 2 simple tables:
table a:
id | txt
---+----
0 | aaa
1 | bbb
2 | ccc
table b:
id | tel
---+----
0 | 000
2 | 111
I am trying to join 2 tables like this:
SELECT a.*,b.*
FROM a,b
WHERE a.id=b.id
It works, but, if there is no entry in the "b" table it wont show anything.
what the sql shows is something like this:
...
I have the following schema:
TABLE bands
-> band_id
-> property1
-> property2
-> ...
TABLE tracks
-> band_id
-> track_id
The tracks table typically maps a single band_id onto multiple track_ids (there are multiple tracks for each band).
My goal is to build, for the bands that match certain conditions (in terms of property1, property...
Can someone help me understand what's wrong with this query:
DELETE FROM noteproject
INNER JOIN note ON noteproject.noteID = note.noteID
INNER JOIN person ON note.personID = person.personID
WHERE noteID = '#attributes.noteID#'
AND personID = '#attributes.personID#'
...
I have a MySQL table where rows are inserted dynamically. Because I can not be certain of the length of strings and do not want them cut off, I make them varchar(200) which is generally much bigger than I need. Is there a big performance hit in giving a varchar field much more length than necessary?
...
How do I change the order of my table fields without deleting the field and re-inserting it, using PHP myAdmin?
...
In MySQL queries, how important is it to put backticks around a table name. Does it have something to do with security? Are MySQL injection attacks possible through the table name if the table name is created dynamically in PHP based on user inputs?
...
I have a MySQL table with 3 fields:
Location
Variable
Value
I frequently use the following query:
SELECT *
FROM Table
WHERE Location = '$Location'
AND Variable = '$Variable'
ORDER BY Location, Variable
I have over a million rows in my table and queries are somewhat slow. Would it increase query speed if I added a...
I have the following query:
ALTER TABLE table CHANGE field1 field1 INTEGER
Is there anyway that I can add some sort of if exists to this statement so that MySQL will make sure that field 1 exists before attempting to change its field type?
...
I have a question. Does anyone have a working php script which can parse a XML file to a sql database? I have searched for some scripts and didn't find anything what looks like I can edit it to my needs.
Any help would be great!
...
I am developing a website. There is an English version, Japanese version and Chinese version. Different version is for different language speakers. If you are a registered user of the English version, and you want to use the Japanese version, you still need to register on the Japanese version. So should I create one database and put all ...
<?php
include"include/connection.php";
$checkusername=mysql_query("SELECT * FROM employer WHERE eusername='$username'");
if (mysql_num_rows($checkusername)==1)
{
echo "username already exist";
}
else
{
$query = "insert into employer(efname,elname,egender,eemail,eusername,epwd,eadd,ephone,ecity,ecountry) values ('".$_POST['first_name...
MySQL Administrator> Backup Project. It is a great tool to allow you to select databases, and schedule it.
However my issue is:
Today got a few new websites (new database created)
Tomorrow got a few more new websites (new databases created)
In this case, I have to always go into Backup Project> Select those remaining schema not in the...
Hi, i got this script, which i found in the web:
<script type="text/javascript">
$(document).ready(
function () {
$('a.closeEl').bind('click', toggleContent);
$('div.groupWrapper').Sortable(
{
accept: 'groupItem',
helperclass: 'sortHelper',
activeclass : 'sortableactive',
hoverclass : 's...
I tried to run the following command, in the folder of my Django project:
$ python manage.py dbshell
It shows me this error:
$python manage.py dbshell
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "C:\Python25\lib\site-packages\django\core\management\__init__.py", lin...
Hello all, i have made this script but then i press submit the jquery animation start but it will not submit it into the database with PHP :S.
Here is my script
http://pastebin.org/68943
Thanks
...
Lets say I have a table with some data like the following:
ID text OtherID
_______________________
6 text1 24
7 text2 24
8 text3 24
9 text1 25
10 text2 25
As you can see I have multiple entries with the same OtherID. what would be an sql statement that would select only the newe...
I've created a bunch of views in a database and I'd like to export them to pdf. However phpmyadmin lets me only put a title on each page and it's very limited to how i can layout the output.
does anybody have some recommendations of software/scripts they used?
...
I need to create a view that automatically adds virtual row number in the result. the graph here is totally random all that I want to achieve is the last column to be created dynamically.
> +--------+------------+-----+
> | id | variety | num |
> +--------+------------+-----+
> | 234 | fuji | 1 |
> | 4356 | gala ...