mysql

What is the easiest way to turn a mysql result variable into a multidimensional array in php?

What is the easiest way to turn a mysql result variable into a multidimensional array in php? Thanks ...

Settings for uploading large files (video/mp4)?

Background: I'm planning on using the JW FLV Media Player for streaming some videos: http://www.longtailvideo.com/players/jw-flv-player/ Question: What settings, both PHP globals and php.ini, would I need to change in order to handle the uploading of large video files? Sub-question: Is there anyway, through maybe the .htaccess file, th...

Further information about last_query_cost in MySQL?

Hi, When doing query optimization, the SHOW STATUS query returns values that are easy to understand with some practice and explanation. But last_query_cost is obscure and poorly documented. The only thing explained is that it must be read as an anti-macho value: the smaller the better. But do we have further information about this hi...

how to do reverse fulltext search in MySQL?

By default it's like this: select * from main_table where match(col1,col2) against('search_item'); but what I want to fetch is the reverse, say,I've restored all the search_item(1000 records,for example), and I want to see which of them matches a specified row in main_table. Is that doable? ...

How to implement one time (per user) messages in a web app?

When you want to alert a user of something once (one time notes about new features, upcoming events, special offers, etc.), what's the best way to do it? I'm mainly concerned with the data representation, but if there are more issues to think about please point them out. This is my first time approaching this particular problem. So my ...

MySQL fatal error

Hi, When I run the folowing code, I get this error: Fatal error: SQL in /Users/allan/Sites/4is_site/casestudyall.php on line 105 (that's the last line in the code below. Is there a problem with my query? <?php if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } $query = "SELECT count(*) FROM ...

php inside javascript - No Contents found

Hi, I'm trying to integrate a js slideshow fade effect with php. It was working fine, but not anymore, I'm not sure what has changed. Now it shows an alert that says "No contents found". The connection to the database should be ok, there is content being displayed in other areas of the page. Any ideas where I've gone wrong? <script...

How to connect these 3 programming languages?

How to pass information in this flow: Flash(AS3) -> PHP, using XML -> Database(mysql) Can anyone write a simple code for that? Thanks. ...

Select unique row grouped by column with MySQL

My table looks something like: ID | Type 01 | a 02 | c 03 | b 04 | a 05 | b 06 | a I want to output the ID of the last added entries grouped by Type. ID is an auto-increment field so the last added entry is obviously the highest number. SELECT * FROM `table` GROUP BY `Type` ORDER BY `ID` DESC, `Type` ASC This groups the rows by Type...

How do you do an extended insert using JDBC without building strings?

I've got an application that parses log files and inserts a huge amount of data into database. It's written in Java and talks to a MySQL database over JDBC. I've experimented with different ways to insert the data to find the fastest for my particular use case. The one that currently seems to be the best performer is to issue an extende...

Resetting databases with having OneToOneField crossing different applications in Django

I'm getting the following error when I run ./manage.py reset app1: Error: Error: app1 couldn't be reset. Possible reasons: * The database isn't running or isn't configured correctly. * At least one of the database tables doesn't exist. * The SQL was invalid. Hint: Look at the output of 'django-admin.py sqlreset app2'. That's the S...

Offline MySQL Table Definition Generator

I'm looking for something similar to the table creation form from phpmyadmin, but it should simply display a CREATE TABLE statement in a textarea below the form. It should also not require MySQL, PHP, or even a server to work. I want this for times I'm working on projects and just want to whip up a quick table definition. I'll more than...

django character set with MySQL weirdness

I'm seeing OperationalError (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='") It looks like some of my variables are UTF8 strings 'name': 'p\xc7\x9d\xca\x87\xc9\x9f\xc4\xb1\xc9\xa5s Badge' Is this a configuration issue? If so, how can i solve it? I'd like to handle eve...

Finding events in a transaction file where more than 5 serial numbers appear in sequence within 100 transactions.

I've had an unusual client request in regard to fraud detection in an online raffle which I'm trying to build as efficently as possible by pushing as much of the task into SQL as possible. The structure is thus: table: codes raffle_code | ticket_type | sequence A00000001 Red 1 A00000002 Red 2 ... A0000...

MySQL - update all records to match last

I have a transaction table like so id , name , code , flag 1 , john , 1234-3, 2 2 , joe , 1111-2, 1 3 , paul , 1234-3, 3 4 , asdf , 1234-3, 3 5 , asdf , 1111-2, 5 6 , asdf , 1234-3, 8 Basically, what I want to do is get the last instance of a code check the flag and update all previous flags with the same code wi...

MySQL merge amounts in a 2 rows

I'm looking to create a sql statement that will update a large set of data. What I have is a table like id, transid, amount, narative1, narative 2, total, active 1 1234 23.2 NULL NULL NULL 1 2 1234 120.33 NULL NULL NULL 1 3 1235 98.00 NULL ...

Why is my MySQL date displaying as blank in PHP?

One of the fields in my database is of 'DATE' Type (field-name = 'post_date'). after fetching an array $record = mysql_fetch_array($queryResult); if I do echo $record['post_date']; I do not get any output (blank). What should I do to properly handle the date type? ...

array_push() vs. $array[] = .... Which is fastest?

Hi all I need to add values received from MySQL into an array [PHP], here is what I've got: $players = array(); while ($homePlayerRow = mysql_fetch_array($homePlayerResult)) { $players[] = $homePlayerRow['player_id']; } Is this the only way of doing it? Also, is the following faster/better? $players = array(); while ($homePlay...

REGEXP not working for ' (apostrophe) and -(dash) in mysql

I'm using REGEXP for search in a MySQL DB, but it is not returning the proper data when I insert ' (apostrophe) and - (dash) in the search query. Is there any solution to this? Here is the full query: select * from table where (field REGEXP 'SAN DIEGO | SAN DIEGO |^SAN DIEGO' or field2 REGEXP 'SAN DIEGO | SAN DIEGO |^SAN DIEGO' ) ...

Mysql outfile to current working directory?

Is there a way I can make the OUTFILE statement in a .sql file point to the path of the current working directory of the .sql file itself, without manually specifying an absolute path name? As it is now, the default location is the data directory of the schema that I'm working with (ie. C:\progra~1\mysql\etc\etc). Thanks! ...