mysql

Different database tables joining on single table

So imagine you have multiple tables in your database each with it's own structure and each with a PRIMARY KEY of it's own. Now you want to have a Favorites table so that users can add items as favorites. Since there are multiple tables the first thing that comes in mind is to create one Favorites table per table: Say you have a table ...

phpMyAdmin - what' swrong with next configuration?

hello, tryin to install phpMyAdmin on my Fedora server, but if i open it in browser, i get next error: 2002 Cannot log in to the MySQL server file config.inc.php have next content: <?php /* Servers configuration */ $i = 0; /* Server: localhost [1] */ $i++; $cfg['Servers'][$i]['verbose'] = ''; $cfg['Servers'][$i]['host'] = 'localhos...

I am trying to run rails on Apache, but can't get it into development mode

Hi there, I am setting up a development environment for ruby on rails. Using rails 3.0, ubuntu, mysql and apache2 with passenger. So far so good until I go to localhost and it tells me: "Mysql2::Error Unknown database '[app-name]_production'" The error occurs because I don't have a production database. Only _development and _test. ...

Function to check to see if a field in a MySQL table equals 1

Hello, For the MySQL table below, what PHP function would simply test to see if 'subcheck' equals 1? Thanks in advance, John `submission` ( `submissionid` int(11) unsigned NOT NULL auto_increment, `loginid` int(11) NOT NULL, `title` varchar(1000) NOT NULL, `slug` varchar(1000) NOT NULL, `url` varchar(1000) NOT NULL, `disp...

Slow MySQL UPDATE query

I have a mysql table containing 400,000 rows whenever I run a PHP script to update one row, it takes about 3-4 seconds to do it. How can I optimize the update query? UPDATE `weakvocab` SET `times` = times+1, `wrong` = wrong+1, `mtime` = 1284369979 WHERE `owner` = 'owner_name' AND `vocID` = 'ID_number' AND `type` = 'type_name'; This ...

Why does this query take so long?

I have a complex query I need to run on a MySQL-server. On my home testing box, a mac, the query takes a reported 0.00 seconds and returns the reslut instantly. On my server however, an ubuntu box, the same query takes around 3.30 minutes, using the same data. The database uses InnoDB tables. The ubuntu box has a 64-bit kernel, and m...

String replace in many the tables for some fields ?

I have a drupal based site (CCK+Views+Taxonomy) with a huge amount of text content. Now consider I would like to convert all the "W" in the content with "w", I have no idea what tables to touch or what fields in those tables, I just know that I want all the "W"s in the site (it's content I mean, database) to be replaced with "w"s, any in...

open social applications

I want to create opensocial apps using Ning platform but dont know where to start. how to save data in mysqlusing PHP, how to create profile apps etc. can somebody help please. ...

is it a problem to fire very many queries to a mysql db?

hi together, think about having a skript where you have some words as input. now you trie to find matches of each word in a tablecolumn. i want to count the results for each word, so i think i have to do a query for each word, isn't it? in a second step i'm having a look at the counts of results and depending on that number i check sev...

Can I define relationships in an Entity class without having them in the database?

Hi, I have to write an application in Java EE6. I have been given a MySQL database, to which I am not allowed to make any changes. The database is well structured and normalized, but does not have any foreign keys defined to enforce integrity. (It uses the MyISAM engine). Is it possible to define relationships (using @JoinColumn, @Many...

Unable to initialize provider. Missing or incorrect schema.

Hello, I have upgraded my server machine to use MySQL Connector 6.3.4 and in our website we also added Membership role provider. When I run the website I am getting this error. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific e...

Mysql : can select dupes ok, how do i select the other data at same time?

Firstly sorry if the title is confusing, difficult to explain in one line! ok, so i'm making a script to alert me of any potential duplicate rows in my db. SELECT events.date, events.ven_id, COUNT(*) FROM events GROUP BY events.date, events.ven_id HAVING COUNT(*) > 1 this successfully finds duplicate row, however only returns th...

php date format

Hi guys, I'm trying to insert the current date from a php form into a database. My query is: $sql3="INSERT INTO orderDetails (compName, package, cost, date) VALUES ('$companyName', '$package', '$cost_record', 'date()')"; This produces the following: 0000-00-00 00:00:00 which obviously isn't right. Can anyone recommend how to g...

MySQL to oracle connector

Hi. Is there a way to transparently translate MySQL queries to oracle back-end? I have an application written to use MySQL but I want data to be stored in oracle. Is there a way to avoid code modification and use Oracle as back-end database? ...

Sum amount of overlapping datetime ranges in MySQL

I have a question that is almost the same as http://stackoverflow.com/questions/1148303, so I'm reusing part of his text, hope that is ok... I have a table of events, each with a StartTime and EndTime (as type DateTime) in a MySQL Table. I'm trying to output the sum of overlapping times for each type of event and the number of events t...

mysql - good pratice: table with more then one index ?

Sorry all, I do have this mini table with 3 columns but, I will list the values either by one or other column. 1) Is it ok to have two of those columns with indexes? 2) Should we have only one index per table? 3) At the limit, if we have a table with 100 columns for example, and we have 50 of them with indexes, is this ok? Thanks...

php source related question

Hello All i have some php source it can send form data info to other page under mysql 4.x version. but after upgraded to mysql 5.x version, this php source can't send form data info to other page. i was searched many info, but don't have idea what's wrong with my php source. i just can guess this is related with mysql upgrade and i h...

Granting user access

We're developing a web app using the Zend framework and Mysql. Currently, accounts are unique by email address. We want to be able to allow the admin of an account to grant access to the admin of another account. This person would then be a "user" of the linked account. The account holder would then log into their admin account and then...

MySQL Update a column depending on multi tables

Hi all, I have a question regarding updating a MySQL database. I have three tables: Match, Submission and SubmissionVersion. A SubmissionVersion can be set as 'Favorite'. But I can't just query UPDATE SubmissionVersion SET IsFavorite = 1 WHERE ID = $ID because of the relation to a Submission and than the Match. My question is how can ...

Mysql update statement for decimal fields to NULL or emptiness

Can't figure out, how to update decimal field to null or emptiness. Have tried: UPDATE ads SET price=NULL WHERE price=0 And UPDATE ads SET price="" WHERE price=0 Isn't working. Thanks ;) (Update) Just a moment. ...