mysql

Myslq php update function problem

Hello i would like to ask how to create a php code for mysql to do the fallowing thing if active = 1 to do current amount + 2000 id, eid, amount, apply 1, apply 2, apply 3, active 1 1788 500 NULL NULL NULL 1 2 1956 1000 NULL NULL NULL 1 3 2035 ...

Is it bad to use user name as primary key in database design?

I was told by a friend: What unique key do you use? I hope you are not saving the entire user name --- this will use up too much table space! Assign an unique userID to each (unique) userNAME and save this userID (should be INTEGER UNSIGNED auto_increment or BIGINT UNSIGNED auto_increment). Don't forget to create a re...

Mysql query question

How can we prevent the the query "show databases;" or "show tables;" in mysql for any non root user.Is this possible.If so please provide an example or appropriate link...indicating this.. Thanks in advance........ ...

MySQL join question

Hi, Can anyone tell me if it is possible to combine the following two queries into one using a self-join and, if so, how to do it? Query 1: SELECT pm.username AS user, uc.content_id AS id, value AS filename, name, moderation_status AS status, uc.parent_content_id FROM myweb.ugc...

Unable to start MySQL from the terminal

I am quite new to the Macintosh, I have Mac OS 10.6 installed. I downloaded the mysql-5.4.3-beta-osx10.5-x86.dmg file and installed all the files properly. I have got MySQL server started in system preferences. Now I want to access MySQL from the terminal but I am unable to do it. I have tried mysql -u root. It shows "-bash: mysql: ...

The best way to join two dissimilar mySQL tables -- planning for django from python.

Hi all, table a (t_a): id name last first email state country 0 sklass klass steve [email protected] in uk 1 jabid abid john [email protected] ny us 2 jcolle colle john [email protected] wi us table b (t_b): id sn given nick email l c 0 steven klass ...

MySQL Order by multiple column combined (not order by field1 asc, field2 asc)

Hi all, it seems like a typical question but it's different. I have a table with an id and 3 timestamp fields (to simply). Initially all 3 fields are null, and they get filled with values. Examples of rows are: id time1 time2 time3 1 1259625661 1259643563 null 2 null 1259621231 null 3 1259625889 null 1259644511...

I have root access to all my mysql databases. how can i export/import all the databases at once?

I have root access to all my mysql databases. how can i export/import all the databases at once? ...

How do I draw a mysql polygon circle, and not a square?

The function below creates a polygon square out of 4 points and I assume the last 5th point closed the squar, I need it to have at least 24 points and to make up a circle. Any ideas? function getRadius($point="POINT(-29.8368 30.9096)", $radius=2) { $km = 0.009; $center = "GeomFromText('$point')"; $radius = $radius*$km; ...

MySQL error: key specification without a key length

I have a table with a primary key that is a varchar(255). Some cases have arisen where 255 characters isn't enough. I tried changing the field to a text, but I get the following error: BLOB/TEXT column 'message_id' used in key specification without a key length how can I fix this? edit: I should also point out this table has multiple...

How to best get 3 prior image and 3 later image records in MySQL query?

Hi there, I'll explain briefly what I want to accomplish from a functional perspective. I'm working on an image gallery. On the page that shows a single image, I want the sidebar to show thumbnails of images uploaded by the same user. At a maximum, there should be 6, 3 that were posted before the current main image, and 3 that were post...

Mysql EF Stored Procedure, did not generate C# part

I have mysql database with a store procedure. When I added to schema, I found in edmx this: <Function Name="abzac_GetByPage" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="paragraph" /> This I have in SSDL part. But nothing in Designer.cs file...

mysql - table design for embeding system

I am working on an embedment section on my site where users can embed different media from various services, youtube, myspace music, vimeo etc I am trying to work out the best way to store it. Users do not have to embed all of the options and can only embed one of each type (one video for example). Initially I thought just have a table...

ASP .NET - Format datevalue in GridView that pulls from MySQL table?

The MySQL database has a date field in this format: yyyy-mm-dd (2009-12-01) When this field is pulled into a Gridview the format changes to: yyyy-mm-dd HH:mm (2009-12-01 12:00) How do I get the gridview not to change the default database format? (most solutions that I have found recommend setting the value in asp:boundfield but thi...

mySQL join question.

The following line is giving an error message. $query = 'SELECT * FROM products AS p LEFT JOIN categories AS c USING ON c.id = p.category_id WHERE c.name = "Galleri1" AND p.status = "active"' ; $Q = $this->db->query($query); Data base structure. CATEGORIES CREATE TABLE IF NOT EXISTS `categories` ( `id` int(11) NOT NULL AUTO_INCR...

Adding an array to a MySQL column in SELECT

I have an array with as set of users and their respective karma: $some_array = Array ( [user_id] => Array ( [0] => 4 [1] => 3 [2] => 5 [3] => 1 ) [karma] => Array ( [0] => 129 [1] => 87 [2] => 13 [3] => 20 ...

Is it possible to save MySQL Workbench files as plain XML?

DB Designer had a lot of bugs but one outstanding feature was that database models were saved in plain XML by default. This allowed a user to diff file versions via SVN or Beyond Compare, easily finding any changes made to the database. Unfortunately, DB Designer's succsssor, MySQL Workbench, stores files in a proprietary MVW file form...

Storing dynamic form data in DBMS, looking for the optimal approach

While working on a project that will store a whole bunch of (completely different) forms I'm facing a design issue on how to store the values while keeping the database usable. Brief description: each 'document' contains a variable amount of questions (though a consistent amount per type of document) and matching answers. The most usab...

mysql/php - store html templates within the a database

I am wondering the best way to store html templates in a database where I am able to retrieve them and insert variables. Obviously I could store them as php and then 'EVAL' the record.... but I heard it was evil. is there a better way? :) edit: Sorry I wasn't clear... I tried to simplify it by saying html templates... what I really m...

Help with a DB query.

So I have a category table set up. Within this table there is a field called "id", "name","fk_parent_cat_id" (and more). The "fk_parent_cat_id" basically just ties one particular category to a parent category. Ok. That being said, how would I make a query that grabs the information on the category, but ALSO grabs the information on th...