mysql

How do I select from multiple mySQL tables and output to PHP?

I have at least 4 tables in MySQL for my PHP application (shortened it for this example) Agents - Agent_ID - Agent_Name Country - Country_ID - Country_Name Job - Job_ID - Job_Type Line_Items - Line_ID - Agent_ID - Country_ID - Job_ID Now, I need to select from Line_Items where Agent_ID = 1, and instead of echo-ing the Agent_ID, Coun...

BLOB data to simple string in DataGridView?

I am using C# & MYSQL to develop a desktop application. In one of my form I have a DataGridView (dgvBookings) and in my database table I have a table tblBookings which contains a field specialization of type BLOB. I am selecting data with following query, SELECT * FROM tblBookings WHERE IsActive=1; and then binding the data with Da...

Upload size problem in PHP and MySql

Hi! I am uploading files to a MySql DB through PHP. I am able to upload files upto 1MB size (found out by trial and error). Files greater than 1 MB in size are not getting uploaded. The MySql error printed by mysql_error() function in PHP is: MySQL server has gone away Can anybody please help me with this? The MySql server is up and ru...

Database web application for admin

Hi Does anyone know of any good web application(ideally free!) for administrating Microsoft SQL & other db applications? thanks in advance. ...

SQL - How to use SUM and MAX in same query?

I am working with a MySQL database version 5.0.41 (and PHP 5.2.6, though that may not be relevant to this question). I have a table called votes with the following fields: id, item_id, vote_value. Each time a user on the site submits a positive vote for an item, a new row is created with the corresponding item_id and a positive number (...

MySQL function to order string alphabetically

I'm wondering if there is a way I can pass in a string (varchar) to a (custom) function in MySQL and then have it output the string ordered alphabetically. I am unsure of how you would actually reorder the string. IN : dbca OUT: abcd ...

Bigtable to MySQL?

We're thinking of building some of our infrastructure on to Google AppEngine. But we're worried that if it does not scale, we'll need to export the data and run it on our own servers in future. Is there a way to export Bigtable to MySQL? ...

use python to access mysql

i am finally starting with python. i wanted to ask if i use the mysql db with python, how should i expect python to connect to the db? what i mean is, i have mysql installed in xampp and have my database created in mysql through php myadmin. now my python is in C:\python25\ and my *.py files would be in the same folder as well. now do i...

Browser crashes when about around 4 million records entered in MYSQL.

hello all I downloaded a database that was exported to the TXT format and has about 700MB with 7 million records (1 per line). I made a script to import the data to a mysql database, but when about 4 million records inserted into, the browser crashes. I have tested in Firefox and IE. Can someone give me an opinion and some advice about ...

In my sql set condition for table?

In mysql can I set a condition that a combination of two fields can never be the same??? Example: id-1 name-abc grade-A Now, another entry with name='abc' and grade='A' can not be added into that table ???? ...

Search MySQL Query

I have the below Code SELECT * FROM table WHERE MATCH(message) AGAINST ('Hello*') If the message string is like this "HelloWhatsHappening" It dosent Work return anything But if i have "Hello WhatsHappening" It works fine It will also work if the string is as such: "Hello= WhatsHappening" Any Ideas? ...

How to parse out quoted values from a column with sql

I have a field that has values like this... s:10:"03/16/1983"; s:4:"Male"; s:2:"No"; I'd like to parse out the quoted values. its going to be some sort of combination of substr and instr its the doublequote i have issues finding its position. i have tried things like select substr(field_value, instr(field_value,'"'),instr(field_val...

Mysql - Insert queries inserting funny characters

Hi guys - I have a simple script which inserts values from a text file into a mysqldatabase - however some accented characters aren't inserted properly. Like lets say I have a word: Reykjavík I try to insert it using a simple insert sql statement and instead I this value ends up in the database???? Reykjavík How do I fix this? ====...

Add index on column or not?

I have a table looking like this: CREATE TABLE `item` ( `id` int(11) NOT NULL auto_increment, `title` varchar(255), `my_number` int(10) unsigned default NULL ); There are a hundreds of thousands of items, and I usually order them by 'my_number'. Will adding an index on 'my_number' increase performance on queries when I order by this ...

MYSQL:Looking for equivalent of Perl's "regex" =~ s/e/i/g => rigix in a MySQL Select

Can I match and replace a text pattern in a MYSQL select? EDIT For now it looks like the answer is: Can't be done, since you can't capture what was matched (from Eric's answer / comments). For now I will look into adding a lookup table. Simplified example: The MySQL table Coleridge holds many strings like: text ------------------...

MySQL Bit Data Type Storage Space

i am studying the mysql certification guide. at the Bit Data Type section, it says a BIT(4) sores 4 bit per value and that storage requirement for a BIT(n) column is (n+7)/8. i dont understand this part. shldnt a BIT(4) take up just 4 bits of storage? ...

Get result row count for individual SELECT statements with UNION ALL in MySQL when using LIMIT

Hi all. I need to get the row count for individual SELECT statements in an UNION ALL SELECT query that uses LIMIT. The MySQL docs are pretty clear about getting the global row count for the query (place individual SELECTs in parenthesis and place an SQL_CALC_FOUND_ROWS only in the first statement, then get FOUND_ROWS() the usual way). Ho...

MySQL Fire Trigger for both Insert and Update

Is it possible to fire a mysql trigger for both the insert and update events of a table? I know I can do the following CREATE TRIGGER my_trigger AFTER INSERT ON `table` FOR EACH ROW BEGIN ..... END // CREATE TRIGGER my_trigger AFTER UPDATE ON `table` FOR EACH ROW BEGIN ..... END // But how can I do CREATE TRIGGER my...

MySQL naming conventions, should field name include the table name?

Hi, A friend told me that I should include the table name in the field name of the same table, I wondering why? And should it be like this? Example: (Table) Users (Fields) user_id, username, passowrd, last_login_time I see that the prefix 'user_' is meaningless since I know it's already it's for a user. But I'd like to hear from y...

PHP MYSQL Hyperlinks and Forms again

Guys, am not having much luck...and I've tried and tried. Have included the code below. Am doing this in Dreamweaver hence the funny code. This is the edit page. I successfully parsed 'bet_id' value from Page 1 to this page. It populates the form fields with the correct 'bet_id' and 'category_id' values based on the value parsed from pag...