mysql

What are the best books for MySQL?

What is the best book for SQL, particularly MySQL? ...

What's the best way to manage dates across PHP, MySQL, etc?

My server is in Dallas. I'm in New York City.. and both PHP and MySQL have configuration variables for setting the timezone. How do I get them all to work together? What dates should I store in MySQL? How do I get PHP to handle changing the date based on the user's preference? Bear in mind: I don't think I'm ever having PHP explici...

How to upload PHP and MySql into webserver

I am Developing site in vertigoserver, now I need to test the webpage in webserver. I am using the webserver Host-Europe VirtualServer 3.0 Now what are the steps to need to upload the PHP pages, What are the softwares need to upload MySQL queries Any tutorials or suggestions? ...

How to calculate difference between tables in MySQL?

What is a good way to calculate difference (in a sense what should be added and deleted from one table to get another) between tables in MySQL? ...

MySQL Replication - one website, many servers, different continents

Consider a reasonably large website (2M+ pageviews / m, lots of users) with 2 frontend servers: one front server in the US, and one in Europe. Two dedicated URL bring the visitors on one of the server, one in the french language, the other one in english. Both sites share exactly the same data. What would be the most cost effective solu...

What is the best way to generate ranks in MYSQL?

What's the best way to get the rank of the rows in addition to the row data in MYSQL? For instance, say I have a list of students and I want to rank on the GPA. I know I can order by the GPA, but what's the quickest way to have MYSQL return the rank as well in the rowdata I get back? ...

Selecting random records for use on a web page

HI Guys, I own a website I have a section called "mobile Section" this section contain many catagories (Nameoftheobject + a picture + little description and a download link) Now the section is considered as an internal section. I want to view random records from that section on the first page (I dont know Like RSS but not Rss) showing ...

PHP & MYSQL: How to resolve ambiguous column names in JOIN operation?

I have two tables in my database: NEWS ('id' - the news id, 'user' - the user id of the author) USERS ('id' - the user id) I want to make a SELECT * FROM news JOIN users ON news.user = user.id, now when I get the results in PHP it's something like: $row = mysql_fetch_array($result), and get column names by $row['column-name']... how ...

Concat in MySQL with condition

I have three columns in my table - company_name, first_name, last_name. In the result of a SELECT, I'd like to have only one column: name, which should contain content of company_name if it's not NULL or concatenation of first_name +' '+ last_name, if the company_name is not set. Any advice? Thanks! ...

MySQL error when deploying .NET application

I'm attempting to install a MYSQL driven .net application to a Windows XP sp2 machine. The development machine is the same OS. The application and all connectivity work fine on my machine (the developers mantra), but I receive the following error on the installation machine when attempting to connect to the database. As a side note, I ...

Database Inheritance Select

For my university assignment I have to design some basic managment system for sicknesses and all for a school. I have decided to model some basic inheritance in the form of Person --> Student Person --> Staff Person --> Guardian Person (PersonID, FirstName, LastName) Student (StudentID (Which references the PersonID), ... ) The re...

MySQL IN() question

I have a numerical field called category_id in my table. I want to do something like this. $ids=implode(',',$id_array); $sql="SELECT * FROM myTbl WHERE IN(category_id,'$ids')"; Which should output something like: SELECT * FROM myTbl WHERE IN(category_id,'1,2,3,4,5,6'); Is this possible and am I using the right syntax for this? Is ...

Insert a time + n in mySQL using Zend_db_table!

Hi im using: $data = array ( 'next' => "NOW() + 5", 'interval' => $dom["USER"][0]["STATUSES_COUNT"][0]["data"], 'good' => $good, 'tries' => $p->tries + 1 ); $where = $service->getAdapter()->quoteInto('id = ?', $p->id); $service->update($data, $where); to insert something to a database using PHP...

Does anybody have a development/staging/deploying workflow with php/mysql?

I'm thinking about a good workflow for php/mysql web-development. Anybody got some tips? ...

php - inserting the values of multiple checkbox selections

the site i'll be refering to is http://www.iaddesignandstudio.com/offline select the quote tab if a person where to fill out this form and select more than one checkbox in either number 1 or number 3. how would i insert those selected values into a database so that when i retreive the information the user inputed or selected i can see ...

How does "do something OR DIE()" work in PHP?

I'm writing a php app to access a MySQL database, and on a tutorial, it says something of the form mysql_connect($host, $user, $pass) or die("could not connect"); How does PHP know that the function failed so that it runs the die part? I guess I'm asking how the "or" part of it works. I don't think I've seen it before. ...

Good tool to visualise database schema?

Are there any good tools for visualising a pre-existing database schema? I'm using MySQL if it matters. I'm currently using MySQL Workbench to process an SQL create script dump, but it's clunky, slow and a manual process to drag all the tables about (which would be okay if it wasn't so slow). ...

Self-referencing updates in HQL

I have the following query in HQL: update ProjectFile pf1 set pf1.validUntil.id =123 where pf1 = ( select pf from ProjectVersion pv, ProjectFile as pf where pf.validFrom.sequence <= pv.sequence and pf.validUntil.sequence >= pv.sequence and pf.state <> 12 and pf.projectVersion.project.id = 1 and pv.project.id = 1 and pv.id = 12 and pf...

Sql count without duplication in statment

Hello, i have an sql query that selects a bunch of data. I would also like to get the number of records selected by the query (before i limit it). All the examples i have seen of the count statment duplicated the select. My select statment is about 50 lines long and i would rarther not duplicate it. Thanks ...

how many rows in mysql database table?

Is there a MySQL command to get a count on the # of rows in a table, & if so, what is it? ...