mysql

Suggestions for writing a code flowchart

I'm nearing the end of my internship this summer, and I've developed a tool for my mentors that involves primarily PHP, MySQL, JavaScript (jQuery). Does anyone have any templates or suggestions or links on creating an easy to read document showing the code structure of the program and the relationships between the files? These guys are...

Copy blob data from one table to another on MySQL

I need to copy a set of data from one table to another that includes a BLOB column. I'm using an INSERT query with a subquery SELECT: INSERT INTO dest_table(field1,field2,field3,blobfield,field4) (SELECT t.myfield1,t.myfield2,t.id,t.blobfield,'SomeConstant' FROM tablename t) All fields get copied correct, except the BLOB. I know I'm m...

Custom ORDER BY to ignore 'the'

I'm trying to sort a list of titles, but currently there's a giant block of titles which start with 'The '. I'd like the 'The ' to be ignored, and the sort to work off the second word. Is that possible in SQL, or do I have to do custom work on the front end? For example, current sorting: Airplane Children of Men Full Metal Jacket Pu...

integrating php mysql and voip and text to speech

Im looking for a starting point of writing an application that will allow a php/mysql program to interact with a VOIP caller(s). The idea is caller calls into a number, and that number reads text output from php/mysql based on menu options on the call. Where do i start with this project? Specifically, getting the voip to interact with ...

SQL: "NOT IN" alternative for selecting rows based on values of *different* rows?

Hello, everyone: How do you make an SQL statement that returns results modified by a subquery, or a join - or something else, that deals with information you're trying to return? For example: CREATE TABLE bowlers ( bowling_id int4 not null primary key auto_increment, name text, team text ); Someone might incorrectly be on more tha...

MySQL replication speed

Lets say we have 3 servers on a local area network: APP - php app server MASTER - master Mysql db server SLAVE - slave Mysql db server (replicating MASTER) In the one code block (php) APP inserts into MASTER, retrieving the last_insert_id which it then uses to select the data it just inserted from SLAVE. So the question is, will the...

adding 1 day to a DATETIME format value

In certain situations I want to add 1 day to the value of my DATETIME formatted variable: $start_date = date('Y-m-d H:i:s', strtotime("{$_GET['start_hours']}:{$_GET['start_minutes']} {$_GET['start_ampm']}")); What is the best way to do this? ...

Integrating my PHP code into my site.

I did my programming before integrating into a design and I have to admit I am quite stuck on the whole situation. Here is my structure: System Files Admin (Admin files) Functions (Admin Function folder) User (User Files) Functions (User Function folder) Normal Visitor Account Files ( In system files folder). This whole direct...

Can't install mysql gem on windows 7

Hello, I'm trying to install the mysql gem under Windows 7 x64. Ruby -v is ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32] and gem is 1.3.4. So the problem is, when I try to "gem install mysql", I get the following error: D:\ruby\lib\ruby\gems\1.8\gems\mysql-2.7>gem install mysql Building native extensions. This could take a whil...

extracting hour value from a DATETIME format

How would I get the hours from a DATETIME format variable. Example: 2009-08-17 13:00:00 And I just need to get '13' ...

C# SQL database console application

I'm not very familiar with the console application but i think its kind a interesting subject to learned. I searched for tutorials and references related to connecting MySQL database in console but no luck. So i just try and error. Please correct me I'm wrong.. I had an application where when user run the program, it'll store values to ...

previous - next query in mysql

I have a table in database that is having unique id's. I have a page where one particular id is shown and link is given for next and previous id's. I have to get those prev and next id's by one single mysql query .All i have is that particular id on whose data we are currently working on. id's are not consecutive numbers as sometimes som...

MySQL - insert japanese from PHP - Encoding Troubles! [SOLVED]

Hello! I'm trying to insert some japanese words in a mysql table! If I insert 'こんにちは' using phpMyAdmin, the word is displayed fine from phpMyAdmin. But if I try to insert it through php, as follow: mysql_connect($Host, $User, $Password); mysql_select_db($Database); $qry = "INSERT INTO table VALUES (0 , 'こんにちは')"; echo mysql_query($qr...

Why doesn't this query work?

I have this query: select count(id) AS num,date_id from table where FROM_UNIXTIME(date_id,'%d-%m-%Y')='17-08-2009' order by date_id DESC; This should result in all the id's posted on today's date, but it is giving only one id (the highest one). When I remove count(id) from this query, it runs fine. Why doesn't this count work with...

Is it possible to take two rows and concatenate them in MySQL?

I have two rows of data and I would like to know if it is possible to put all results in a single row? 1 var1 var2 2 var4 var5 to 1 var1 var2 var4 var5 Thanks! ...

Left Join with all rows from the left not matching the Where Clause

Hi, I have the following problem: I have an account table and an entries for account table. account_id account_name entry_id account_idfk entry_date entry_amount Now I want to query all entries for all accounts in a given period. Eg. I want all Entries for all accounts from October 2008 - October 2009. If there are no entrie...

Execute MySQL update query on 750k rows

I've added a field to a MySQL table. I need to populate the new column with the value from another table. Here is the query that I'd like to run: UPDATE table1 t1 SET t1.user_id = ( SELECT t2.user_id FROM table2 t2 WHE...

How vulnerable is my code to SQL injection?

Ok I don't want this to be a hacking advice question, so please don't down-vote for that. I work in a web shop and I've found some of our old PHP pages are vulnerable to SQL injection in the username and want to know how bad. We use a PHP string to embed the user input from the POST on the login form. $uname = $_POST['username']; $pas...

How much table overhead is too much?

I just saw in phpMyAdmin that one of our MySQL tables is 14MB in size, but has 10MB overhead. I'm guessing this is a lot! How much is too much? Should I run OPTIMIZE TABLE regularly? ...

which language to use for very large data set and lot of computation involved

The general idea of problem is that data is arranged in following three columns in a table "Entity" "parent entity" "value" A001 B001 .10 A001 B002 .15 A001 B003 .2 A001 B004 .3 A002 B002 .34 A002 B003 .13 .. .. .. A002 B111 .56 There is graph of entities and values can be seen as weight of dir...