mysql

PHP: query, what is wrong?

$BuID= mysql_real_escape_string($_POST['buID']); $uID= mysql_real_escape_string($_POST['uID']); $Vn = mysql_query("SELECT id, full_name FROM users WHERE id = '$BuID'"); $vc = mysql_fetch_array($Vn); $U = mysql_query("SELECT id, full_name FROM users WHERE id = '$uID'"); // WORKS FINE $showU = mysql_fetch_array($U); // WORKS FINE The ...

What's the easiest way to display NULL value as empty string instead of "null" string in an ExtJS grid?

I have a server-side script (PHP) returning JSON data to populate an ExtJS Grid. This data comes from a MySQL query, containing some NULL values. When PHP encodes it into the JSON notation, it keeps the NULL intact: {"id":"33","name":"Test1","url":null,"cls":"x-tree-noicon","expanded":true} But... when this data is displayed in the ...

PHP: mysql_query INSERT INTO grab id?

so i have this: mysql_query("INSERT INTO..."); I was wondering after you've inserted if you could echo out the id of the column you have inserted, or should i SELECT and that all around again? ...

MySQL timestamp to Java date conversion

How can I convert time in unix timestamp to normal time? ...

How can I change my MySQL collation in WAMPSERVER

How can I change my MySQL collation in WAMPSERVER from latin1_swedish_ci to UTF-8 because I think my HTML special characters are getting all messed up ...

PHP & MySQL special character encoding problem.

When a user submits a special character ♠ it's stored in MySQL database as â� and if a user wants to change it instead of displaying it back as ♠ its displayed as â� how can I fix this problem so that its dsiplayed back as ♠ and saved as ♠? On a side note how should I save my special characters using PHP? I'...

What are the strategies for dealing with Numeric Sequence Primary keys once you hit the data type limit...

Consider the following sample table in MySQL: CREATE TABLE transactions ( transId BIGINT NOT NULL AUTO_INCREMENT, transDate DATETIME NOT NULL, transTotal DECIMAL(10,2), PRIMARY KEY (transId) ); This table is used in high volume operations i.e. lots of INSERTS. You will eventually reach the maximum limit of transId. ...

Count number of NULLs in a row

Is there a way to get a column indicating the number of NULL fields in a row? This would be within a SELECT statement. For Example: Field1 Field2 Num_Null ----------------------- NULL "A" 1 UPDATE: I want this query so I can sort based on how many Affiliates sales there are of a given Book. So having 3 affiliates would b...

Periodically replacing a running MySQL database

I've got a large-ish MySQL database which contains weather information. The DB is about 3.5 million rows, and 486 MB in size. I get a refresh of this data every 6 hours, in the form of a mysql dump file that I can import. It takes more than 2 minutes to import the data and probably a similar amount of time to create the index. Any th...

php mysql check db first

<?php $thesite = strip_tags($_GET['s']); $original_file = @file_get_contents($thesite); if ($original_file === false) { die("$thesite does not exist"); } elseif($orginial_file === true ) { $data = $path_info['host']; $check = mysql_query("SELECT * FROM first WHERE name='$data'"); } else { //step3 } I want to check the...

The best database for a C++ and java applications

Hi I am making an ATM console application in C++. I am planning to use a database, my friend suggested to use files. However, I want to use a database like mySql, Oracle or sqlServer express. Q: Which one of the databases would be more applicable for a C++ application ? I am also making a second application in java. This is a large li...

Unreadable data in Mysql from a GeoDjango PointField

Hi, I'm using GeoDjango with MySQL. I use a models.PointField(srid=4326) object, all works fine, the data is correctly saved and retrieved from the database, but when I do a "select * from table" from MySQL command line, data of PointField field shows unreadable characters, instead of a "POINT(x,y)" form, as I expected. Is it a normal b...

problem in using CONCAT if the value is Null in mysql

hey guys i used CONCAT to get my tags and topics but if the story has no tag or topic then result is empty WHERE CONCAT( ' ', table_stories.tags, ' ' ) LIKE CONCAT( '%', table_tags.tid, '%' ) AND CONCAT( ' ', table_stories.associated, ' ' ) LIKE CONCAT( '%', table_topics.topicid, '%' ) as you see , ever...

How to insert date(y-m-d) into MySQL database ?

I have a field of type date in MySQL. When I try to insert any date in this field with PHP using following query, It stores 0000-00-00 in that field. For example: UPDATE test SET dob=2000-09-20 WHERE id=3 ...

Is there a performance decrease if there are too many columns in a table?

Is there some performance loss if one of tables in my database has huge amount of columns? Let's say I have a table with 30 columns. Should I consider splitting the table into few smaller ones or is it ok? What is a recommended maximum amount of columns per database table? Thank you. ...

Store and retrieve friends contact list using mysql

Hi I want to create a database that can store the friends contact list as like social networking what is the best way to design the database structure and easy to retrieve the contacts of friends using mysql. i need solution for this, HELP ME regards ~Deepu~ ...

Using MySQL Index for foreign Keys with Hibernate

Hello everyone, Our current database (MySQL) already has Indexes for its foreign keys since these use InnoDB, which (afaik) automatically generates IndexTables for foreign keys. Hibernate wasnt used to create these tables. So my question is: Is MySQL using Indexes for their foreign keys automatically, when I use Hibernate to fetch Data ...

MySQL MyISAM fulltext search - how to add '#' as a word character for utf8 charset?

I am using MyISAM full text search. The table columns are having charset "utf8" and "utf8_general_ci" as collation. Now I want to implement #HashTag system, so that if I search for "#HashTag", only rows that contain "#HashTag" show up. Not rows that just contains "HashTag". According to the comment in this MySQL documentation, its easy...

API's on website

I have never used an API as part of a website, I have always coded things myself, but I am now thinking about maybe looking at starting to use some, I mean why re-invent the wheel!? So, my question is, where do you start, how do you integrate, how do they work, what do I do, will they fit seamlessly into my site/design? Any pointers, a...

MySQL select replace - use manual values instead of joined lookup table

I'm combining these 3 tables into a report query with INNER JOINs (this is a simplified example): USERS ID NAME CODE1 CODE2 1 James c1_2 c2_3 2 Bob c1_3 c2_1 C1 CODE1 VALUE c1_1 interested c1_2 maybe c1_3 not interested C2 CODE1 VALUE c2_1 prepared c2_2 self-study c2_3 ...