mysql

Removing INDEX from a mysql table

How to delete INDEX from a mysql MyISAM table using the command "myisamchk"? The ALTER TABLE products DROP INDEX productname command gives a Error message "Lost connection to MySQL server during query" continuously. The table contains around 4million records Thanks ...

If I reset the auto-increment in MYSQL...it won't mess up anything, right?

My auto-incrementing primary keys are getting too high. I'd like to reset it. 1, 2, 3, 4, 5, 6. If I reset it to 0, the next inserted row will be 7, right? How do I reset the autoincrement? ...

How to search for record in mysql using php?

Thanks for all your help, I now have add, update, and delete functions on my database manipulation program. But I'm having difficulty on searching for records in mysql database. Please help me in correcting my codes, and if you know a site that I can use as my reference please do tell. Thanks, here is my search code: <?php ...

Why does it take so long to rename a column in mysql?

I have a 12 GB table full of pictures, I'm trying to rename the blob column that holds the data, and it is taking forever. Can someone give me a blow by blow account of why it is taking so long to rename the column? I would have thought that this operation would be pretty quick, no matter the size of the table? EDIT: The query I ran is ...

Joining tables in MySQL question (php)

Hi, Situation: In my database I have a table called 'artists' and 'tags'. Each artist has a set of tags, saved in a linking table 'artisttags'. Each unique tag is saved in a table called 'tags'. Problem I would like to show all artists that have one (or more) tags in common with a given artist. function getSimilarArtists($artist_...

Save Email Password? - Is this secure?

Hello guys, today there was a big problem i got wile programming on my newest project. I have to save the Users Email-passwords in my system ( php + mysql ). I do it now this way: Is this secure? And when not what is a better way to do it? greetz from white Vienna Dom ...

List records in mysql using php

This is the last thing I'm gonna do, after I can make this work, I can produce to designing which might be a lot easier. Thanks for all your help. I want to list a record from mysql using php by typing a query in the text box. Then the program will list all the records that has that element, for example address. Here is my code: ...

insert am pm from front side and store in time field of mysql

I m entering date in front side as 10:00 AM 12:00 PM etc...( means AM/PM format). now i want to save that value in databse in time datatype field, how do i save that am pm value into time datatype in mysql and again want to show as am pm on front side?? ...

MySQL query help

I really need some help with forming a MySQL query that I just cannot work out. On my website I have a system in place that will hopefully remember some selections that user made when they last visted the site. On the site the user can select which category they wish to read the content of next time they come to site. That setting will ...

MySQL FULLTEXT search

How do you add a column to a fulltext search in MySQL to indicate which words were included in the search? ...

Corrupt UTF-8 Characters with PHP 5.2.10 and MySQL 5.0.81

We have an application hosted on both a local development server and a live site. We are experiencing UTF-8 corruption issues and are looking to figure out how to resolve them. The system is run using symfony 1.0 with Propel. On our development server, we are running PHP 5.2.0 and MySQL 5.0.32. We do not experience corrupted UTF-8 char...

Changing from raw sql to codeigniters active class

I have this SELECT * FROM categoryTable WHERE categoryId NOT IN ( SELECT categoryId FROM userMenuTable WHERE cookieId = 'bang4b544417a41b6' ) but I would like it use codeigniters active record class so using $this->db syntax, I was hoping someone would help me convert this? ...

How to add more than one WHERE statements in MySQL?

Can anyone give me some examples to make query which has more than one WHERE statements please? I have the following query and I want to add WHERE privacy = 'public' $query = $this->db->query("SELECT DATE_FORMAT(eventDate,'%d') AS day,eventContent,eventTitle,id FROM eventcal WHERE eventDate BETWEEN '$current_year/$current_month/01' A...

Which method of SOLR implementation should I use; 3 Questions?

I have a classifieds website which I am now trying to integrate SOLR into, so searches becomes faster... I have currently Mysql as a db for all my records, and I use PHP to query it and display results. I have three main questions: If I was to implement SOLR, how is the standard way of doing it? And, I have not understood if I should ...

Rebuild InnoDB Index ONLINE to prevent timeouts?

When I update a particularly large table, the update times out because the table is locked while the indexes rebuild. Is there any way to rebuild the index ONLINE (i.e. Oracle) so the update does not timeout? ...

MySQL / PHP transaction behavior

Given: mysql_query("START TRANSACTION"); mysql_query("UPDATE foo = 'bar'"); die(); die() stops the transaction before I can COMMIT or ROLLBACK. Looking at my tables, it appears that the update doesn't take place, but if I run queries later in another script, are they still part of that initial transaction? Is the transaction still 'op...

Mysql Sub Select Query Optimization

I'm running a query daily to compile stats - but it seems really inefficient. This is the Query: SELECT a.id, tstamp, label_id, (SELECT author_id FROM b WHERE b.tid = a.id ORDER BY b.tstamp DESC LIMIT 1) AS author_id FROM a, b WHERE (status = '2' OR status = '3') AND category != 6 AND a.id = b.tid AND (b.type = 'C' OR b.type = 'R') AN...

[PHP + MySQL] Building a tree view

I'm a little stumped on this problem and I've been thinking about it for a while now. I have a table in my DB that holds a tasks. Each task can have a parent task by holding it's primary key in the parent_id field. I have no limit on how deep these tasks can be linked. +-----------+-------+-----+ | Field | Type | Key | +-----------...

displaying records that could not be updated mysql

Hi, I am trying to update my results table with matching values from another table. While, updating , is there any possibility to display records that have not been updated(not matched)? BEGIN WORK UPDATE results, testcases SET results.testset = testcases.TestSet WHERE results.TestCase = testcases.TestCase ...

MySQL Trigger Update child table when parent it's updated

Hi :D In theory I mean who are the triggers but it is currently not as fix this, I'll try to explain it to see if someone can give me a wire. I have a system that is weekly and contestants have a structure of my database in this way. 1 .- There is a table called Usuario_Semanas_Concurso in this table have a PK call id_semana_usuario t...