database

mysql error in php

i'm trying to run this php code which should display a quote from mysql, but can't figure out where is it going wrong. the result variable is null or empty. can someone help me out. thanks! <?php include 'config.php'; // 'text' is the name of your table that contains // the information you want to pull from $rowcount = mysql_query("sel...

Database Design Question regarding duplicate information.

I have a database that contains a history of product sales. For example the following table CREATE TABLE SalesHistoryTable ( OrderID, // Order Number Unique to all orders ProductID, // Product ID can be used as a Key to look up product info in another table Price, // Price of the product per unit at the time of the order Quantity, // q...

database transaction

If I'm using a mysql client(eg. squirrel) to execute an update query, after 10 seconds, I cancelled the query, would there be partial update or would everything that's done be rolled back? ...

Google Maps Terms of Service - saving some data to a database

I've read the terms of service, and, from what I understand, I'm not allowed to store any information I retrieve from the Google Maps API. Are there any exceptions to this? More to the point, I'm planning on building an application that shows the user several points of interest (like restaurants, libraries etc) at a certain distance aro...

modelling database entities in MVC -- how to create them?

I'm working on a PHP web app and I'm trying to use the MVC model. I have a lot of things that exist as 'database entities' -- a row, or a set of related rows, that are conceptually one human recognizable 'thing'. So I often try to provide an interface to that thing in a model class. So of course, the run of the mill functionality is t...

What is the right way to do flexible columns in database?

Im storing columns in database with users able to add and remove columns, with fake columns. How do I implement this efficiently? ...

Iterating over a database column in Django

I would like to iterate a calculation over a column of values in a MySQL database. I wondered if Django had any built-in functionality for doing this. Previously, I have just used the following to store each column as a list of tuples with the name table_column: import MySQLdb import sys try: conn = MySQLdb.connect (host = "localho...

Image gallery control for ASP.Net with filtering capabilities

I'm writing an ASP.Net application which needs to display a large number of thumbnails, preferably in a paginated format. These thumbnails will be stored on the server's hard disk, but will have their filenames listed in a SQL Server database. What I want to do is to be able to filter the images being displayed based on criteria within...

error in arabic script in mysql

i inserted data in mysql database which includes arabic script. while the output displays arabic correctly, the data in mysql looks like garbage. something like this: '&#1589;&#1614;&#1608;&#1605;&#1615; &#1579;&#1614;&#1604;&#1575;&#1579;&#1614;&#1577;&#1616; &#1571;&#1610;&#1617;&#1575;&#1605;&#1613; &#1605;&#1616;&#1606; &#1603;&#16...

Django: How/Where to store a value for a session without unnecessary DB hits

Hi all, I have an extended userprofile with AUTH_PROFILE_MODULE (ref: http://tinyurl.com/yhracqq) I would like to set a user.is_guru() method similar to user.is_active(). This would results for al views (or rather templates) to e.g. disable/enable certain user messages, displaying of widgets, etc. The boolean is stored in the extended ...

How do you find the disk size of a Postgres / PostgreSQL table and its indexes

I'm coming to Postgres from Oracle and looking for a way to find the table and index size in terms of bytes/MB/GB/etc, or even better the size for all tables. In Oracle I had a nasty long query that looked at user_lobs and user_segments to give back an answer. I assume in Postgres there's something I can use in the information_schema t...

Imitate database in C

I am fairly new to C. (I have good knowledge of C# [Visual Studio] and Java [Eclipse]) I want to make a program that stores information. My first instinct was to use a database like SQL Server. But I don't think that it is compatible with C. So now I have two options: Create a struct (also typedef) containing the data types. Find a way...

How do you find the row count for all your tables in Postgres

I'm looking for a way to find the row count for all my tables in Postgres. I know I can do this one table at a time with a select count(*) from table_name; but I'd like to see the row count for all the tables and the order by that to get an idea of how big all my tables are. ...

How to store and synchronize a big list of strings

I have a large database table in SQLExpress on Windows, with a particular field of interest 'code'. I have an Apache web server with MySQL on Linux. The web application on the Linux box needs access to the list of all codes. The only thing it will use the list for is checking for the existence of a given code. Having the Linux server ...

Database migrations for SQL Server

I need a database migration framework for SQL Server, capable of managing both schema changes and data migrations. I guess I am looking for something similar to django's South framework here. Given the fact that South is tightly coupled with django's ORM, and the fact that there's so many ORMs for SQL Server I guess having just a gener...

How to Set Customer Table with Multiple Phone Numbers? - Relational Database Design

CREATE TABLE Phone ( phoneID - PK . . . ); CREATE TABLE PhoneDetail ( phoneDetailID - PK phoneID - FK points to Phone phoneTypeID ... phoneNumber ... . . . ); CREATE TABLE Customer ( customerID - PK firstName phoneID - Unique FK points to Phone . . . ); A customer can have multiple phone numbers e.g. Cell, Work, etc. phoneID in Custo...

PHP - Database schema: version control, branching, migrations.

I'm trying to come up with (or find) a reusable system for database schema versioning in php projects. There are a number of Rails-style migration projects available for php. http://code.google.com/p/mysql-php-migrations/ is a good example. It uses timestamps for migration files, which helps with conflicts between branches. General pro...

Search & Replace SQL

I am messing around with one of my databases.. is there away for me to search for a string in ALL the tables.. and replace it with another everywhere it occurs? I am looking for SQL ...

Small standalone SQL database similar to access in the old days(ie file database)

Hi, I am looking for a easy to use and deploy sql type database i can ship with a desktop application. This will be a small application user's can download from my website. In the vb6 days, access was the common database for small desktop apps, what is my option these days? Looking at SQL CE it seems to have a quite a few limitations...

Database design: circular references

I have three database tables: users emails invitations Emails are linked to users by a user_id field. Invitations are also linked to users by a user_id field Emails can be created without an invitation, but every invitation must have an email. I would like to link the emails and invitations tables so it is possible to find the ema...