mysql

Implementing order in a PHP/MySQL CMS & dealing with concurrency.

I have the following tables: ======================= ======================= | galleries | | images | |---------------------| |---------------------| | PK | gallery_id |<--\ | PK | image_id | | | name | \ | | title | | | description ...

Database class in PHP; only has one function - question about practices and whether it's a good idea

So I have this database class in PHP and I only have 1 function in it (other than __construct and __destruct. Let me explain further... I had originally written it so when I connected to a database I would just call my function connect_to_db() which returned a mysqli object. I then used this objects functions (->query(), ->prepare(), -...

Can we have a sql express-like database using MySql

Hi all Can we create a sql express-like database using MySql. meaning: the database files can reside in the project's directory and can work on any machine having sql express installed. Does MySql provide such a facility? and if so, how can this be done thanks ...

show PHP Fatal error after combine date and time

i have two textfield..one for show datepicker and another one for time.. but i want after input to DB they can combine become one field inside DB..so that i set field type as datetime... to make them combine..i'm doing some manipulation inside process.php page..this is my code: $sql = "INSERT INTO inspection_report "; $sql.= "(Model,Se...

How to attach & detach the database

Using MaxDb Database. when i open the maxdb database, it is opening in command prompt, displaying like this... maxdb> I want to detach & attach the database..., So How to do this.... Need Query Help ...

how to display multi table data in one page like facebook news feed

how to display multi table data in one page like facebook news feed. example tables /event,task/ i want to sort by datetime new in top.i can do it by php.i need mysql way /Sorry for my english/ event.row1 task.row1 event.row2 task.row2 event.row3 task.row3 ... older ...

character matching in mysql

Dear All I have a problem related to character matching in mysql. Supoze i have a table which contains list of all names-like elton,angelina,rozy I want that if someone queries names like angalina or rosy where a user can make a spelling mistake,i want to fetch the nearby names from the table.which query can be used or wat...

What is Rails' migration equivalent to MySQL's 'double' datatype?

I can't seem to figure this one out by searching Google. I have an existing database which has some columns with the type of double, what would I write in my rails migration to create an equivalent column type? It's a relatively old database and there maybe a more suitable datatype to use completely, but I wanted to see what others thou...

Is it possible with mySQL to get results when the spelling is not exactly correct

Is it possible with mySQL to get results when the spelling is not exactly correct. E.g. a visitor fills out the field with Amstrdam (note that the "e" is missing). Is there a function for mySQL that also shows results similar to Amstrdam: -Amsterdam -Amsteldam ...

MySQL Slow join - but not always and not on all tables

We're experiencing a performance issue with a MySQL database that's so weird we need another set of eyes to tell us whether we're going crazy or not. We've got 2 MySQL Certified Developers in the team, but all they can say is : "this is impossible". Anyway, here's the situation : we have a query that in theory should be reasonbly fast, ...

MySql varchar change from Latin1 to UTF8

In a mySql table I'm using Latin1 character set to store text in a varchar field. As our website now is supported in more countries we need support for UTF8 instead. What will happen if I change these fields to UTF8 instead? Is it secure to do this or will it mess up the data inside these fields? Is it something I need to think about whe...

Explain Vs Desc anomalies in mysql

What are the differences between EXPLAIN and DESC commands in MySQL ? ...

What is the fastest way to count all the records of a table using Doctrine ORM?

Hi, The title says it all... What is the fastest way to count all the records of a table using Doctrine ORM? I don't need the individual records of the table. I just need the total number of records in the table. Thanks! ...

create a cyclic auto increment column in mysql

I have a table that's used to store some temporary bookkeeping stuff. It needs a unique id for each row, so I used an autoincremented column. However, after a while the column reaches it's max value and then I cannot enter new rows into the table. The table is rather small, only ~100 rows at a time since I keep inserting and deleting ro...

Looping through an array and inserting into a table with parent child relationship

Hi there, I have an array which looks like Array ( [438044691:maincategoryone] => Array ( [0] => Array ( [id] => 438044692 [name] => main category one item one [category] => Array ( [2] => Array ( ...

Remote permanent synchronization

We have 2 servers, which one of them is customer's. Our customer is providing us an URLs of XML/JSON exports of his clients informations from his CMS and our task is to write some import scripts for importing data to webapp, which we're developing. I've always been doing that like this: INSERT INTO customers (name,address) VALUES ('Joh...

Convert DateTime.Ticks to MySQL DateTime in query

I have a integer column in MySql storing the DateTime.Ticks. A single tick represents one hundred nanoseconds or one ten-millionth of a second. There are 10,000 ticks in a millisecond. The value of this property represents the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001 How can...

symfony fixtures: set ondelete: CASCADE on refclass table

Hi! I'm using symfony 1.4.5, Doctrine 1.2 and Mysql 5. In my schema.yml I have a few Many-to-Many relations which work great. But I need the joining table to have onDelete: CASCADE. Now for doctrine it is needed to add onDelete: CASCADE on the side where the foreignkey exists but since the refclass does not have any relations in the ...

sql display in matrix form but column and row values not fixed

tables i am using product_parameter id productid parameterid value 1 1 1 10 2 2 2 11 3 1 2 34 4 2 4 44 5 3 2 55 6 3 3 43 7 4 1 33 8 1 ...

Insert file contents into MySQL table's column.

I know there's the LOAD DATA INFILE statement, which allows me to INSERT structured data into a table. What I'm curious about, is whether it is possible to INSERT contents of a file into single column. So, is something like this: INSERT INTO my_table (stamp, what) VALUES (NOW(), LOAD DATA INFILE 'my_file'); possible? ...