database

Problem logging in with PHP's $SETTINGS

I'm trying to get the user's login details from the database using $SETTINGS["admin_username"] and also the password. I have defined them as 'user' (for username) and pass (for password), and I want them to be pulled from database table userLogin. Any ideas? Please help, I have tried everything but the page either doesn't open or it doe...

How to model something if the desired information is the same as an already existing record

How to model something if the desired information is the same as an already existing record e.g. Address (Street, Country, Province, Zip) We need to capture an User who has a permanent address and an address for correspondence (i.e. 2 rows per user). There is a provision to say that the "address for correspondence" is the same as the "p...

Query a Subquery

I have to display the Rank of a user for which I plan to use the Rank() function in SQL Server. The Sql query to get the rank is as follows select a.user_id, RANK() OVER (ORDER BY (a.quant_points) DESC) AS QRANK, RANK() OVER (ORDER BY (a.verbal_points) DESC) AS VRANK, RANK() OVER (ORDER BY (a.dilr_points) DESC) AS DRANK, RAN...

database design

I have a parent class and 2 sublasses of it.Now, I need to know if the set of instances of both the subclasses are equal or not? I am doing CIOM design In database. ...

register_shutdown_function and databases problem !

Greetings Overflowers, What is wrong with this PHP code: <?php define("DB_FILE", "sqlite:database.sql"); define("QUERY", "INSERT INTO Log VALUES (123)"); define("TIME_OUT", "60000"); function track() { $db = new PDO(DB_FILE); $db->exec(QUERY); echo "OK!"; } register_shutdown_function("track"); // sleep(TIME_OUT); ?> Although "...

Authorize.net CIM : How to manage multiple card details?

I am working on a new project, which needs Authorize.net CIM to be integrated as a payment gateway. User can have multiple cards, Can you please anyone let me know the minimum details I need to save in DB and DB schema for saving the card details? ...

Google Map & search by location feature

I'm building a site where my users will be able to specify locations (say, their residence, etc.). Then, I want to do 2 things to this information: Plot these location on a mapping service (such as Google Map) Allow users to search by location (e.g. find all users that live in or are in a certain radius from XYZ city) The question I ...

MySQL Left Join, Group By, Order By, Limit = Terrible Performance

Hi Guys, I am currently developing a an application to allow users to search through a database of documents using various paramaters and returning a set of paged results. I am building it in PHP/MySQL, which is not my usual development platform, but its been grand so far. The problem I am having is that in order to return a full set ...

Why n in varchar(n) is to be specified as concrete digit?

I did red-read on this and could not clearly understand... Having (for the purpose of shortening this question) DECLARE @temp VARCHAR(4001); --update: 4001 is for example only to avoid varchar(MAX) discussions -- I am aware about 8000 SET @temp = 'a'; does SQL Server reserve 4001 bytes for @temp which (the rest 4000 from 40...

How to make form elements "remember" selection ?

I am using php to build a "change classifieds" page right now. I use Mysql as a db. Currently I use PHP to fetch all mysql information about the classified, and then I output it like this: $table.=" <select name='year' id='year'> <option id='2000' value='2000'>2000</option> <option id='2001' value='2001'>2001</option> ...

Is there a dbunit-like framework that doesn't suck for java/scala?

I was thinking of making a new, light-weight database population framework. I absolutely hate dbunit. Before I do, I want to know if someone already did it. Things i dislike about dbunit: 1) The simplest format to write and get started is deprecated. They want you to use formats that are bloated. Some even require xml schemas. Yeah, wh...

Good Reading on Rails Database Optimizations: Caching ids in column, demormalization?

I'm looking for some (more than intro-level) database optimizations, not just for Rails but for SQL in general. In Rails, how/when do you start using these? cache_counter caching ids in a table (user has_many roles, so the user table gets a role_ids serialized column, since every request requires fetching the roles). Are these types...

property-value database model

How to model a database when you have a different type of value(int, float, boolean, string etc.) of some property, and all possible types are not predefined? I think of a way that all values are strings in database and have some type attribute associated and then convert to that type in the application.. is there a better solution? ...

How to specify multiple OR conditions in android (sqlite3)?

Hi, I want to know how to specify something like in my database adapter: Select * from _myTable WHERE _columnValue IN ('2','3','4'); Is there a way to use any of the existing query methods specified in SQLiteDatabase? I can write the query in pure sql, but wondering whether there is a better (and easier) way to accomplish what I am a...

What is the best design pattern for preventing duplicate submissions?

I have a design pattern I have been struggling with on how best to prevent duplicate posting of data. Here are the steps: Client submits data with a unique guid (client generated guid - guaranteed unique) Server side software makes sure client guid doesn't exist yet in the DB begins transaction process data (can take between 1-20 seco...

How to identify a database as valid model?

Im having trouble identifying my databases as correct and valid version of my model. I have a GUID-id for my model I could use, but where do I put it? I dont want an entire table with only one row for this GUID. Is there any metadata-repository for databases (SQL Server 2008) or is there any other methods of identifying databases except ...

Database Table Update Error on NULL Value

Hello everyone, I have a two tables. One table is actually populated by daily events while the other is just a summary of the other table. I have a stored procedure which deletes the values stored in the Daily Table. Now every after delete, the Summary table should also be updated such that the SUM will now be updated less the value of...

Ajax retrieve data from Mysql - Not working properly

I am learning AJAX and I am trying to recreate this fairly simple example: http://www.w3schools.com/php/php_ajax_database.asp I created this database: So now to recreate the example I just basically copied and pasted the code: index.html <html> <head> <script type="text/javascript"> function showUser(str) { if (str=="") { do...

Using Backup Database Programatically

Hello everyone, I was just wondering, how can I use a .bak database backup file (Backed up via query in SQL Server) programatically? I want my application to back up my database to a location (which I can already do) and I also want it to be able to load a backed up database (the .bak file). Can anyone help me with this using C#? Tha...

Android - How would you optimize searching in a REST response cache database?

I'm writing a thick client for a REST based web service (for Android). I'd like to cache results that I got from this service, and I'd like to store these results in an SQLite DB. There's a single table in this db, every record represents a past transaction with the web service. In its schema, there's an attribute for: the http reponse c...