mysql

single big files for PHP or lots of small ones?

I have a server which I try to optimize for speed (php/mysql). From a speed standpoint, is it better to keep a big file with all my functions in it so as to have only one file to include? Or is it better to have many, small, task-optimized includes that will include depending on the job at hand (that solution produces 4/5 even 6 files to...

Slow MySQL full text search

Hi guys, I'm using this query to perform a full text search on a MySQL database: SELECT DISTINCT questions.id, questions.uniquecode, questions.spam, questions.questiondate, questions.userid, questions.description, users.login AS username, questions.questiontext, questions.totalvotes, MATCH(questions.questiontext, questions.uniquecode...

Missing MySQL in PHPinfo on Ubuntu Linux

I am working on a newly built Ubuntu server with Apache2, MySQL 5 and PHP 5.3.2 . It seems something is incomplete in the configuration. When I call phpinfo() there is no MySQL section in it. However, the "Additional .ini files parsed" section shows "/etc/php5/apache2/conf.d/mysql.ini, /etc/php5/apache2/conf.d/mysqli.ini, /etc/php5/apac...

Concatenate rows & then get distinct values

I have the following columns in my table: alias, first, last. I would like to concatenate the rows & then search for distinct values: i.e. jimmyWho, Jim, Smith BallyHo, Bob, Smith JimmytwoShoes, Jim, Smith Bobtastic, Bob, Johnson JimmytwoShoes, Jim, Smith BallyHo, Dave, Jones I would like to have the following results (notice that #5...

Is there any point using MySQL "LIMIT 1" when querying on indexed/unique field?

For example, I'm querying on a field I know will be unique and is indexed such as a primary key. Hence I know this query will only return 1 row (even without the LIMIT 1) SELECT * FROM tablename WHERE tablename.id=123 LIMIT 1 or only update 1 row UPDATE tablename SET somefield='somevalue' WHERE tablename.id=123 LIMIT 1 Would adding t...

Converting back to HTML characters

I want to convert a string to HTML entities/special characters so that I can store it into MySQL database. Example, This is the way it is stored in MySQL database. V3008-02, WS1 Drain Fitting 1” Straight w/Silencer and when rendered on the browse it shows V3008-02, WS1 Drain Fitting 1 Straight w/Silencer My application built i...

32bit program running on 64bit OS Memory Consumption

hi, We have a windows server 2008 R2 32G memory machine, this is obviously a 64bit OS. And we installed XAMPP 32bit version, with 32bit MySQL and PHP. Then we host an webmail system written in PHP on it. My question is : will those 32bit MySQL and 32bit PHP consume more than 4G memory of the OS ? Do We have to install 64bit MYSQL and PH...

Connected Subgraphs in MySQL using adjacency list?

I remember doing this long back in MySQL using depth-first search but can't remember how I did it. Is there a way to do this directly using a query? I am able to do this in a scripting language but am curious to see the performance using MySQL. Basically, the problem is that I have an adjacency list stored in a table: A | B ----- 1 | 2 ...

Should a forum posts table use MyISAM or InnoDB

For a forum, should I use MyISAM or InnoDB for the table that stores the text? I know that MyISAM supports full text searching, which sounds like it's what I should go for, but while reading, I've come across this very confusing sentence. You should use InnoDB when transactions are important, such as for situations in which INS...

Max tables in a MySQL database

Is it bad to have too many tables in a database? I have about 160 tables in one database. Is it better to split it into several database rather than using a single database? Single database is more convenient for me. ...

How to index a lookup table in MySQL

I have a 10M-row table product with fields like color (int), price (float), weight (float), unitprice (int), etc ... Now users from Web dynamically generate queries to lookup data from this table with random conditions (color is a must have here) and order-by such as select * from product where color=1 and price >5 and price <220 and .....

combining multiple mysql queries into one

hey guys im learning Mysql commands and methods of combine multiple queries , so in order to gain that goal , now i need to combine these queries : list($TotalVisitsToday) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(DISTINCT ip_address) FROM table_iptracking WHERE `date_time` between '$yesterday' and '$today' ")); list($...

PHP & MySQL login question.

Lets say a member forgets there username, email or password for logging in to our site what is the best way for me to have them retrieve them? an example or tutorial will help out greatly. ...

How to flush binary logs

I read a comment on another post that InnoDB can be optimized for speed by not flushing binary logs on every commit. This is the first time I hear about this, so what are these binary logs and what's this flushing all about? Why should I do it (and when not to do it) and how? ...

What exactly happened with the indexing operation?

I was indexing a huge table today containing 2 billion records. I thought MySQL would eat away my 2TB drive... The disk consumption kept increasing to 400GB and then 500GB and then finally drops to 180GB and MySQL says successfully added the index. Why the space increase and what happened in the end? Can someone please give me some point...

How to export/download table from mysql database using C#?

I want to export a table from a mysql database to a txt or csv file like the way you can in phpmyadmin . I currently use the code below but after the program has been running for a few hours it will throw an "tried to read past the stream" error. MySqlConnection connection = new MySqlConnection(MyConString); MySqlCommand com...

Simple search in MySql

I'm trying to create a basic search functionality for MySQL InnoDB. I know there is Full-text search, but I just want to make an easy and simple solution for now. What I want is that when a user search for example "BMW Car" I want to find results not just like "BMW Car" but also "Car BMW" "BMW Z4 Car" and so on.. Is there an easy way to ...

SQL - Order by column from two tables

I have two tables: messages (messages users posted), likes (many to many relationship between users and messages - it says that user1 likes message5). messages --------- id, id_user, message, created_at likes ----- id_user, id_message, created_at If I send message, it goes to the messages table. If I like somebody's message, a new re...

Null pointer execption

i am facing null pointer exception in hibernate: org.hibernate.dialect.function.CastFunction.render(CastFunction.java:11) hibernate code is: ("Select date_format(str_to_date(form.dobDate,'%Y%m%d'),'%M (%Y)') as Month"); ...

How do I pick a selection of rows with the minimum date difference.

Hi, The question was difficult to phrase. Hopefully this will make sense. I have a table of items in my INVENTORY. Let's call the items Apple, Orange, Pear, Potato. I want to pick a basket of FRUIT (1 x Apple,1 x Orange, 1 x Pear). Each item in the INVENTORY has a different date for availability. So that... Apple JANUARY Apple FEB...