xml.lt has announced the release of DIY Framework. It is an open–source web application framework based on MVC architecture, object–oriented PHP 5, MySQL, and XSLT.
The Model is database–backed and generated by Propel ORM tool, the Controller is inspired by REST and RDF, and the View is based on XSLT stylesheets as templates.
The framework allows clean and precise sever–side development with a fully object–oriented code, absolutely no mixing of PHP, (X)HTML and/or SQL code, resources that have nice meaningful URIs with no extra effort, and many other features. On the other hand, it is tiny, flexible, and not overloaded with buzzword things.
I have what is probably an easy question, but I've been Googling and don't quite know where to go.
I write and test MySQL queries on a virtual Apache server on my PC before transferring it to the live server on a website. At the moment, I write the MySQL through a command-line interface, which makes it very difficult (almost impossible) to go back and edit the query if I need to change things or have made mistakes. It seems to take much longer to develop things than it should!
At work, I use Teradata SQL and we have a nice graphical interface where we can type in SQL, edit it easily, save SQL to re-use and all those good things. It's much easier to develop in and also easier to copy and paste the query into other files, such as Excel or PHP.
Can anyone recommend a good equivalent program for MySQL?
Last month,I did a clean install of Ubuntu Feisty Fawn on my home computer removing the "dapper drake". But it is only now, I got a chance to sit down and install all necessary packages to set up my development server again.
With Dapper Drake, I had to use alien to convert MySQL5 rpm to .deb, because there was no version 5 in the repositories. Anyway, Feisty has all newest versions of software.
This is what I did for setting up my development server:
For installing MySQL server I ran the command: sudo apt-get install mysql-server. Then I installed the following:
MySQL Administrator: It is a Graphical User Interface for administrating MySQL: sudo apt-get install mysql-admin
MySQL Query Browser is a GUI for managing databases: sudo apt-get install mysql-query-browser
Apache: sudo apt-get install apache2
Apache Manual: sudo apt-get install apache2-doc
PHP: sudo apt-get install php5
PHP module for Apache: sudo apt-get install libapache2-mod-php5
Enabling public_html directories for users
Well, I am the only user in my computer. But I can create and edit files without running sudo if I have a public_html directory at my home. sudo a2enmod userdir. I then restarted Apache and created a 'public_html' directory in my home. Now I can access it with http://localhost/~username/.
Booking.com says it's processing "tens of thousands" of reservations a day, but more important that it's growing exponentially. Yet they commited to mySQL. Not Oracle, not DB2, not SQL Server, and not Ingres. Now it's always possible these people are out of their minds, or just enamored of freeware, but I doubt it.
ANALYZE TABLE analyzes and stores the key distribution for a table. The MySQL query optimizer is the magic inside MySQL that decides which keys, if any, to use to in the query. ANALYZE helps query optimizer to make accurate decisions by detailed analysis of the data, unlike query optimizer which makes quick analysis.
The command [...]
I have a query that worked fine against the MySQL 4.0.x binaries, but when I perform the same query on a 5.0.x install I have a problem. I'm using a query with a GROUP_CONCAT clause to put the results into a single field. This is a section of the query, just to show how I'm using it:
GROUP_CONCAT( DISTINCT album ORDER BY album SEPARATOR '||' ) AS album_list
The problem is that it seems to truncate all results at exactly 341 characters. Again, on 4.x it worked fine, but something changed in 5.x that now limits the size of the returned dataset. I read something about group_concat_max_len and a MySQL bug with utf8 columns (all of my tables are utf8). Has anyone come across this problem or a solution? How does one set the group_concat_max_len variable--is that an SQL command or a DB startup parameter?
Does anybody has an experience with japanese language with mySQL? my client asked to implement "two bite kanji". What should I set in mySQL in order to get it work? Thanks, Roman
I'm beyond rusty on my MySQL, and I don't have my book handy (I'm at work, it's not). I'm plugging along working on this little program and I run into this little quandry. I'm positive it's an exceptionally easy question, but sometimes (especially with me) the easiest questions are the ones that I just have no flipping clue on.
So...would this be a legal SELECT statement in MySQL?
SELECT this_value FROM table_a AND this_other_value FROM table_b WHERE `this` = `that`;
I'd upload it to the server and test it out, but I haven't bothered to put any data up yet. I'm just trying to get this down before I forget.
Short info: Is there a way to use a * operator in a query like so:
`SELECT newSrc.*, oldSrc.* FROM current_raw_table newSrc LEFT JOIN yesterday_raw_table oldSrc ON(newSrc.id = oldSrc.id) WHERE newSrc.* != oldSrc.*);`
to use mysql to compare two tables of data created by a `load data infile` where one table is today's and the other is yesterday. My tests with using *'s failed so plan B is to use my l33t programming skillz to generate a bunch of `if(newSrc.{fieldName} != oldSrc.{fieldName},"fieldName") as "{fieldName}",` then wrap the whole mess with concat_ws(' ',...);
but before I use said l33t skelz, I figured it might be smart to ask before I reinvent something else.
I have 3 development environments: Workstation at work, my laptop, and the workstation at home... my code is moved between all these machines with svn and it works perfectly, so it makes me wish I could do the same with development schema's or whole Databases.
Is there anything like svn for Databases? I know about and use replication, but that's a tad too much just to allow me to work from a coffee shop or catch up on some work on the weekends. Right now I have a fetchSchema.bat file for my windows machines that grabs the current schema/data from the dev server using mysqldump.
Which reminds me of another question for another post.
I'm sorry to disturb, I'm new in php and I have a trouble with this code:
It has to extract a row from a mysql database and make a html select of the value id_persona displaying also the value of the other fields (Nome, Cognome, Organizzazione) but it don't works properly. Choices on select are displayed like in the attached photo instead with the correct data .
Ok, so I have a fully UTF-8 MySQL database with a fully UTF-8 table. I have a php page which has "" at the top of the html section and "mysql_set_charset("utf8");" after my connection (it's php 2.2.3, so that's more or less the same as "mysql_query("SET NAMES 'utf8'");). I have all my php.ini mbstring stuff configured for utf-8:
mbstring.language = Neutral mbstring.internal_encoding = UTF-8 mbstring.http_input = auto mbstring.encoding_translation = On mbstring.detect_order = auto
and for what it's worth, echo mb_internal_encoding(); reports "UTF-8".
when I run a query that pulls out (in this case, Japanese, but say any) UTF8 data, it displays properly in MySQL Query Browser. With php in the above context however, it does not. Instead, it prints a ? corresponding to each character. When I use mb_detect_encoding(); on each such string, it tells me they are encoded as ASCII. The nearest I can tell is that somewhere between using mysql_query() and mysql_fetch_row(), things got messed up. Is this a bug? Is there something I'm missing? Any clues? Help!
This is a very interesting presentation (see below) on the technologies used to make Digg, the challenges faced along the way and how they overcame it. I would recommend it to any Web 2.0 startup architects.
In short Digg uses multiple MySQL slaves with a single master, multiple load balanced PHP servers which connects to random [...]
hey everyone, i have a website: http://thebigone.homeip.net with a form for users to put either 'chat' or news for the site. my question is: when someone tries posting in either of the text boxes and hits enter to create a new line the php doesn't pick up on this when it posts to the mysql backend. how do i keep the formatting of the textbox for the actual site?
I have a chronic problem with a fanfiction archive script I made. Since I've put it online, I hit max_user_connections in MySql very often, and my host is losing patience. The script opens a mySql connection (originally a normal one, now a permanent one by my host's suggestion) on loading and should use it for all the mysql calls forward. The archive is famous in the fandom and gets a lot of hits, but this shouldn't happen. I've tried to reduce the mysql calls at minimum, but I only get a few days reprieve. This is the code I use:
In db_layer.php:
function db_connect ($db_host, $db_user, $db_password, $db_database, $use_persistent = 0) {
What is auto reconnect in MySQL?
The MySQL client library can perform an automatic reconnect to the server if it finds that the connection is down when you attempt to send a statement to the server to be executed. In this case, the library tries once to reconnect to the server and send the statement again. [...]
A much dreaded MySQL error message during queries is “MySQL server has gone away”. An alternative message is “Lost connection to server during query”. This is a strange problem which afflicts a wide variety of PHP software including but not limited to WordPress. There are several causes for it. Let’s look at the common and [...]
I have a table with 341K records. When I query for all records with a certain string that have occurred in the in the last 24 hours, it returns in .66 seconds. When I sort that same query by any field, it returns in 3 minutes. Any thoughts on how to optimize this query for sorting?
mysql> describe eventlog_data ;
+----------+---------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------------+------+-----+---------------------+-------+
| host | int(11) | NO | MUL | 0 | |
| event | int(11) | NO | | 0 | |
| record | bigint(20) | NO | | 0 | |
| cname | varchar(255) | NO | | | |
| time | datetime | NO | | 0000-00-00 00:00:00 | |
| type | varchar(16) | NO | | | |
| log | varchar(16) | NO | | | |
| source | varchar(128) | NO | | | |
| message | text | NO | | | |
| notified | enum('y','n') | NO | | n | |
+----------+---------------+------+-----+---------------------+-------+
10 rows in set (0.02 sec)
mysql> select count(record) from eventlog_Data ;
+---------------+
| count(record) |
+---------------+
| 341414 |
+---------------+
1 row in set (0.00 sec)
mysql> SELECT cname, time, event, log
-> FROM eventlog_data
-> WHERE time > SUBDATE(NOW(), INTERVAL 1 DAY)
-> AND eventlog_data.message LIKE '%adm%';
SOME DATA RETURNED
16 rows in set (0.66 sec)
mysql> SELECT cname, time, event, log
-> FROM eventlog_data
-> WHERE time > SUBDATE(NOW(), INTERVAL 1 DAY)
-> AND eventlog_data.message LIKE '%adm%';
-> ORDER BY 1
SOME DATA RETURNED
16 rows in set (2 min 53.63 sec)