mysql

trying to backup mysql database using php

I got this code from this site: http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/using-php-to-backup-mysql-databases.aspx But I'm just a beginner so I don't know what the config.php and opendb.php suppose to mean. Do I have to create those 2 files in order for this code to work? If yes, then how do I create it, it isn't included...

Improve my Search engine

Hello all! I have tried to implement a simple search engine for my application. This is what I have done: CREATE FULLTEXT INDEX item_name_other_name_desc_index ON item (name,other_name,description) public static function Search($string) { $delims = ',.; '; $word = strtok($string,$delims); while($word) ...

Query Problem - Result Coming incorrect

I am having trouble solving this. Please help. I have a table named Product_Information. I want to count the number of products present in a category and subcategory. This is the table Product_Id - Product_Title - Product_Sub_Category - Product_Category 1 ----------------abc------------------XYX------------------X 2 ----------------...

MySQL synchronization questions

I have a MySQL DB which manages users’ accounts data. Each user can only query he’s own data. I have a script that on initial login gets the user data and inserts it to the DB. I scheduled a cron process which updates all users’ data every 4 hours. Here are my questions regarding it: (1) - Do I need to implement some kind of lock mecha...

Getting average time in seconds format in mysql

How to find out average timestamp the field timestamp in a table gettime Timestamp 2010-02-08 14:17:36 | 127.0.0.1 | 2010-02-08 14:17:30 | 127.0.0.1 | 2010-02-08 14:17:30 | 127.0.0.1 | The following query gives some number how to format it and get it in seconds. select avg(timestamp) from gettime; the above gives some random ...

Can't find out where my Ruby 1.9 string encoding is getting messed up.

Somewhere along the line from the DB to the application, this: sauté is getting turned into this: sauté I'm using Ramaze + Rack + MySQL. I've got a force_encoding plugin set up, so the encoding on the string is UTF-8. If I view the record in the database shell, it's looks fine. The default charset on the table is utf8, and the fie...

MySQL sort on a calculation

Is it possible to sort on a calculation of 2 rows in mySQL? For example, I have 2 rows, lp and ap I'm trying to do something like this: SELECT * from myTbl WHERE 1 ORDER BY (lp/ap) Which isn't throwing an error, but its also not sorting by the results of that calculation. Is there a way to do this, or do I have to store lp/ap in the d...

Function not searching for a specific word

This is quite weird but my search function can search for any word except the word "grinder" from my item table. I have tried everything but it does not seem to search for that word. Can anyone help me please? CREATE FULLTEXT INDEX item_name_other_name_desc_index ON item (name,other_name,description) public static function Search...

JPA: Store fileAttachment into the database

Hi, I would like to know if there is any way I can store a fileAttachment directly into the database with JPA. I have an attribute: public fileAttachement logo; I have tried to change it to: @Lob public byte[] logo; But that's not doing what I was expecting. ...

Another dateTime question

I currently have a date in this format 2010-03-03 10:39:18 which is a TIMESTAMP field in MySQL. I need to have the date in this format for a search engine called Solr: 1995-12-31T23:59:59Z Here is some text from their website about dates: Solr expects dates to be in UTC when indexing. The format for this date field is of t...

loop through mysql database records and change phone formats

Hi, I'm working on a legacy database table that has a phone no. field but the problem is that all the entries (over 4k) are in varying formats. I was wondering if there was a quick way to fix them by looping through the records using PHP and updating the records to a particular phone format ...

Inserting data into table with the referance of second table using mysql

Hello, I have two tables 1 is "contact_info" - having fields like (owner_id, contact_type, contact_value), another one is "contact" -having fields like (id, f_name, l_name, email). Now i want to insert into contact_info with the reference from table contact- id. I am using code as below... //=======Contact.xml============// <insert i...

php-mysql email contact importer

Dose anyone know how to get email address book for supplied email address and show or save them in a table. or any Open Source Package that provide this type of things. ...

Find path between nodes with SQL

Hi, i have two mysql tables: nodes and relations CREATE TABLE `nodes` ( `id` int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `relations` ( `node_id` int(10) unsigned NOT NULL, `related_node_id` int(10) unsigned NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Let...

Inserting html code in a mysql table

Hi everyone... I use joomla to manage a website... and i am developing a stand alone php application that will insert and modify data into the tables that are used by joomla to store the html of webpages that it dynamically creates... The way it works is i use a joomla component to create content and the html code of these articles ar...

How do I make the following interaction with mySQL more efficient?

I've got an array that contains combinations of unique MySql IDs: For example: [ [1,10,11], [2,10], [3,10,12], [3,12,13,20], [4,12] ] In total there are a couple hundred different combinations of IDs. Some of these combinations are "valid" and some are not. For example, [1,10,11] may be a valid combination, whereas [3,10,12] m...

Using MySQL GeoSpatial Data Types in .NET

I'm looking for information on how to use MySQL geometry types in .NET. I'm using Sub-sonic for ORM, and don't really need to support much more than MySQL's POINT type. The MySQL .NET connector seems to return point data as a byte[] array in OpenGIS WKB format. What libraries are recommended for working with this WKB format? Alte...

I wanted to store List values as a array in MYSQL column. Whats the best practice?

Hi there, I have a registration form with common registration fields and two multiple selection Lists with heading "services". I wanted to store form data to database into a table. Currently i am having only one table "registrations", also i am having second thoughts whether i should create another relation table with name "registration...

What is the easiest way to insert Data into a mysql DB with C++ ?

Do i need external libraries ? is there any minimalistic example ? ...

phpmyadmin and mysql socket error

hello once i try to connect to mysql on phpmyadmin in ubuntu i got this error 2002 - The server is not responding (or the local MySQL server's socket is not correctly configured) but with mysql query browser i connect with out any error and it works why phpmyadmin does not connect? ...