mysql

Can I use a database value right after I insert it?

Can I insert something into a MySQL database using PHP and then immediately make a call to access that, or is the insert asynchronous (in which case the possibility exists that the database has not finished inserting the value before I query it)? ...

Get the minimum value from a list

I want to get the minimum of a list of numbers in MYSQL select min(1,9,20,..); is this possible? ...

dotnet and my sql

i am doing search page in dot net . here we have 11 options like location, key skill,designation,ug etc. user can select any of the 11 i should retrieve the data from the table which is matching to the selected keys. since it has 11 options i dont know how to do all condition ...

Joining Tables: case statement for no matches?

I have this query: SELECT p.text,se.name,s.sub_name,SUM((p.volume / (SELECT SUM(p.volume) FROM phrase p WHERE p.volume IS NOT NULL) * sp.position)) AS `index` FROM phrase p LEFT JOIN `position` sp ON sp.phrase_id = p.id LEFT JOIN `engines` se ON se.id = sp.engine_id LEFT JOIN item s ON s.id = sp.site_id ...

PHP MYSQL: How to get ambiguous column result from joined table

Hello, If I am joining two tables and the result set will have ambiguous coloumn names, how can I retrieve the correct one through php? Example: $results = mysql_query("SELECT b.name, m.name FROM Brands as b INNER JOIN Models as m ON b.id = m.brand_id", $connection); while ($row = mysql_fetch_array($results)) { printf("Name: %s", $r...

how to detect incoming chat message?

I'm using PHP, AJAX, a MySQL database, and a lot of jQuery to prototype web-based chat system (similar to Facebook Chat). I'm stuck on how to "listen" for incoming chats... when to know someone is trying to chat me... and to know that it is a new chat, not an existing chat. Right now, I'm polling to see if there has been new insertions ...

how to use enum in mysql database

i use enum in the table of mysql database how can i get all stuff where his type = a , b,c simply if i use varchar then i can use SELECT * FROM stuff WHERE type IN ("a","b","c") but in enum case it is not worked. how can i get all stuff where type = a , b , c note:type is used as enum not char or varchar. ...

Using mysql slow queries log with PHP

I enabled logging slow queries and set the minimum time to 0. I know that the logging is enabled because the startup of mysqld is being logged. But, when I access my website's php pages using my browser and cause queries to run, no queries are being logged. Is there something special I need to do to make this work with php? Thanks in...

Making a custom PHP form by using a custom API

I am trying to make a simple module for phpBMS. It is mostly straightforward, and it is quite easy to make a form and define a table to add, remove or modify records. Here is the sample provided by the project, which is what I have been following so far. Now, I have a more complex need than simplifying adding or modifying records. I ...

How to get a total days count

Using MySQL & SQL Server ID sDate 001 03/06/2010 002 07/08/2010 .... .... sDate Datatype is varchar Format mm/dd/yyyy I want to take the date count means How many days is still there, It should compare the system date... How to convert my varchar to datetime datatype, then how to compare the mysdate to system for getting the total...

creating a user management using php mysql

I am trying to find a good example that can help me to understand user registration and then management system. User management should show the items from the db and give the option to delete/modify and also create a new. I would like to use php and mysql . can any one please point me to the right direction to learn and try this.i searc...

Sql-server to MySQL migration woes- maximum rowsize cannot exceed 65,535 bytes

I am migrating the database layer of our application from MSSQL to MySQL and came across this exception when I tried to migrate an MSSQL table to MySQL: Row size too large. The maximum row size for the used table type ,not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs) Turns out the MSSQL table has lots of...

Handle error for duplicate entries - PHP MySQL

I have a PHP form which enters data into my MySQL database. My primary key is one of the user-entered values. When the user enters a value that already exists in the table, the MySQL error "Duplicate entry 'entered value' for key 1" is returned. Instead of that error, I would like to alert the user that they need to enter a different val...

How can I build a support ticket system with PHP?

Hi, I have a custom and simple php/mysql based user system. I'm trying to build a way for members to send product support to our staff (put it in a database, & viewed in admin area) and for them to manage these messages (lack of a better term). My question is, does anyone know of a good existing script, or a better approach for a suppor...

Mysql - sequence of multiple column indexes

Say if I have a query that look like this: SELECT * FROM table WHERE category='5' and status='1' LIMIT 5 The table has 1 million rows. To speed things up, I create index (status, category), i.e. multiple column index. There are 600 categories but only 2 status (1 or 0). I'm wondering if there is any difference in performance if I c...

If entity x is existence-dependent on entity y then what is x said to be?

If entity x is existence-dependent on entity y then what is x said to be? a. Dominant entity b. Subordinate entity c. Primary entity d. Secondary entity What can be the right ans select? ...

Lock out of mysql db thru webmin!

[root@cp ~]# mysql> CREATE DATABASE foo; [root@cp ~]# mysql> GRANT ALL ON foo.* TO root@'my home ip' IDENTIFIED BY 'aron1252'; [root@cp ~]# mysql> update user set Host='my home ip' where user='webadmin'; [root@cp ~]# GRANT ALL ON foo.* TO root@'localhost' IDENTIFIED BY 'newpass'; -bash: GRANT: command not found [root@cp ~]# mysql> GRANT...

Which is best serach technique to search records

I have 10,000,000 records which will be the best technique to search records, currently i m using full text search but it is slow,please suggest. ...

MySQL UPDATE query with subquery taking forever

Hi, I have a MySQL UPDATE query which takes a long time to complete. Am I missing a much simpler way to achieve the same result? "UPDATE table2, table1 SET table2.id_occurrences = (SELECT SUM(IF(id = table2.id, 1, 0)) FROM table1) WHERE table2.id = table1.id;" table2 contains all possible values of id, exactly one record for each. t...

comparision of two table having same field?

hi all, I have to table. Both table has nric field. I want to select the nric field which does not inside in table. si_isccourse table enter code here ID NRIC 1 456 2 457 3 458 si_results table ID NRIC 1 456 si_isc_class table ID NRIC 1 456 2 457 my results like this ID NRIC 3 458 this is my sql query SELEC...