Hello, I hate asking for code but I just can't seem to do the below -
Staff
| lastname - name - position |
| Henderson | John | A |
| Howard | Bob | B |
| Hendry | Chris | B |
Max_person
| lastname - change |
| Henderson | John |
| Howard | Bob |
| Hendry ...
I have a table 'images' which contains foreign keys from the tables 'event' and 'category'.
I have a function that displays all the events.
I'm able to select all events that are associated with pics in the images table, but i want to add another condition for category like:
select event from images where category is $category
Is...
Hello, I hate asking for code but I just can't seem to do the below -
Staff
| lastname - name - position |
| Henderson | John | A |
| Howard | Bob | B |
| Hendry | Chris | B |
Max_person
| lastname - change |
| Henderson | 0.9 |
| Howard | 0.2 |
| Hendry ...
I'm looking for a way to encrypt data on its way into a MySQL database, and decrypt it on the way out. Additionally, I would like to be able to perform normal SQL queries on those fields, such as searching and comparison, which prevents me from using a pure PHP solution.
This leads me to AES_ENCRYPT() and AES_DECRYPT(), which can be dup...
I have a field in my users table and I want to change about 1000 entries from "null" to a specific zip code... is there a query I can run?
...
Hi,
I have production DB(mysql) in server1, i want to transfer records from prod DB to another DB residing in server2.
How to link bother server's DB?
i.e.i want to transfer 60 days of data from 'table1 of DB of server1' to 'table1 of DB of server2'
Thanks.
...
I have a table containing a foreign key and I know the column name of that foreign key.
Is it possible, using this information, to determine the table to which that key links?
The reason for this is that the foreign key is dynamic and so I cannot determine the linked table in advance.
...
I'm using the following code to return a random row from a table. Using the field 'rand'.
SELECT *
FROM imgs
WHERE rand > RAND( )
ORDER BY rand ASC
LIMIT 1
The field 'rand' is generated by mysql at creation using something similar to:
INSERT INTO imgs SET rand = RAND ()
For some reason the results although changing each run are...
I'm selecting properties and joining them to mapping tables where they get mapped to filters such as location, destination, and property type.
My goal is to grab all the properties and then LEFT JOIN them to the tables, and then basically get data that shows all the locations, destinations a property is attached to and the property type...
Hello all,
I'm running a C#/.NET 3.5 App that uses the MySQL .NET Connector (6.2.3.0) to return data from a 64 Bit MySQL Server running on CentOS 5.
By and large, this works out pretty well. My problem is when I execute queries (procedures mostly) that contain SQL Like this:
SELECT
t.id AS ID
,COUNT(t.item) AS Ite...
Hi folks,
In creating unique custom reference codes (i.e. JOB1293XYZ) for a while I have been generating custom reference/hashes in PHP then checking my database to see if it already exists and if so generating another.
I'm curious if in MySQL it is possible to to generate the contents of a field based on the other fields in that row, ...
I have this query to count "views" in a table, by date. It obviously gives me only the dates where there has been activity, but I wish I could have MySQL return data for a selected period of time. For example 30 rows for a 30 day period, creating null data for dates where there are no matching rows.
I wish to avoid using PHP to figure t...
Hi all,
I'm running a web crawler that gets called as a separate thread via Django. When it tries to store the scraped information I get this error:
File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 147, in execute
charset = db.character_set_name()
InterfaceError: (0, '')
If I manually run the script from the command li...
Here is the log output:
# Time: 100915 13:06:49
# User@Host: ss[ss] @ localhost []
# Query_time: 13.978355 Lock_time: 0.000029 Rows_sent: 10 Rows_examined: 562760
use ss;
SET timestamp=1284574009;
SELECT DISTINCT
SQL_CALC_FOUND_ROWS
B.*,
U.username
FROM sc_users AS U,
sc_bookmarks AS B ...
Sorry for the crappy title - didn't know how else to say it.
I have a commenting database where anyone can report a comment for abuse (anyone as in not just logged in members). This obviously means a person could report a comment multiple times. Where I need help is building a query that shows the number of times a comment has been re...
In an answer on Stack Overflow, I saw this code:
CREATE TABLE Favorites (
user_id INT NOT NULL,
movie_id INT NOT NULL,
PRIMARY KEY (user_id, movie_id),
FOREIGN KEY (user_id) REFERENCES Users(user_id),
FOREIGN KEY (movie_id) REFERENCES Movies(movie_id)
);
I've never used the 'foreign key' relationship keyword before...
Ok, I've got a real head scratcher... I'm going bald!
This is a pretty simple problem. Inserting data into the table normally works fine, except for a few times, the insert query takes a few seconds. This isn't very good, so I setup a simulation of the insert process. I am NOT trying to bulk insert data. I am trying to find out why...
In our application, we support user-written plugins.
Those plugins generate data of various types (int, float, str, or datetime), and those data are labeled with bunches of meta-data (user, current directory, etc.) as well as three free-text fields (MetricName, Var1, Var2) .
Now we have several years of this data, and I'm trying to des...
Hi,
I need help with this code,I manage to extract data from a mysql database and convert them to a format required by Highcharts.
<?php
$query =mysql_query("select
date_format(connect_time,'%Y-%m-%d %H %i') AS date,
Customers.name as customer,
Sum(duration) as secondes
from CD...
Hi there,
In the past I would do something like so:
$sql = 'SELECT * FROM customers WHERE customer_email="' . mysql_real_escape_string($_POST['customer_email']) . '" ';
$res = mysql_query($sql);
// if there are no hits...
if(mysql_num_rows($res) == FALSE) {
Today I am doing the same thing however with prepared statements:
...