mysql

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die('unable to connect' . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = date('d/m/Y h:i:s a', time()); echo date("d/m/Y h:i:s a", time()); */ date_default_timezone_set ("Asia/Calcutta"); $cd=date("d/m/Y"); echo $cd;...

SQL SubQuery getting particular column

Hi everyone, I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here's my question: The subquery below returns a Table with 3 columns, USERNAME, COMPANY, POSITION. I just want to get the USERNAME column out without altering the subquery within. I tried ...

Zend: How to insert NULL values into MySQL

I am using Zend Framework with MySQL,Apache and Ubuntu 9.04. I am trying to insert NULL values into database like this: $personObj->setPersonId( '1' ); $personObj->setPersonEmail('NULL'); $personObj->save(); But 'NULL' is stored in database as string and not NULL. When I use this: $personObj->setPersonId( '1' ); $personObj->setPers...

mysql gem for snow leopard

I had trouble with the gem at first but got it to work when I installed the 64-bit MySQL and reinsatlled the gem with arch flags. So it work in rails. The error I used to get was uninitialized constant MysqlCompat::MysqlRes but that is now gone :) However in Xcode when I run a RubyCocoa project I still get the old error of uninit...

database connection in iphone

How to connect to remote mysql from my iphone application? ...

Using mysql_query and mysql_fetch_array

I am trying to find out which is the proper way to fetch data from my database. Either way works, but what's the difference; an in-depth explanation? $sql = mysql_query("SELECT * FROM _$setprofile"); while($row = mysql_fetch_array($sql)) { $username = $row['user']; $password = $row['pass']; echo "$username:$password"; } ve...

How auto updated the database without refresh with ajax?

hi. i'm new here. i just create a code which can read the data from mysql database. But when i add in new data inside databse, my php page cant updated own automatic. I want the page can updated automaticly withour press f5 button and refresh. Can anyone help me solve this? Get any misstake?? <script type="text/javascript"> function...

how to setup a mysql table for use with UPDATE WHERE statement

I have a table that i store userinfo. Each user has a unique userid, but the rest of their information varies. When i try to run a statement to UPDATE that table, where userid = $userid, i get a Duplicate entry 'XXX' for key 'userid' where XXX is their userid. I have the userid field set as unique, but obviously ive done something wron...

What is better extra query or extra column in database?

What is better extra query or extra column in database for data that will be available very less time. Example: In Case of sub user management either i add one extra column super_user_id in main users table and make enrty if users types are sub_user and the default column value is -1 or i create new table and manage sub user in that tab...

Which MySQL datatype to use to round-off to next nearest figure?

An amount column is of Decimal(10,2) type. How to alter it to round-off to the next nearest figure? The situation is that I can't code it. Is there anyway that I can solve it by just changing the datatype of the column? ...

How can I concatenate set of results in MySQL?

I would like to join results returned in the set in MySQL with a comma as a separator string. For example, set returned contains: COLUMN_X john jerry maria joseph gugla I would like to receive the result as: COLUMN_X-concat john,jerry,maria,joseph,gugla is that possible? thanks. SELECT CONCAT(rooms.ID,",") FROM rooms AS rooms LEF...

Configuring com.mysql.jdbc.log.Log4JLogger for multiple data sources

I've configured the MySQL connector for Java to report metrics using: logger=com.mysql.jdbc.log.Log4JLogger&gatherPerfMetrics=true&reportMetricsIntervalMillis=60000 That works just fine for one data source, but when I have three there is no way to distinguish them, since they all look like: 2009-11-13 12:37:05,506 INFO MySQL ** Perfo...

how to properly handle international character in Php / MySQL / Apache

I need to create an application in Php that can handle all unicode characters in all places - edit fields, static html, database. Can somebody tell me the complete list of all parameters / functions that need to be set / used to achieve this goal? ...

MySQL and EntityFramework

Hi! First sorry for my English =) I use MySql Connector/NET 6.2.0. EntityFramework Data model generation for MySQL database with foreign keys takes hours!!! regards, Khilko Pavel. [email protected] ICQ 245188743 ...

Mysql Importing new codes from excel.

I have a CSV file with mappings from project ids to some new category codes. e.g. Project Id, New Code 1, 035 2, 029 3, 023 4, 035 5, 029 .... The above is in a CSV file/excel file I have a table of projects with these project ids and I want to add a new column with the releavan new code. Is there any way I can do that with m...

SQl query to find the exact table for an isntance name

Hi Can we map two tables of two different SQL database.. My requirement is i want to move a user contact from one perticular table of MySQL Server 1 to another MySQL Server 2 . Can we directly map two different tables on two different MySQL Server. Please suggest me any SQL query to help in this mapping thanks ratish ...

mySQL - Should I denormalise?

Overview (Sorry its vague - I think if I went into more detail it would just over complicate things) I have three tables, table one contains an id, table two contains its own id and table one's id and table three contains its own id and table two's id. I have spent a lot of time pondering and I think it would be more efficient for tabl...

How to change table background depending on database textareas 'height' ?

Is it possible to get the height of a 'text' field from mysql? Or the number of linebreaks would also work! I have a table which fetches the 'text' field from my mysql database. The background image of the table is sort of a container... I want the background to change to another (taller) background if the text is vertically high! Poss...

Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like the following: On model load: SELECT AES_DECRYPT(fieldname, password) FROM tablename On model save: INSERT INTO tablename VALUES (AES_EN...

mySQL - Apply a row level lock using mysqli

Using PHP's mysqli how do you apply a row level lock? Row level locks stop anyone editing currently present rows that match your criteria right? but do they stop a user inserting a row which matches your criteria? Thanks ...