mysql

Proper sql query in MySQL

I have table like this: Name Result T1 fail T2 pass T3 pass T2 fail T4 fail T1 pass T4 fail Now, I want to get a results like this: Name Result T1 pass T2 pass T3 pass T4 fail I tried using query like this, but it does not work. select (case when Result = "pass" then "p...

Retrieve first sentence of article stored in MySQL table

I need to display the first sentence (up to the first full stop) of each article in my database, using MySQL. Can someone please help me? ...

IfNull function in mysql doesnt seem to work for me....

IfNull function in mysql doesnt seem to work for me.... When i executed this query select t1.dAccHeader_id,t1.dAccHeaderName,t1.dAccHeaderAcronym, t2.dDesignationName as incharge1, t3.dDesignationName as incharge2,t4.dDesignationName as incharge3 from tbl_accountheader as t1 inner join tbl_designation_master as t2 on t2.dDesignation_id ...

how to repoair MySQL table? (can't do it with phpmyadmin)

I had a table with complicated columns, i started to fill it with a heavy data, during that, it crushed. table reported as crushed and need to be repaired. Repair Table in phpmyadmin could not repair it. then i decided to start filling process again, but i even could not retrieve table structure. How can i get data back? or just stru...

Inventory Architecture in Database

Hello, This is not a question related to a specific language, rather on the correct methodology of architectural of handling inventory. Consider the following structure for storing software: platforms (platformID*, platformName) titles (titleID*, titleName) And the following is a joiner table for unique products products (platform...

Mysql table design : table roles

Hello, I have a table called enterprise in my database. If the entreprise expresses its demand to my company, the enterprise will become our prospection. And after, if the enterprise accept my company's proposal, we will sign the contract, and enterprise becomes out client. Now, i have created 3 tables which are enterprise, prospectio...

PHP MODx mysql Parse error? Where do I change the settings?

Hi I'm using modx on a site but somthing has gone wrong with the database. Any idea how do I can change the php to point to my database? Thanks for your help Regards Judi « MODx Parse Error » MODx encountered the following error while attempting to parse the requested resource: « PHP Parse Error » PHP error debug Error: mysql_conn...

php mysql compare long and lat, return ones under 10 miles

Hay i want to find the distance (in miles) between 2 locations using lat and long values, and check if they are within a 10 mile radius of each other. When a user logs in, their lat/long values are saved in a session $_SESSION['lat'] $_SESSION['long'] I have 2 functions This one works out the distance in miles and returns a rounded ...

Count the number of times a string occours in a row with the type SET

My database has got four columns: one, two, three and four each one has the type SET('a','b','c','d'). I want to know how many times a, b, c and d occurs in each column. I guess I could do something like this SELECT (SELECT COUNT(*) FROM database as d WHERE d.a = 'one') AS one, (SELECT COUNT(*) FROM database as d WHERE d.a = 'two') AS...

someone to help with MYSQLI & Stored PRocedure

hey i want to make a search feature with mysql stored procedures and php. how can i do this? i know how to call proc but how to send "q" input to procedure? thank you ...

HTTP Base SQLAlchemy database

Hi all. I have a little problem, I want to use SQLAlchemy (Elixr to be exact) to do some task on a RDBMS MySql on a web server I have in hosting. My Hosting provider does not allowe me to connect to MySql directly, just by php scripts... I was think to use a simple php script to tunnel the queies done by SQLAlchemy. There is some way to...

MySQLNonTransientConnectionException in jdbc program at run time

Hi I have created jdbc mysql connection. my program works fine for simple execution of query. But if i run the same program for more than 10 hour and execute query then i receives the following mysql exception. I have not used close() method anywhere. i created database connection and opened it forever and always execute query. there i...

PHP MySQL - Storing Configuration Then Reffering To The Config By Date

I'm building an Insurance Site, and will be selling policies online. I'm designing the database at the minute and need some advice on the best way to store the rates I'm using to calculate the premium. There's a clever way of selecting the rates, based on the date the policy was purchased - from a rates table, using like an 'effective ...

MySQL Sorting Results takes a long time

Lately I've been getting MySQL to hang on specific queries. I have a table with 500,000+ records. Here is the query being run: SELECT * FROM items WHERE (itemlist_id = 115626) ORDER BY tableOrder DESC LIMIT 1 Here is the explain: | 1 | SIMPLE | items | ALL | NULL | NULL | NULL | NULL | 587113 | Using where; ...

PHP Session Variables

A user will click on a link which will open a new page (code below). My problem is that when this new page is opened, it creates a NEW session ID. How do I stop this from happening? require_once('../../config.php'); //Database connection details require_once('../../connect.php'); //Connect to database session_start(); <--------...

How do I determine maximum transaction size in MySQL?

Saw the same question posited for PostgreSQL here; wondering if anyone knows (a) the MySQL flavour of the response and (b) which MySQL options I would examine to determine/influence the answer. I don't need an absolute answer btw, but if I were to propose inserting, say, 200,000 rows of ~2Kb each would you consider that very straightfor...

SQL Server 2005/2008 - Import a fixed width text file via the command line?

In MySQL I am able to create a table with fixed column widths and then can use the load data infile command to import a fixed width file. For example: Fixed width text file = JOHN 1234 Imports into table: Username - CHAR(8) Password - ChAR(4) The beauty of this approach is that the file is 'chopped' up based on the column size...

How to use mysqlimport to read in result of mysqldump --databases

I have successfully dumped an entire MySQL database using mysqldump --databases generating a nice .txt file. However, I can't see how to read the whole file back into MySQL in one go; mysqlimport seems to want just one table at a time. ...

Is the Centroid method implmeneted in MySql spatial?

Simple question, I'm wondering if the Centroid method is implemented in the MySql spatial extensions. I've looked at the documentation but wasn't able to find a definitive answer. ...

Create a list from SQL database using HTML/PHP

Im trying to create a drop down list/menu of users from my SQL database table. Could anyone help me with the code please? The code below is just for a normal list with options 1 & 2. How do i make the list retrieve all the items in a specific table using html/php/sql. Sorry im not very experienced with this, thanks in advance. <select n...