mysql

mysql result returns ?(question mark) instead of Ö etc

When i return a row from my mySQL database, I get a ? instead of some characters eg:ò, à etc. My mysql row and table are set to utf8_unicode_ci, so I think the database is storing it correctly but php isnt returning it correctly. Think it has something to do with mysql_set_charset but cant get it to work properly. Any help would be gr...

nHibernate returning tinyint as 10 instead of 1

With C# 4 I am using CreateSQLQuery to do a simple select statement on a table with a tinyint. This is mapped to a byte on the C# side. When I run it, instead of 10 it will return 1 though, and if I use SQLYog with the same statement it works fine(returning 10 like it should). Thanks. EDIT: I have now tried with HQL aswell with the same...

nested select mysql

hi i want write this sql select statment in mysql v 3.23 select * from radacct where username in (select username from radcheck where Attribute= 'max-weekly-session'); but say ERROR 1064: You have an error in your SQL syntax near 'select username from radcheck where Attribute= 'max-weekly-session')' at line 1 in mysql v 5 this is ...

How to make EF execute Insert Queries in the right order?

Hello, I am using the Entity Framework with a MySQL server because I want to be able to do nice and easy LINQ queries againy my MySQL database. I have a very simple problem and I'm frustrated because I can't believe that the EF is making such a horrible mistake. To simplify, I have parent and child classes, and I want to execute two in...

Asterisk - Cleaning up MySQL() Connections in 'h' Extension

In one of our very simple custom contexts I would like to add some database logging outside of the built-in cdr app. I have something like the following: [inbound-custom] exten => _X.,1,MixMonitor(/mnt/temp/inbound-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}-${EXTEN}-${UNIQUEID}.wav) exten => _X.,n,MYSQL(Connect connid mysqlip...

How do I preserve data when changing column datatypes in MySQL?

For example, suppose I have a TINYINT column that I want to change into an ENUM. Is it possible to write a MySQL query that changes the datatype of the column while mapping the existing data so that (for example) 0 becomes No, 1 becomes Yes, and 2 becomes Maybe? ...

Is it possible to pass entire WHERE condition in stored procedure in MySQL 5.x ?

I just need pass WHERE condition, like: CREATE DEFINER=`root`@`localhost` PROCEDURE `productpricing2`( IN cond CHAR(200) ) BEGIN SELECT * FROM tbl_products WHERE cond LIMIT 1; END and call it like: CALL productpricing2("productName IS NOT NULL"); Where productName is column in table tbl_products Thanks ...

Can't install mysql gem on Snow Leopard using Zend Server

Hi! There's a lot of information out there regarding installing the ruby/rails mysql gem on Snow Leopard, however, none of it seems to work for me. I'm wondering if it's because I'm using the Zend Server (CE) as my web stack? Here's what I'm running to install the gem: sudo env ARCHFLAGS="-arch x86\_64" gem install mysql -- --with-mysq...

MySQL: Strange result when subtracting Date value and NOW()

I just tried to insert two rows with the current datetime and then calculated the elapsed time since that date. Here are the rows from my table after two insertions and using NOW() function to set the timestamp: mysql> select * from pendingActivations; +--------+------------+---------------------+ | userId | code | timestamp ...

Issue creating "custom" user URLs

I am running into the following issue: Our members have a desire for personalized sites directly from our primary domain in the form of http://www.example.com/membername. I am looking at possibly solutions in two ways but neither are ideal (will be explained below). Method 1 - ?Member= In this method, I simply create a custom URL and...

mysql if condition

I have to create a query and in that query I need to be able to do this select if(filename is like .jpg/gif) as type from pictures; I basically need to send the type of the picture through but they can be either jpg or gif but I don't know the syntax for the if like condition. tried this and still nothing select fileType, IF(fileTyp...

What is the best escape character strategy for Python/MySQL combo?

This is my query. cursor2.execute("update myTable set `"+ str(row[1]) +"` = \"'" + str(row[3]) +"'\" where ID = '"+str(row[0])+"'") It is failing when row values have double quotes "some value". How do I escape all special characters? Any feedback is highly appreciated. Thank you... ...

Flash Photo Album Creator

It's been a long time since I did anything in flash, and today, I just received an assignment to create a photo album creator (aka PAC) with a PHP/Mysql backend. It would be great if anyone can recommend off the shelf modules I can incorporate into my project. Any additional advice would be helpful. Here are the requirements for the ...

Facebook connect database transaction help

I am trying to implement a simple login system with facebook, but I need users to pick a username. What I was thinking was to get all the information I need from facebook, request permissions, then add the information to the database, redirect to a form asking for a username and then add that to the database, to the same entry. I think ...

sqlalchemy session not recognizing changes in mysql database (done by other processes)

Application consists of: main process (python+sqlalchemy) that periodically check db (sleeps most of the time) child processes that write to db web app that write to db Problem is that the main process session doesn't seem to register changes in the db done outside that session. How do ensure it does? (as of now I am closing and...

Streaming ResultSet Error

I am trying to run multiple MySQL queries which build up on each other: i.e field value of one element in each row is used as input for another query. I end up getting the following error: java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@174cc1f is still active. No statements may be issued when any streaming re...

mysql query where IN statement

Hi there. I want to do the following: SELECT count(id) FROM table WHERE value BETWEEN 3 AND 40; But it should do the following: SELECT count(id) FROM table WHERE value IN(3, 4, 5, 6, 7, 8, 9, 10, 11, ..., 40); It should even print out zero count(id) for value between 3 and 40, but not value = x. I want to check if a value is in a s...

[MySQL] Column alias not recognized in WHERE-statement

Hi all, I have a strange 'problem' with one of my created queries. Given the next query: SELECT ID, DistanceFromUtrecht, ( SELECT (MAX(DateUntil) - (ReleaseDays * 60 * 60 * 24)) FROM PricePeriod WHERE PricePeriod.FK_Accommodation = Accommodation.ID ) AS LatestBookableTimestamp FROM Accommodation WHERE LatestBooka...

I need to select a timestamp and insert a date

Hi there, I have a timestamp in a database table. Now everytime a record is amended the timestamp changes - this isn't really what I want as the record represents a sale so everytime the data is amended it looks like the sale time has changed! Thus I have added a new field to the database table called 'sale_date' and I want to select th...

How to show how many MySQL queries are taking place on a page?

I want to be awry of performance while I build my project, I want to stick a piece of code in the footer of my site that will show how many queries are being performed on the page. I have seen this elsewhere, it looks like: 19 queries in 2.4 seconds What is the PHP snippet for this? ...