mysql

mod_perl application having weird intermittent mysql driver issues

At completely random times my mod_perl scripts crash for no discernible reason, here's the error I get: [error] install_driver(mysql) failed: Attempt to reload DBD/mysql.pm aborted.\nCompilation failed in require at (eval 20) line 3.\n\n at but wait it gets better. Sometimes it's this instead: [error] install_driver(mysql) failed: C...

Http download stream in PHP and MySQL

Hello, How can I read from mysql and write the same in http output stream. So its like if send a request http://www.xyz.com/download/A it should return me data for A from mysql through php. The data is plain text. Thanks PS: I am new to php. ...

INSERT IF NOT EXISTS type function for me to use without turning the column into primary key?

This script I'm working on is taking data from the web using python's urllib2 module and then putting it in a table. This data is basically just going to be in a table with one column and one row. How do I have it so that when I run the script it just updates the record? I don't want to make it a primary key because I'm probably going...

is it possible to upload folders to database

hi frnds my requirement is that i want upload both folder and files is that possible?i am using following code for uploading the files also i want 2 upload the folders can anyone send the code <?php $target_path = "../mt/sites/default/files/ourfiles/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move...

choosing latest string when aggregating results in mysql

I've been tasked to do generate some reports on our Request Tracker usage. Request Tracker is a ticketing system we use for several departments were I work. To do this I'm taking a nightly snapshot of details about tickets altered for the day into another database. This approach decouples my reporting from the the internal database schem...

wrong return value by mysql_num_fields in C++

thanks for u r reply please give your reply for below program. For table creation and insertion i am using these string. Create table mystudents(sname varchar(50),sno varchar(25),mark1 numeric,mark2 numeric); insert into mystudents values('lala','tk001',100,100); VC+++ CString("select * from mystudents;") int status = mysql_query(hn...

CakePHP: Can't access MySQL database

I'm new to CakePHP and am just running through the configuration process, but am stumped why Cake can't access my MySQL database. The Cake info page says my tmp directory is writable, the FileEngine is being used for caching (don't know what this means), and my database configuration file is present, but that CakePHP cannot connect to th...

mysql query using date of year

hi to all I have a problem for querying records into mysql explanation below The user could pick a date to assign in variable fromdate and todate example. $fromdate = 2008/01/01 $todate = 2009/10/31 In above case, i have to loop and query with the ff: SELECT * FROM table where date BETWEEN '2008/01/01' AND '2008/12/31'; second...

Rails: mysql & postgres at the same time in the same app?

Why you may ask? Because i have built the app on mysql and need to start using postgres for GIS component of my app only. Eventually i will migrate to postgres completely but in the mean time would like to know if this is possible ...

Fast check of existence of an entry in a SQL database

Nitpicker Question: I like to have a function returning a boolean to check if a table has an entry or not. And i need to call this a lot, so some optimizing is needed. Iues mysql for now, but should be fairly basic... So should i use select id from table where a=b limit 1; or select count(*) as cnt from table where a=b; or some...

Use javascript and php via ajax to run MySQL queries

I was looking through some code on a project of mine and thinking about all the php pages that I call with ajax that just run a simple update or insert query and it made me think. What if I could essentially run an insert or update sql query from javascript. assuming I am using the prototype javascript framework for ajax and php on the ...

Achieving properties of binary and collation at the same time

I have a varchar field in my database which i use for two significantly different things. In one scenario i use it for evaluating with case sensitivity to ensure no duplicates are inserted. To achieve this I've set the comparison to binary. However, I want to be able to search case-insensitively on the same column values. Is there any wa...

Run Apache / PHP / MySQL (CakePHP) application on a USB stick?

Hi, I have an existing CakePHP that runs on a LAMP environment and need to install it on a USB drive for mass public distribution. There are a few requirements: Protect the source code No installation required Windows support essential MAC & Linux would be a bonus Must run offline, without Internet connection Ability to sync with ser...

How can I store and retrieve images from a MySQL database using PHP?

How can I insert an image in MySQL and then retrieve it using PHP? I have limited experience in either area, and I could use a little code to get me started in figuring this out. ...

How to insert escape characters in mysql

Hi I want to insert all escape characters in a column in MySQL. I can not insert \ always because a long data may have a lot escape characters. Thanks Sunil Kumar Sahoo ...

bash script - select from database into variable

I need a variable to hold results retrieved from the database. So far this is basically what I'm trying with no success. myvariable=$(mysql database -u $user -p $password | SELECT A, B, C FROM table_a) My understanding of bash commands is not very good as you can see. ...

Is there any other efficient way to use table variable instead of using temporary table

we are writing script to display banners on a web page where we are using temporary table in mysql procedure. Is there any other efficient way to use table variable instead of using temporary table we are using following code: -- banner location CURSOR -- DECLARE banner_location_cursor CURSOR FOR select bm.id as masterId, bm.secti...

Out of range value for Integer

Out of range value for Integer column type does not truncate to it's maximum value if there are more than 19 digits. In the following example, there should not be -1 value in the second row. Is it a bug? drop table if exists test; CREATE TABLE `test` ( `col1` int(11) NOT NULL, `col2` int(11) NOT NULL, `col3` int(11) NOT NULL, `...

top 2 values from group by

When I will group by details column and look for the date "2009-08-05" I want the earlier one day id as well. select id, details, abc_date from test order by details limit 10; +------------+------------------+------------+ | id | details | abc_date | +------------+------------------+------------+ | 2224 | 10025...

MySql: Can a stored procedure/function return a table?

Hi! Can a MySql stored procedure/function return a table without the use of temp table? Creating the following procedure CREATE PROCEDURE database.getExamples() SELECT * FROM examples; and later calling it with CALL database.getExamples() displays the example table - just as expected - but the following doesn't seem to be possib...