Hi!
I have two tables t1 and t2. i have created two triggers tr1 after insert on t1 and tr2 after update on t2. in both the tables i m updating table t2. so, it is throwing an error saying the t2 table is already getting updated in another trigger so can not update it again.
Please let me know if anyone has faced this type of problem a...
I have the following tables:
tags
id tag_name
examples
id category heading
examples_tags
id tag_id example_id
How can I retrieve the number of examples under each tag? (a bit like stackoverflow actually :))
I also want an additional condition of the type:
examples.category = "english examples"
This is how I started ...
SELECT t...
I am writing a test program with Ruby and ActiveRecord, and it reads a document
which is like 6000 words long. And then I just tally up the words by
recordWord = Word.find_by_s(word);
if (recordWord.nil?)
recordWord = Word.new
recordWord.s = word
end
if recordWord.count.nil?
recordWord.count = 1
else
recordWord.count += 1
end
r...
I'm doing a project to manage membership and other kind of payments, but mainly membership so I created a polymorphic schema. any idea, improvement, for some reason I don't fully convinced about the schema.
as you will see, the idea of having month, year NULL-ABLE is allow save record of any other payment
CREATE TABLE IF NOT EXISTS `o...
Does anyone have an idea for a scipt that can check an array/XML of table definitions with the current database tables and make appropriate alter/create queries to synch them? I'm currently using php5 and mysql 5.
...
What's the best way to dump a MySQL table to a file in Perl?
I've been using:
open( FILE, ">$filename" );
my $sth=$dbh->prepare("select * from table");
$sth->execute();
while ( my $row = $sth->fetchrow_arrayref ) {
print FILE join( "|", @$row ), "\n";
}
...
Hi
I have a simple table as below.
CREATE TABLE `stats` (
`id` int(11) NOT NULL auto_increment,
`zones` varchar(100) default NULL,
`date` date default NULL,
`hits` int(100) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
So just storing simple hits counter per zone per day.
But I ...
My Perl app and MySQL database now handle incoming UTF-8 data properly, but I have to convert the pre-existing data. Some of the data appears to have been encoded as CP-1252 and not decoded as such before being encoded as UTF-8 and stored in MySQL. I've read the O'Reilly article Turning MySQL data in latin1 to utf8 utf-8, but although it...
I have data stored in relational database mysql and PHP.
I have a table called "rel" which has two fields:
from_node | to_node
=====================
1 2
1 3
2 3
and so on......
How can I calculate the network Diameter of a network. I know it is the longest or shortest path between any two p...
Has anyone been successful doing this w/o php, asp, etc...? I can get this far: http://www.pastey.net/113859/20 but can't figure out a simple way to make it an HTML list... any help would be GREATLY appreciated.
...
If I have a joining table with two columns, TeamA and TeamB, how can I ensure that each pair is unique?
Obviously I can put a unique composite index on these columns but that will only ensure uniqueness in the order A,B but not B,A correct?
TeamA | TeamB
-------------
red | blue
pink | blue
blue | red
As you can see, Red vs. Blue...
Parse error: syntax error, unexpected $end in blah/blah/blah.php line 1
This is the error that I receive, with this code
<?php
include("db.php");
if (isset($_POST['username']) &&
isset($_POST['password']) &&
isset($_POST['email']))
{
//Prevent SQL injections
$username = mysql_real_escape_string($_POST['username']);
...
I'm currently running some SQL which uses an IN expression to match against multiple IDs. However, I would ideally like to be able to match up certain IDs with others so they must appear together to return a result. Here's an example:
Edit: The IDs I'm matching are a part of a many-to-many relationship. The structure is like this:
Arti...
In my User model, I want to search for whether a user has multiple accounts (aka 'multis').
Users have sessions; sessions are customized to set
creator_id = ID of first user the session was logged in as, and
updater_id = ID of last user the session was logged in as
(Both columns are indexed.)
If I detect that the two are different...
Hi,
I have two Models: Job & Location:
class Job(models.Model):
title = models.CharField(max_length=20)
company = models.CharField(max_length=20)
location = ForeignKey('Location')
class Location(models.Model):
country = models.CharField(max_length=20)
state = models.CharField(max_length=20)
city = models.CharField(m...
I am working on a database that contains 3 tables:
A list of companies
A table of the products they sell
A table of prices they offered on each date
I'm doing a query like this in my php to generate a list of the companies offering the lowest prices on a certain product type on a certain date.
SELECT
a.name AS company,
c.id,
M...
I know in SQL Server this is possible using linked servers. Is there some analogous way to do this in mySQL?
Thanks!
...
I have a file host website thats burning through 2gbit of bandwidth, so I need to start adding secondary media servers to store the files. What would be the best way to manage a multiple server setup, with a large amount of files? Preferably through php only.
Currently, I only have around 100Gb of files... so I could get a 2nd server,...
Is the combined use of NHibernate (LGPL) and MySQL Connector/Net (GPL) inside a commercial (non-GPL) product legal if the commercial product only directly talks to NHibernate and NHibernate is talking to the MySQL Connector/Net? (And if so what part of the license(s) is telling me that it is?)
Here is what I think to know so far (correc...
I am trying to implement NOT NULL constraint in the customer table which is created as:
CREATE TABLE CUSTOMER(
cust_id INT(5) NOT NULL AUTO_INCREMENT,
PRIMARY KEY(cust_id),
first_name VARCHAR(25) NOT NULL,
last_name VARCHAR(25) NOT NULL,
email VARCHAR(25) NOT NULL,
password VARCHAR(25) NOT NULL,
gende...