mysql

MySQL installation problem

I'm working on Windows with Apache and PHP. I just installed MySQL, configured it, and started it. But when I run <?php phpinfo(); ?> I don't see the mysql section, which means that I cannot use MySQL commands in the PHP code, right ? Why is that ? Should I do any manual connection between MySQL / PHP / Apache ? ...

Updating records in database

guys, i have these codes for updating the records in the database. please.. check if these is correct? <?php session_start(); include "db.php"; $username = $_SESSION['username']; $query="SELECT * FROM members where username='".mysql_real_escape_string($username)."'"; $result=mysql_query($query); $num=mysql_numrows($result); mysq...

MySQL batch file update

One of my clients has an issue with his MySQL database. To solve the issue I need to just run a simple update on a table. I will need to send that to my client via a batch file. How do I run a MySQL update on a table via a batch file? ...

Help: Optimize this query in MySQL

This is my tables, the AUTO_INCREMENT shows the size of each: tbl_clientes: CREATE TABLE `tbl_clientes` ( `int_clientes_id_pk` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `str_clientes_documento` varchar(255) DEFAULT NULL, `str_clientes_nome_original` char(255) DEFAULT NULL, PRIMARY KEY (`int_clientes_id_pk`), UNIQUE KEY `st...

MySQL LIKE alternative.

Is there an alternative for LIKE. Note I cannot use FULL TEXT Search. Here is my mysql code. SELECT * FROM question WHERE content LIKE '%$search_each%' OR title LIKE '%$search_each%' OR summary LIKE '%$search_each%' ...

how to connect to mysql server through eclipse java editor

I am writing a java class which handles database in mysql i want to connect mysql through eclipses ...

Help with a MySQL query, selecting a maximum element

I have a table with 4 columns: place_id, username, counter, last_checkin I'm writing a check-in based system and I'm trying to get a query that will give me the "mayor" of each place. The mayor is the one with most check-ins, and if there is more than 1 than the the minimum last_checkin wins. For example, if I have: place_id, username...

Select MYSQL rows but rows into columns and column into rows

I want to select all the rows in my database but I want them in inverted sequence. Meaning, I want to use the first column data as the new entities and present entities as the first column. I think you got what I mean Here is an illustration id | name | marks ------------------------------- 1 | Ram | 45 ----...

How to select different columns from database each giving the sum(or similar) of another query result?

Here is sample query SELECT name, sum(SELECT id FROM mytable WHERE cond='1' and cond2='2') as mysum1, sum(SELECT id FROM mytable WHERE cond3='3' and cond4='4') as mysql2 FROM mytable WHERE userid='1' and status='1'; Obviously this does not work but I think you can now understand what I mean. How to retrieve ...

Setting the AUTO_INCREMENT of userid

guys, how can i set the auto_increment of my userid something like this: i want to start it in 200, then increment by 10 with a maximum value of 1000.. how will i code it using php? please help me.. :-( ...

Listing available users on a certain date

I'm looking at making a booking system and I need to display all the available users on a particular day/time. Thinking about it, I'm going to set up a table to keep note of when people AREN'T available, and assume that they are otherwise available. The structure I had in mind was to keep a note of the date_start of when they won't be a...

Load Javascript array with MYSQL database data

Hello, suppose i have an javascript array "userName".I want to load it from a database table named "user". Can anyone help with idea or sample code? Thanks ...

How to write this kind of SQL in MySQL?

I want to update a column col in table tab,whose data is like follows(comma separated, with the heading comma): ,test,oh,whatever,...., Which can be too long to display,how can I update the column so that only the first 10 words are left? ...

Ruby libxml parsing and inserting to database

Hello, I am currently trying to read from an xml file which records the jobs on a PBS. I have succesfullly managed to parse the code, but am unable to insert the objtects into my database, i receive this error: "You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred...

Database deploy with updates

Hi guys! Does anybody know how to do smart database update in realtime. E.g. I have a site with a great database. Suddenly I've made some code changes and database structure and data changes. Is there any standard plan to do it with deploy script or any deploy soft? In realtime without stopping the site? E.g. switch between two clone...

What's the most efficient way to query and sort a semicolon separated list of ids according to their associated strings from another table?

I have 2 tables in a mysql database : users and pets. In the users table there is a field that contains a semicolon separated list of the pets that a user has (pet_ids = 1;2;3;4;). These ids correspond to unique ids (keys) in the pets table which contain the pet name (1 = rex, 2 = goldie, 3 = squeak, 4 = bubble). I want to present a lis...

how to order datas by insert sequence DESC ?

i has a table:TestTable, this table only has one field: value,i insert same datas: value ------------ ccc aa 111 bbb ------------ i run: select * from TestTable can show my result order by: ccc aa 111 bbb now,i want get this result DESC: bbb 111 aa ccc how to create this sql? select * from TestTable order by (by what?) DESC ...

SQL query to count records.

I have a table EntryLog(Name String, CheckIn Boolean) I want to count the number of checkins against each name. How do I write a query to get the result as a single resultset? ...

Using Entity Framework with MyIsam tables

Hi, Got a question about Entity Framework and MyIsam tables. My production database consists of MyIsam tables only. Often with a primary key like UserId and then a secondary KeyId that is auto incrementary. Since secondary auto incremantary keys are not allowed in InnoDb, and there will be ALOT of work to get rid of them before convert...

MySQL FTS implementation

I work on a ticket system in PHP/MySQL. We have implemented mysql FTS in boolean mode, to provide the search feature to users. User enters search string and we present her a list of issues. Below is the sample database schema: issues table - (id, title, description) It has fts index (title, description) issue_comments table - (id, is...