CREATE TABLE `comments` (
`comment_id` int(11) NOT NULL AUTO_INCREMENT,
`comment_parent_id` int(11) NOT NULL DEFAULT '0',
`user_id` int(11) NOT NULL DEFAULT '0',
`comment_text` varchar(200) NOT NULL DEFAULT '',
`comment_created` int(20) NOT NULL DEFAULT '0',
`comment_updated` int(20) NOT NULL DEFAULT '0',
`comment_replies_c...
Hi,
I'm no php expert (a mere beginner) but need some help!
After hours searching Google and trying out about 100 different scripts, I finally found one that does what I need - almost.
Basically, my site has a button marked 'Export to Excel'. Visitor to site clicks button and a download begins containing all data from a specified tabl...
So what I'm trying to do is a bit tricky. I'm trying to come up with a sql query that will be able to return counts for specified time frames. So I have a table 'v'. Here is some basic data from Table v
Table v
_____________
id p_id created_at
1 1 2009-06-09 18:54:17
2 2 2009-06-09 21:51:24
3 2 200...
I usually store dates as integers using PHP's time() function in a MySQL database rather than using MySQL's date format simply because it's easier to manipulate when I pull it back out, but are there any disadvantages to this?
...
I have a table with two columns: price (int) and price_display (varchar).
price is the actual numerical price, e.g. "9990"
price_display is the visual representation, e.g. "$9.99" or "9.99Fr"
I've been able to confirm the two columns match via regexp:
price_display not regexp
format(price/1000, 2)
But in the case of a mismatch...
Is it possible to create a connection in a PHP class file and use it in all of the different methods in the class? I am trying to open a connection in the constructor and i get an error when i get to the close connection method saying that the argument that I've provided in the mysql_close() statement isn't a valid MYSQL-Link souce.
...
I have this a Table with a bunch of dates and prices:
Room Name, Price, Bookdate, etc
And I can transform it like so: (which essentially flips the columns)
SELECT availables.name, rooms.id,
MAX(IF(to_days(availables.bookdate) - to_days('2009-06-13') = 0, availables.price, '')) AS day1,
MAX(IF(to_days(availables.bookdate) - to_days...
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls i...
I have two tables:
article('id', 'ticket_id', 'incoming_time', 'to', 'from', 'message')
ticket('id', 'queue_id')
where tickets represent a thread of emails between support staff and customers, and articles are the individual messages that compose a thread.
I'm looking to find the article with the highest incoming time (expressed as ...
Hi everyone!
I need to know if there's a best way to optimize this kind of DB model :
Here's my tables :
[category]
idCategory
name
[postCategory] (a post can be in more than 1 category)
idCategory
idPost
[post]
idPost
post
[comment]
idComment
idPost
inputDate
comment
I'm going to have to display all the posts, from a specific ca...
i want to change column collation and character set of system database information_schema... can anyone give any input on how to do this?
is there any special priviledges i need for this
...
I would like to use mysql query profiler in the php script. So that after i execute any queries it need to display the execution time of the query.
Suggest the best way to use this also share any other scripts like query profiler.
...
Is there anything out there that given a MySQL database can create RESTful webservice endpoints? I'm ok with it doing stupid basic things to start with, as long as the data model is tunable after.
For bonus points it could understand foreign keys to join data, and create searching endpoints for indexed columns.
...
How can I simplify this code in MySQL?
SELECT name,
MAX(IF(to_days(thedate) - to_days('2009-06-13') = 0, price, '')) AS date1,
MAX(IF(to_days(thedate) - to_days('2009-06-13') = 1, price, '')) AS date2,
MAX(IF(to_days(thedate) - to_days('2009-06-13') = 2, price, '')) AS date3,
MAX(IF(to_days(thedate) - to_days('2009-06-13') = 3, ...
Hi there,
I have title (varchar), description (text), keywords (varchar) fields in my mysql table.
I kept keywords field as I thought I would be searching in this field only. But I now require to search among all three fields. so for keywords "word1 word2 word3", my query becomes
SELECT * FROM myTable
WHERE (
name LIKE '%word1%' OR d...
//$id=$_REQUEST['category'];
//$catid=mysql_escape_string($id);
$catid = isset($_GET['category']) ? (int)$_GET['category'] : 0;
$recordsPerPage =4;
0
// //default startup page
$pageNum = 1;
if(isset($_GET['p']))
{
$pageNum = $_GET['p'];
settype($pageNum, 'integer');
}
$offset = ($pageNum - 1) * $recordsPerPage;
//set the number...
I have a column named "situation" and "entityid".
Entityid Situation
1234 In the the world of of
3456 Total universe is is a
Can any one please give me query to find these type of higlihted words.
Thanks
Ramesh
...
Hi all!
I am having problems with subqueries in MySql. I have a table containing user groups. The columns are id, name and the properties with a comment describing each row:
(Id is INT, Name VARCHAR, all other TINYINT(1) (boolean that is)
ID | Name | login | post | manage
1 user 1 0 0
...
Hello everyone,
Is there a way to write a mysql query that takes two dates as inputs and gets the dates for each day in between those dates?
Exact Duplicate: http://stackoverflow.com/questions/510012/get-a-list-of-dates-between-two-dates
...
Hi everyone, I'm having issues creating a table for my ruby on rails app. It's driving me crazy! The following is returned when I try to create the table:
ERROR 1 (HY000): Can't create/write to file '/usr/local/mysql/data/test_development/users.MYI' (Errcode: 2)
It's worth mentioning I'm a total newbie, btw.
...