I'm not sure how to create a threaded comments system in PHP and MySQL which can handle hundreds of comments at a time.
Something like this is the only thing I can come up with
$query = execute_query...('SELECT * FROM `comments` WHERE `post` = "1"');
foreach($query as $comment){
$replies = execute_query...('SELECT * FROM `comment_r...
I've got a minor problem with a database admin page that I use to update values and totals in a MySQL database for generating various figures and data for a website.
A bit of background - the database table in question holds fundraising totals for a charity bookstall, with the table having three columns - id, date, and amountraised. Sum...
I have two queries
select TC,li,it as ee from results
where li = "not_applicable" and cpirt = "uu_X1"
The above query will output 10 results,
but If I put count in the same query, there is only one results.
select TC,li,it,COUNT(TC) as ee from results
where li = "not_applicable" and cpirt = "uu_X1"
How can I make the second quer...
If i run every block of this script in mysql-query-browser, it works.
If i run it as mysql db < script.sql it gives me an error[1] that the documentation says it's for using reserved keywords.
Already tried to use ; everywhere.
-- table
CREATE TABLE `days` (
`day` date NOT NULL,
PRIMARY KEY (`day`)
) ENGINE=MyISAM DEFAULT CHARSE...
hello everybody,
i wanna build a database-wide unique id. that unique id should be one field of every row in every table of that database. i have different ideas on how to achieve this, and really like to know whats your opinion...
First idea is to create one master-table with an auto-increment-field and a trigger in every other table,...
My database is not in UTF8, and I'd like to convert all the tables to UTF8, how can I do this?
Thank you.
...
Hi folks
I'm trying to create a PDF based on the information that resides on a database. Know I need to retrieve a TIFF image that is stored as a BLOB on a mysql database from Java. And I don't know how to do it. The examples I've found shows how to retrieve it and save it as a File (but on disk) and I needed to reside on memory.
Table...
Hi, I'm working with PDO connection for mysql and I'd like to have some opinion on a query I use to check if tags are present on the database, and to add it in the case it isn't.
// the tags are allready processed in $tags array
$check_stmt = $connection->prepare ("SELECT * FROM tags WHERE tag_name = :tag_name");
$save_stmt = $connect...
Brief background - Im writing a special import manager to be run via cron. The basic operation is:
Delete all records from table
Load data from a file or a string into the table
Not to difficult, however because of the apocolyptic delete at the beginning of this sequence id like to use a transaction so i can rollback if anything goes...
Hey everyone, I wasn't really sure how to describe this in the form of a google search, so I've decided to come here and see if you guys can help. Basically, I want to know how I can translate the following pseudo-sql into an actual mysql query:
Select one random row
from `posts`
where (the user's id, which is supplied by the scrip...
I just migrated my dev environment from Ubuntu Linux to Mac OSX snow leopard. All of this was working on Linux. On both, I have used MySQL for Django's db.
Django's reset function is not issuing drop commands for all of my app's models. Here is my models.py (with the Forum and User object fields removed for brevity):
from django.db imp...
I'm using LabVIEW and the Database Toolkit to execute an SQL query, and it keeps barfing on this for syntax reasons. I'm using MySQL through the ODBC connector. Each line should have a newline character at the end except for the last.
The error LabVIEW is throwing is this:
Possible reason(s):
ADO Error: 0x80040E14 Exception
occur...
I have three tables -
Transaction:
ID TimeStamp
Discount:
Code Amount
Transaction_Discount:
ID Code
It's almost as basic as you can get.
Is there a more 'efficient' way to link these tables together?
...
I want to save tags related to a discussion post. The same as the 'tags' that Stack Overflow uses. What is the best way to do this?
I was thinking of saving them in the 'discussion' table as a single comma separated string, but I'm not sure if this is the 'fastest' way assuming there will be lots and lots of rows in the discussion tab...
I need to combine day, month and year in PHP in order to insert it to MySQL database. How I'll combine the day, the month and the year? I'm choosing the date from a drop down menu.
...
My Table structure looks like this...
| 2010-01-28 10:00:01 | Delhi | Application | up |
| 2010-01-28 10:00:01 | Delhi | Mysql | up |
| 2010-01-28 10:00:01 | Delhi | LAN | down |
| 2010-01-28 10:00:01 | Delhi | WAN | up |
| 2010-01-28 10:15:01 | Delhi | Application | up |
| 2010-01-28 10:15:0...
Hi GUys,
Im trying to save a record to a table aswell as an accociated record. The main table is called quotes and it has a hasmany link to the table quote_items. quote_items belongsto quote
When i try and save it saves the record in quote but does not save the record in quote_items
.
Below is my quote add function
function add(...
I am trying to generate a simple list from a series of tables in a MySQL database. The SQL I am using is:
$resource_sql = "SELECT prod_spec_sheets.spec_uri, prod_spec_sheets.spec_title,
prod_photos.photo_uri, prod_photos.photo_title,
prod_diagrams.diag_uri, prod_diagrams.diag_title,
prod_ies.ies_uri, prod_ies.ies_title,
prod_instruc...
Hi,
from a resultset of about 5 different strings, I would like to select the result of which the string resembles my given string the most. Is there any possibility to do this in mysql?
...
Hello,
Here is my table X:
id vals
---------------------
1 4|6|8|
Now table Y:
id name
--------------------
1 a
4 b
6 c
8 d
Now I want the following:
select * from Y where id IN (replace(select vals from X where id = '1'),'|',',')
But this does not seem to work. Any ideas why?
...