I have the database table logs as the following:
I would like to extract the last entry of device, pollDate, status. For eg.
deviceId, pollDate, status
1, 2010-95-06 10:53:28, 1
3, 2010-95-06 10:26:28, 1
I tried to run the following query but the distinct only selects the f...
In PHP How can I send the Data entered by a user in a text field to a txt file inside of a folder on my server.
...
Hello everyone:
I've got a typical problem when trying to insert a date into MySQL.
The column defined in MySQL is of type DATE. My PHP version is 5.3.0
Apart from this date-related issue, the rest of my code works just fine.
And this is my PHP script to do this:
$tablename = BOOKS_TABLE;
$insert = mysql_query("INSERT INTO $tabl...
We have a large MyISAM table that is used to archive old data. This archiving is performed every month, and except from these occasions data is never written to the table. Is there anyway to "tell" MySQL that this table is read-only, so that MySQL might optimize the performance of reads from this table? I've looked at the MEMORY storage ...
I have inserted a hidden input in my comment form:
$ip = $_SERVER['REMOTE_ADDR'];
<input type="hidden" name="c-ip" value="<?php echo $ip; ?>">
Query :
$cname = removeXSS(mysql_real_escape_string($_post['c-name']));
.
.
.
$sql = "INSERT INTO guestbook (id, date, name, email, comment, ip, status) VALUES (' ', NOW(), '$cname', '$cemail'...
hi here is a short version of function which im using on daily basis, it works fine except it throws a warning 'No data - zero rows fetched, selected, or processed (errno. 1329)'. and since i start using this function with django there cant be any warning or error because it stop the whole process
i have read that there is no warning fi...
What options exist for creating a scalable, full text search with results that need to be sorted on a per user basis? This is for PHP/MySQL (Symfony/Doctrine as well, if relevant).
In our case, we have a database of workouts that have been performed by users. The workouts that the user has done before should appear at the top of the res...
How could I make this kind of query e.g. in MySQL
SELECT * FROM Table t
WHERE t.a IN (1,2,3)
AND t.b IN (4,5,6)
AND t.c IN (7,8,9) ...
so that the result would contain only the three rows:
t.a|t.b|t.c
---+---+---
1 | 4 | 7
2 | 5 | 8
3 | 6 | 9
The above query of course returns all the combinations of the values in the IN claus...
I have managed to get paging to work, almost.
I want to display to the user, total nr of records found, and the currently displayed records. Ex:
4000 found, displaying 0-100.
I am testing this with the nr 2 (because I don't have that many records, have like 20).
So I am using LIMIT $start, $nr_results;
Do I have to make two queries i...
Say for example I have the follwoing DB structure
Table book
id
title
...
Table Author
id
name
...
Table BookAuthor
id
bookid
authorid
And in PHP I have the following object
class Book {
var $id;
var $title;
var $authors = array();
function Book() {}
}
class Author {
var $id;
var $name;
function Author(){}
...
I'm trying to get a database populate so I can begin working on a project. This project is already built and I'm being brought in to help with front-end work. Problem is I can't get rake db:migrate to do any inserts. Every time I run rake db:migrate I get this:
== 20081220084043 CreateTimeDimension: migrating ========================...
I'm doing some data migration from a horribly designed database to a less horribly designed database. There is a many to many relationship that has a primary key in one table that corresponds to a comma separated list in another.
FK_ID | data
-------------
1,2 | foo
3 | bar
1,3,2 | blarg
Is there a way to output the FK_ID field ...
I have this query:
SELECT mt.*, fordon.*, boende.*, elektronik.*, business.*, hem_inredning.*, hobby.*
FROM classified mt
LEFT JOIN fordon ON fordon.classified_id = mt.classified_id
LEFT JOIN boende ON boende.classified_id = mt.classified_id
LEFT JOIN elektronik ON elektronik.classified_id = mt.classified_id
LEFT JOIN business ON bu...
I've got a C# application which takes a users notes which can include various punctuation marks such as commas, apostrophes, semicolons etc.
At the moment I'm getting my application to encode the strings and storing them into the database as base 64.
Is there a better way?
FYI: I'm using a MySQL through their ODBC driver
...
Quest
After a day of running (against nearly 1 GB of data), a set of statements are tumbling down to 40 inserts per second. I am looking to increase that by an order of magnitude or two.
SQL Code
The code to insert the information comes in two parts: a master record and detail records. The master record:
INSERT INTO MONTH_REF (DISTRI...
I'm trying to get Mysql to log all warnings to the log file. I'm running stored procedures, and I want to get at the warnings they generate.
...
I am trying to use the HDBC MySQL driver in my project. I seem to be having a problem related to target architecture of the processor.
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Since it can't read the file all the external refe...
Have a PHP/MySQL form with a dropdown box containing a list of 350 names. When any random name is selected, sometimes it works & displays info about that name from the database, and sometimes the form gives the error "No Database Selected".
Here's what I've tried, pretty much grasping at straws as I'm not a programmer:
Increasing max...
Given the following table
id parentID name image
0 0 default.jpg
1 0 Jason
2 1 Beth b.jpg
3 0 Layla l.jpg
4 2 Hal
5 4 Ben
I am wanting to do the following:
If I search for Ben, I would like to find the image, if t...
I need to convert my Mysql database to SQL Server 2005 database, Is there any tools available for this conversion.
...