mysql

Can this query be done without a loop?

So, basically, I have a MySQL table called 'topics' and another one called 'replies', for example. In table 'topics', there's a field called 'relforum' which relates this topic to a forum section. And in the table 'replies', there's a field called 'reltopic', which relates the reply to a topic. Both tables have an id field, auto_incremen...

Volatility of query results in asp

I have seen a couple of instances now where some legacy code I'm working on exhibits what seems buggy behovior and I wonder if I just don't understand something. rsCaspio.Open sql, dbCaspio, ,adLockReadOnly response.write(rsCaspio("fieldname") & "<BR>") response.write(rsCaspio("fieldname") & "<BR>") It will write the contents th...

Does mysql enforce special syntax constraints on sql inside stored procedures? (select into problem)

I am often having a very hard time to create a stored procedure in mysql. Syntax which should really be fine just get not parsed within a stored procedure. Here is a simplified version that still doesn't get parsed. I am not able to turn this code into something that can be parsed. The update..set clause gives problems UPDATE I've sim...

Search entire table? PHP MySQL

Hello, I have made the following search script but can only search one table column when querying the database: $query = "select * from explore where site_name like '%".$searchterm."%'"; I would like to know how I can search the entire table(explore). Also, I would need to fix this line of code: echo "$num_found. ".($row['site_name']...

MySQL "extended" vs "show status"

When I do mysqladmin extended from the command line, my Com_* counters differ completely from doing a show status when consoled into MySQL. Why is this? ...

Php and mysql caching

I am currently working on a php/mysql project with the AbleDating system, my customer is worried about server load so he asked me to use "caching" as much as I could, he asked me to cache mysql query and some html zones... Is that possible to cache only some html zones with php? If yes how can I do this? For the mysql caching is it jus...

PHP how to run sql query one part at a time?

I have a table with roughly 1 million rows. I'm doing a simple program that prints out one field from each row. However, when I started using mysql_pconnect and mysql_query the query would take a long time, I am assuming the query needs to finish before I can print out even the first row. Is there a way to process the data a bit at a tim...

Search with PHP for calendar dates within a MySQL array?

I'm building a calendar and I'm really dumb when it comes to arrays. First of all, I need to query my database, so: $events = mysql_query ("SELECT id,title,date WHERE date BETWEEN 2009-01-01 AND 2009-01-31") or die(mysql_error()); So, now I need to order those events so, when I'm echoing my calendar table, I can check this array for ...

How do I kill all the processes in Mysql "show processlist"?

Because ther eis a lot in there..and "time" is big number. ...

Django + MySQL on Mac OS 10.6.2 Snow Leopard

There were some excellent answers to this question already, however, they are now outdated. I've been able to get the module installed, but "python manage.py runserver" fails with iMac:myproject drhoden$ python manage.py runserver Validating models... Unhandled exception in thread started by <function inner_run at 0x10496f0> Traceb...

Why I can not show my MySQL information in my GUI table?

I have a "Manager" class and "BirthList" frame. In my BirthList frame I have a GUI table that shows all the data that are in mySQL table but it does like this: When I open this frame, I see the last data that I added and when I click on Close button, at first the last data will be deleted from my table and then the frame will be closed ...

How to apply wildcard in instr() in MySQL?

Using a wildcard so all records will be matched. My code: if(empty($tag)) { $tag="%"; } mysql_query("select * from mytable where instr(tag,'$tag')>0") or die(mysql_error()); But it returns zero result. Even if if(empty($tag)) { $tag="*"; } It still returns zero result. How to resolve this problem? ...

how to only insert the filled text inputs?

this is my code: <input type="text" name="text[]" /> <input type="text" name="text[]" /> <input type="text" name="text[]" /> if (!empty($_POST['text'])) { foreach ($_POST['text'] AS $value) { // add to the database $sql = 'INSERT INTO tableName SET fieldName = "' . mysql_real_escape_string($value) . '"'; } } I want this to o...

Populating a UITable with info from a website (mySQL database)

I'm looking to write an iPhone app that populates a UITable with information from a field in a database that is stored online, and when selected shows more information from the database. For example, a list of names that when tapped will show a bio for the person, some basic stats, and a picture. OR Is it possible to use CoreData, and...

How can I store images in BLOB?

Hi, I can not find useful code for how storing the images into BLOB ,please help me with some code and also can I show those images from MySQL to my desktop pane in GUI? ...

MySQL - How to find which sql query is being executed.

Hi Experts, How can i find which query is being executed in mysql. Example : I have a java application which makes several calls to the database, i want to track the queries executed by this application from the sql side. Thanks Micheal ...

Cannot delete or update a parent row: a foreign key constraint fails

When doing: DELETE FROM `jobs` WHERE `job_id` =1 LIMIT 1 It errors: #1451 - Cannot delete or update a parent row: a foreign key constraint fails (paymesomething.advertisers, CONSTRAINT advertisers_ibfk_1 FOREIGN KEY (advertiser_id) REFERENCES jobs (advertiser_id)) Here are my tables: CREATE TABLE IF NOT EXISTS `advertisers` ( `a...

why does mysql inner join query take so much time

in mysql i have two tables tableA col1 col2 SIM1 ..........col24 ----------------------------------- a x 1 5 b y 1 3 c z 0 2 d g 2 1 tableB colA colB SIM2 ------------------- x g 1 y f 0 x s 0 y e 2...

can not issue data manipulation statements with executeQuery()

in mysql i have two tables tableA col1 col2 SIM1 ..........col24 a x 1 5 b y 1 3 c z 0 2 d g 2 1 tableB colA colB SIM2 x g 1 y f 0 x s 0 y e 2 i am using java program to connect to mysql database u...

Finding the rank or index of some name in an array returned by query

I am firing a query which returns minimum 1000 rows containing name, amount in order amount desc. I want the index of some name from that array, I don't know how to do it? As I am using Ruby, I use arr.index(name)+1 method which returns the index properly. But I want some MySQL query which gives me only numbers for that particular name....