mysql

problem performing 2 actions using one link

I'm making a simple cart program in php. What the code below does is to update the current page, so that the quantity for the product that is bought will be zeroed. And then I tried to link it with another page, which performs another action(to update the database). What can I do with this experimental code that I made up: echo "<t...

make differential in DATE query in MySQL

what is the different from this mysql query: WHERE MONTH(date) = MONTH(CURRENT_DATE) and this WHERE date BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 1 MONTH) AND CURRENT_DATE() i have tried both but i cant see the different. ...

Import large csv file to mysql database using php

I have a very large CSV file (150 MB). What is the best way to import it to MySQL? I have to do some manipulation in PHP before inserting it into the MySQL table. ...

Statistics based on MySQL and PHP

Hi I'm about to generate some statistics based on the values of a MySQL table. I would like to generate some numbers foreach month of the year and foreach day of the month. I could of course do all this manually but that doesn't seem like a good approach :) So anybody who has some ideas on how i generate these statistics. OBS. I would...

Can Django use "external" python scripts linked to other libraries (NumPy, RPy2...)

Dear all, I am new to the world of IT business (serious) development but I have in mind a business idea and still trying to vizualize how the overall infrastructure should work. I have done some few research for a good technology to deliver the solution. I am very inclined to use Python, MySql, Django (Apache) on the server side and so...

How to use jQuery SlickGrid with PHP / MySQL (load server data and save changes)

Please, in all the examples found in the SlickGrid code, the data array was randomly generated on the client side. Getting: I need to know how to use PHP to fetch this information from a MySQL Database and return it using jQuery / AJAX to the SlickGrid. Saving: I already found a link on StackOverflow for saving data from the grid using...

whats the best way to write a php mysql funtion?

i want to retrieve information from my database quite a lot throughout my app, i was thinking it would be easier to write function, so i can access it anytime, what is the best way to write one! thanks :)) ...

Code you're using to insert data into mysql database

Please, read this question carefully before answer or pressing "close" link. This question is about sharing experience, exchange of tips and tricks. What code you are using to insert data into mysql database? Just a snip of code from your real project. Preferably of CRUD type. I mean real code. Please, do not copy-paste code examp...

Can Ruby on Rails 3 work with MySQL on Windows 7?

I try to install Rails 3 on Windows 7, and rails new someapp -d mysql cd someapp bundle install will fail at mysql2 so, there is no way to use MySQL but to stick with SQLite3. But I tried rails new app_postgres -d postgresql cd app_postgres bundle install and it all worked. Does that mean perhaps Rails team favor Postgresql slig...

where deos foursquare or gowalla, get thier location data from?

i know foursquare uses google maps api, but how do they retrieve all the business location from google maps, do they save every location on thier database or just access it when a user checks in? sorry if i have confused you, but im so curious!! :)) ...

Saving special characters to DB then display using PHP

I have a script which caches a number of RSS feeds, however I have noticed that I've started getting strange characters appearing in the page where I output the cached contents (Stored in DB). For instance the RSS feed contains the characters: Introducing&#8230;: ... Which should read: Introducing...: ... However my page displays it a...

PHP time based upload script

hi guys, ive been commissioned to create a website, but one of the requirements is driving me insane. I have to create (or find) a php based script, that allows a user to login to the domain, upload a html file (+ images or audio files) and also specify the date, at which time the html page will be made accessible? eg. This is to allo...

Best way to create Singleton Table in Django/MySQL

I want a table which can only have one record. My current solution is: class HitchingPost(models.Model): SINGLETON_CHOICES = (('S', 'Singleton'),) singleton = models.CharField(max_length=1, choices=SINGLETON_CHOICES, unique=True, null=False, default='S'); value = models.IntegerField() def __unicode__(self): ret...

Error while creating new object in rails

hello, I am getting this error in rails whenever i am trying to create an object for the model. I am working on Windows 7 C:\Ruby\joker\chapter3>ruby script/console Loading development environment (Rails 2.3.8) >> mycb = ComicBook.new SyntaxError: C:/Ruby/joker/chapter3/app/models/comic_book.rb:19: syntax error, u nexpected $end, expec...

How to connect to remote MySQL server via SSH using JPA?

Hello, I'm trying to connect to remote MySQL server via SSH in my Java project. How can I integrate SSH connection with JPA? I'm using Netbeans 6.9.1, JPA, MySQL 5.2. Thanks ...

How to use index efficienty in mysql query

Hi: My db is running on mysql v5.x. I have a table T1 with 5 columns and column C1 is the primary key. C1 is of type varchar(20). It contains about 2000 rows with values like: fxg axt3 tru56 and so on.. Now my application's job is to read input data and find if the input data has a starting pattern similar to that found in column C1...

MySQL query for sorting by multiple date values

I'm creating a PHP script that fetches IDs from a database. The results are sorted by two datetime values, createdon and publishon. The priority of publishon is higher than createdon; however, publishon may also be NULL. publishon = null => sort by createdon. Can someone help me sort those rows? ...

Should I use index on a table that is updated frequently?

There are are 150 000 records in my comments table and about 1000 new comments are added per day... I wonder if I should use indexes on a table like this? Will it have positive or negative impact on performance? I use mysql... ...

Optimising a trivial MySQL query to get rid of filesort

Hi, I've got a trivial mysql query which isn't liked by the server really: SELECT zone_id, SUM(inc_sec) AS voucher_used FROM cdr_bill_2010_09 WHERE cust_id = 1234 AND voucher_id = 'XXXXXX' GROUP BY zone_id Now this should be really quick (and usually is) since there are indexes on both cust_id and voucher_id (voucher_id is chosen)...

why can't I fetch sql statements in python?

I have a very large table (374870 rows) and when I run the following code timestamps just ends up being a long int with the value 374870.... I want to be able to grab all the timestamps in the table... but all I get is a long int :S import MySQLdb db = MySQLdb.connect( host = "Some Host", user = "S...