mysql

PHP.exe (CLI) can't connect to MySQL while Firefox can!

Hi, I have installed XAMPP on a Windows XP Machine. PHP scripts are working fine through the browser. Initially, PHP.exe (CLI) was failing with error - can't load php_pgsql.dll I disabled extension=php_pgsql.dll in the php.ini file and PHP.exe stopped to fail. However, even now I am not able to run a PHP script from the CLI even thou...

suggestion regarding my "question of the week" project

Hi, everyone! I am going to start on a new project for my school. I have to create a "question of the week" forum, where the members can post questions and their questions could then be voted by other members. The best question of that week will be discussed the week after, and the posting of the questions will take place again. I am ...

MySQL GROUP BY - get items in that particular group

I am using the MySQL GROUP BY function, and want to know if there is a way to get the number of items for that group without having to a query again? $homePointsPlayerResult = mysql_query("SELECT `player_id` FROM `conversions` WHERE `game_id` = '$game_id' AND `team_id` IS NULL GROUP BY `player_id`"); while ($players_with_points_convers...

Looking for great character set/encoding resources or tools for PHP webapp development

Hi guys, I've been having a lot of trouble with character sets/encoding while writing a multi-lingual web app in PHP in different places such as the shell, inside PHP itself, and in the database. I want the whole application to be UTF-8 throughout, so that I won't have to worry about converting anything back and forth anymore. Does any...

MySQL UPDATE query by primary key is sometimes extremely slow

A particular UPDATE query on our website sometimes runs extremely slow, and examines a lot more rows than necessary. It filters by the primary key, so I would expect that MySQL would always just need to examine one row. Here's some examples from MySQL's slow-query log: # Time: 090702 12:59:06 # User@Host: XXX[XXX] @ XXX [XXX] # Query_t...

Is there a way to stop MYSQL Delayed Inserts from the MySQL configuration?

Hi guys, I got stuck with a weird issue with one of our servers. I see there are delayed mysql inserts +--------+----------------+-----------+------------------+----------------+------+--------------------+------------------------------------------------------------------------------------------------------+ | Id | User |...

Limits on number of values in "IN" queries.

Given a query like the following: DELETE FROM FOO WHERE ID in (1,2,3,4,....); Is there an upper limit to the number of values in the inclusion? (I've seen Oracle complain at 1000, but that was a long time ago. I have no idea if that was installation-dependant, oracle-version dependant, etc. etc., or how mysql limits this. What are th...

mySQL - Using data from another table.field to determine results in a query.

Hello Hello, Buried in mySQL syntax and query structure problems once more. I'm currently doing this query fine:- SELECT DATE_FORMAT(`when`, '%e/%c/%Y')date , COUNT(`ip`) AddressCount FROM `metrics` WHERE `projID` = '$projID' GROUP BY DATE(`when`) This works fine to find the specific number of ip address's hit. However, what...

MySQL - updating all records to match max value in group

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 7, asdf , 1234-3, 0 Basically, what I want to do is set all numbers in the 'flag' feild to the max value related to a specific...

MySQL: Why is it ignoring the text in the form field?

I am trying to teach myself MySQL/PHP from the very beginning. The following code was lifted from various tutorial sites. I'm using phpMyAdmin provided by my webhost. I made a table with an auto-incrementing field called "ID" and another field called "first" (varchar, limit 30, not null). Then I made a simple form with one text field na...

two slightly different queries into one - use a conditional var?

Instead of executing 2 slightly different sql statements to get a total of 10 results can it be done with just one select? e.g select a , b , c from mytable limit 3 select a , b , LEFT(100, c ) from mytable limit 3, 10 ...

Creating your own TinyURL

Hello all, I have just found this great tutorial as it is something that I need. However, after having a look, it seems that this might be inefficient. The way it works is, first generate a unique key then check if it exists in the database to make sure it really is unique. However, the larger the database gets the slower the function ...

MySQL Monitor Replication

Hi, Does anyone knows any free alternative MySQL Enterprise Monitor? I need some tool, that allows me to monitor my 3 servers with replication without having to open ssh console, and use command line. Regards, Pedro ...

MY SQL Install

Hi Friends, Please, can some body pleae, advise on installing the log,data and other files for MYSQL. I am actually a MSSQL Server DBA and have no ideas about the MYSQL. I would really appreaciate your help. Thank you ...

Insert row from table in another database

Is it possible to INSERT...ON DUPLICATE KEY UPDATE into a table on the current database from a table on another database? The remote table has 3 additional columns which will need to be ignored (so can't do SELECT *). Also, is it possible to do multiple rows in one query? Thanks. ...

Mysql Connector Net 6.0.4 Setup - Failed to open XML file?

Attempting to install 'MySQL Connect Net 6.0.4' on a WinXP machine for integration with Visual Studio 2008. Near the end of the install process a error message appears that states: 'Failed to open XML file C:\Program Files\MySQL\MySQL Connect Net 6.0.4\svctag.xml,system error: -2147024786' After this message the install process fails....

How do I use the YEAR datatype in MySQL 5.1?

I am trying to set a datatype for a column on a new table in MySQL 5.1 to YEAR with a default value of 2009 but it will not allow this. Should I use another integer datatype instead and/or how do I use the YEAR datatype correctly? MySQL 5.1 reference: YEAR datatype ...

ASP .NET with MySQL - DeleteCommand syntax not working

Working on setting up a SqlDataSource connecting MySQL database to a ASP .NET GridView. The Delete Command is: DeleteCommand="DELETE FROM troutetracking WHERE id=?id" The Delete parameter is: <DeleteParameters> <asp:Parameter Name="id" Type="Int32" /> </DeleteParameters> When I run a delete link on the Gridview the following...

Can I tell Mysql which indices to keep in memory regardless of other indices?

My database is bigger than the amount of memory I have on the computer. I would like to keep a couple of most used indices in the memory regardless of all other caching. Do you know if it is possible, and if yes, how it can be done? ...

PHP and SQL Parsing

Say I have an array of table DDL queries and I want to get the name of each table being created. What would the best approach be for extracting the table name? So for example: $ddl = array( 'CREATE TABLE tableOne ...', 'CREATE TABLE tableTwo ...', 'CREATE TABLE tableThree ...' ); foreach($ddl as $tableDef) { $tableName...