mysql

fetch image from mysql via PHP

Hi.. I want to fetch blob datatype of images from MYSQL database using PHP and these images displayed in Iphone Uiimageview. can anybody post some PHP code to retrieve images from mysql. Thanks ...

How to tally column values of multiple rows with pure mysql?

hypothetic tables user_id | hits Can I get MySQL to return the total hits of a Select query? I know i could add them together with php or similar, just wondering if there is a pure MySQL way? ...

Database Tagging with alternative Results

Hi, I'm working on an PHP/Jquery autosuggest tool that'll query a large table of tags but I need some suggestions for the db schema that'll return related tags as well as match-based results. For example: I type 'Web': Results 'Web Developer' 'Web Designer' 'Web Analyst' and also related tags... 'PHP Developer' 'Flash Program...

BLOB over varchar?

I am developing a blog, where my client wants to use lot of images, for(articles, titles, advertisement, etc.). he hardly wants any text there, as the blog he wants it to be developed in arabic and he is not happy with any of the supporting font by web browser, nor he wants to adopt the EOT, he will be updating the blog daily (like just ...

MySQL: Getting connected (simillar) data with lef/right fields

In MySQL Im having two tables: PRODUCTS (id, Name) SEEALSO (id, prodLeft, prodRight) SEEALSO defines which PRODUCTS are related together and are represented as binded fileds "prodLeft"-"prodRight". For Example: PRODUCTS: 1 Desk 2 Table 3 Chair 4 Doors 5 Tree 6 Flower SEEALSO 1 1 2 2 2 3 3 3 4 4 5 6 From that we can see bin...

MySQL query for navigation CMS

I'm currently trying to work out a way to make my navigation items moveable via dynamic mysql/databases. Currently I have a table looking like this id menuText posId int random text 1-999 number The thing is, depending on the number in posId. The menuText will be sorted by it. What I'm trying to do is add a function to ded...

Zend_db_table: How to Select with a Mysql Keyword

Hey Any Ideas how I can build the following query with the zend_db_table class? SELECT SUM(x) FROM traffic thanks ...

Duplicate Array key in Doctrine result

For a website i'm building I need to check wether a location has contracts, these locations can have contracts linked directly to them or when there part of a larger organisation also have contracts that are linked to the organisation. I am trying to use a DQL query to first check if there are contracts linked directly and then if there...

How to perform addition of date which taken from database in PHP5 ?

actually I save date in database in varchar format. firstly I retrieve date from databae & store it into $date. now i want to perform addition of 5 days with $date1. when i search on internet i got this code : $date = date('Y-m-d', strtotime("+5 days")); now can you tell me how I insert $date1 value to this code for get expected res...

Convert BLOB into TEXT with foreign characters

I have a blob which holds HTML in it. Some of this HTML has foreign characters (ie: æ, ø, etc). I want to convert the BLOB into TEXT. I am using latin1 for my tables and changing this is not an option. From what I can tell, if if I store the foreign characters in TEXT, it is converted into something like ASCII. But if you store it in BLO...

mysql recursive self join

create table test( container varchar(1), contained varchar(1) ); insert into test values('X','A'); insert into test values('X','B'); insert into test values('X','C'); insert into test values('Y','D'); insert into test values('Y','E'); insert into test values('Y','F'); insert into test values('A','P'); insert into test values('P','Q'); i...

Lost connection to MySQL server during query - PHP, MySQL

Hello, I have this php code, the files are hosted on another server and db else where $hostname_xxx = "xxxdb.db.234141.mysqldbhosted.com"; $database_xxx = "xx11xx"; $username_xxx = "xx11xx"; $password_xxx = "xx332211xx"; $shasown = mysql_pconnect($hostname_xxx, $username_xxx, $password_xxx) or trigger_error(mysql_error(),E_USER_ERROR);...

Accessing data from servlet

Hi, I have got a requirement that mysql database can only be accessed from localhost. I have to implement a servlet that would access the database allowing other servers in this system to access data (servlet would work as a proxy). However, this system consists of a remote server which downloads large portions of data executing a state...

python mysqldb timestamp/unix_timestamp issue

trying to understand the subtleties of inserting data into a mysql tbl when dealing with unix_timestamp, and the timestamp def within the tbl using python v2.6, using the mysqldb lib i'm consistently getting the err/warning: TypeError: not all arguments converted during string formatting the test tbl looks like: DROP TABLE IF EXISTS ...

SQL to combine 2 tables

I have 2 separate queries that returns to me the following tables: =========================== Id f_name l_name =========================== 15 Little Timmy 16 John Doe 17 Baby Jessica --------------------------- =========================== Id item_name item_price =========================== 15 Camera...

SQL Statement to access data across relationships

Hi, I have the following tables in my SQL Database: authors: name varchar id int Primary Key publications: id int Primary Key title mediumtext year int authorsJoinTable: authorId -> Foreign Key to the authors table publicationID -> Foreign Key to the publications Table sequenceId int I am wondering ...

Using MySQL in VC++

Hello everyone, I am trying to connect to MySQL using C++. The IDE that I am using is Visual C++ 2010. I followed the steps on the MySQL dev page (http://dev.mysql.com/tech-resources/articles/mysql-connector-cpp.html). I followed the steps exactly as given although i used a different OS(Windows). I get many linker errors in the process,...

How to add condition "LIKE ? %something%" to the product title to this join

Product.find(:all, :conditions => { :companies => { :malls => { :id => 1},:products => {:title => "nexus one"} }}, :joins => [:company => :mall]) ...

SQL Calculated Field

I'm creating a view as such: CREATE VIEW all AS SELECT m.id, m.title, m.description, m.date, m.views, r.rating, r.id FROM riv_montage m, riv_ratings r But I'd like to create a calculated field on each row that does something like: r.rating/COUNT(r.id) Is there any way to do this? ...

Linking tables from other database in MySQL.

Is it possible to link tables from other databases (MS SQL, Sybase, etc.) inside a MySQL database, on a Debian server? I am thinking this could be possible using ODBC. ...