mysql

mysql decimal query issue

First off I am running mysql Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (x86_64) using readline 5.0 Sorry for the formatting but I don't have the ability to copy it so I have to type it in. the two fields in question are the following id int(11) startj1950 decimal(38,6) mysql> select id,startj1950 from store where id = 32513; ...

load myisam table key files to memory

I am using Myisam only Database. I want to load all the indexes into cache as suggested on this page. http://dev.mysql.com/doc/refman/5.0/en/load-index.html How do I know if the memory allocation is sufficient to hold the key cache files? ...

Problem connecting MySQL to Rails

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) I have a Rails application and I am getting this error. I have no idea how to find mysql connect it to mysql.sock. I am pretty sure i can go into config/database.yml and set the mysql.sock but where is it or do I need to reinstall it? When I do locate mys...

MySql table structure

At the moment, I have a table in mysql that records transactions. These transactions may be updated by users - sometimes never, sometimes often. However, I need to track changes to every field in this table. So, what I have at the moment is a TINYINT(1) field in the table called 'is_deleted', and when a transaction is 'updated' by the us...

How Can I add ellisis(three dots) to my pagination?

Possible Duplicate: how to add ellipsis to pagination? how can i add ... to this pagination script (1 2 3 4 ... 14 15 16) if (isset($_GET['p'])) { $pageno = $_GET['p']; } else { $pageno = 1; } // if $query = mysql_query("SELECT count(id) FROM m3_musicblog"); $query_data = mysql_fetch_row($query); $numrows = $query_data[...

what MySQL permissions are required for mysql_real_escape_string()?

what MySQL permissions are required for mysql_real_escape_string()? i want to create a db user with the minimum abilities specifically for using with mres()... ...

CRON behaves exactly like running a script in the browser?

I never used CRONs and I don't know hot to set up one so I use online cron websites to do it. Now I'm using http://www.setcronjob.com/ free account for testing. I use this service to run a script that fetches data from the web. The script uses PHPs file_get_contents and cURL. I want to know if running a CRON is behaves the same way as ...

Plain text vs Database Storage

I need to store a large string that represents music notation in text format. This string could be anywhere between a few lines to several hundred. I need to store meta data about the string (eg artist, instrument etc) in a database. I'm wondering, would it be better to store the large text string in a flat file or in the database? I ...

Caching strategy, when does caching become pointless?

I'm pretty new to caching strategies and implementations. I'm working on a project that will be database intensive, but also have information being updated and changed very regularly. I've found enough info to know generally how to develop the caching function, but what I'm unsure about is the general strategy. If I cache all query r...

How get text with preg_match till end of word?

I need to find part of string which is equal to string till end of word. Example i have texts: "Start play. I need..." "Start playstation play" "start play, work" "start player" "start pay with..." Then i searching for "/^start play/'i" and found all phrases, but i need only phrases which ends with word play: 1, 3, 5 preg_match('...

php/mysql user management

HI Im trying to figure out a way to differenciate between free users and premium users in a mysql database. Both users need to register with thier username, password and email. When premium users register though, i need a way of distinguising them from feee uers once in the users table. Is there a way of autamatically populating a f...

check for MySQL connection (OOP PHP)

I have various parts of my code that require me to check if a mysql connection is already established. Below i'm using if(self::$connection), but self::connection seems to always return "Resource id #6" rather than boolean - what am i doing wrong? class mysql_lib{ static $connection; static function connect($user = FALSE){...

MySQL database sync for workstation developement/testing

I need a local copy of our production database, and I need to refresh it every few days so testing and development is not working with terribly stale data. A few days old is just fine. Here is the pseudo plan: Write a script on the Production server that mysqldump's + gzip the database. Add a cron process to run the script every othe...

MySQL: Complex data structuring and querying

I'm having a bit of trouble figuring out what would be the best approach for creating the database tables for the following (rather complex) data structure and I'm hoping that someone with more experience than me could help out. The main reason for my trouble is both normalization and trying at all costs to avoid querying inside loops. ...

Using LAST_INSERT_ID() via PHP?

When I execute the following in the MySQL console, it works fine: INSERT INTO videos (embed_code) VALUES ('test code here'); SELECT LAST_INSERT_ID(); But, when I execute the above queries via PHP, the result is empty. Under the data abstraction, I am using a database access class named DB. This is how I have tried the above queries v...

ERD and SQL query help ?

Can you tell me if this is done right or if I need to improve some of them I have a hard time understanding the query's when there is an associative entity. List all donors SELECT* from Donor; List the first and last names of all donors SELECT dfname, dlname FROM donor List the phone numbers of donors number 106 and 125 SEL...

How many fields are too many when querying MySQL ?

Hi, I have read many times that we have to avoid reading too many fields when querying MySQL (or any database)...just query the fields you need. However I have a project where a table has 100 fields per record/row. The thing is that, everytime I query the database, I need ALL of the fields for further calculations, etc after the query...

jQuery, need help with 'sortreceive' ajax call and POST vars.

Hi there, I have a dilemma that just seems beyond my abilities at the moment! I have a group of connected sortables using the class 'biglist'. What I want to do is bind #biglist 's sortreceive callback (which is made whenever a list receives an element from another) to take the 'boxnum' value of the element (which signifies which list...

PHP/MYSQL: Why is my database all of the sudden case-sensitive for table names on my Linux server (and not on my XP server)?

how can i make it so that the tables are case insensitive? ...

MySQL query problem.

So far I can list all the students essays but I want to be able to display only graded student essays and was wondering how would i be able to do this? What else do I have to add to my MySQL code? Thanks for the help in advance! Here is what I got so far with my MySQL code. SELECT students.*, students_essays.* FROM students INNER JO...