mysql

Why does mysqli.fetch_field_direct() return different results when working with db views under LINUX/WIN?

I created a Database View in Mysql. I select the view via php's mysqli extension and extract the meta column infos using the fetch_field_direct method. Under linux it shows in field orgtable the name of its real table. Under windows only the view name is shown. Why this? Is it a bug? Does someone has a alternative solution? ...

PHP Code Problem...

function check_login($array_val) { $strQury = "Select * from tblsignup where usr_email ='".$array_val[0]."' and usr_password = '".$array_val[1]."'" ; $result = mysql_query($strQury); $row_user = mysql_fetch_array($result); if(mysql_num_rows($result)>0) { $msg = "true"; } else { $msg ...

mySQL Trigger works after console insert, but not after script insert.

Hello, I have a strange wird problem with a trigger: I set up a trigger for update other tables after an insert in a table. If i make an insert from mysql console, all works fine, but if i do inserts from external python script, trigger does nothing, as you can see bellow. When i insert from console, works fine, but insert THE SAME D...

Join this two queries into one

I'm just wondering if there is a more efficient way of doing this. I have a table in which I track users scores for different flash games. The table games_scores is defined like this: Each user can have multiple entries for any game in this table. When I display the score board I only select the MAX score fore every user. Nothing fan...

Ibatis startBatch() only works with SqlMapClient's own start and commit transactions, not with Spring-managed ones

Hi, I'm finding that even though I have code wrapped by Spring transactions, and it commits/rolls back when I would expect, in order to make use of JDBC batching when using Ibatis and Spring I need to use explicit SqlMapClient transaction methods. I.e. this does batching as I'd expect: dao.getSqlMapClient().startTransaction(); dao.ge...

Help optimizing a query with 16 subqueries

I have indexes/primaries on all appropriate ID fields for each type. I'm wondering though how I could make this more efficient. It takes a while to load the page with only 15,000 rows and that'll quickly grow to 500k. The $whereSql variable simply has a few more parameters for the main ebay_archive_listing table. NOTE: This is all do...

problem in running complex multiple table mysql query

hey guys i need to show pages'details , now i used this query to fetch from 3 tables group_concat( ) its working fine but shows array of tags and topics duplicated. ...

Python MySQLdb LOAD LOCAL INFILE problems

The problem is a simple one. When I execute the following I get different results depending on whether I run it from the MySQL console and from inside a Python Script using MySQLdb: LOAD DATA LOCAL INFILE '/tmp/source.csv' INTO TABLE test FIELDS TERMINATED BY '|' IGNORE 1 LINES; Console gives the following results: Records: 35002...

MySql selecting default value if there are no results?

i'm having 2 tables: members and comments. I select all members, and then join comments. But in comments I'm selecting some SUM of points, and if user never commented, I can't get that user in listing?! So how to select default value for SUM to be 0 if user never commented, or some other solution: SELECT c.comment_id AS item_id, m.memb...

Adding relative week number column to MySQl results

I have a table with 3 columns: user, value, and date. The main query returns the values for a specific user based on a date range: SELECT date, value FROM values WHERE user = '$user' AND date BETWEEN $start AND $end What I would like is for the results to also have a column indicating the week number relative to the date range. So if ...

mysql: how to change column to be PK Auto_Increment

is there a single select statement that will do all three of those: primary key, unique, and auto_increment? ...

How do stop form posting to mysql if database contains a specific ID?

I have a form that I am using to post data to mysql. Before submitting the form I want to check the database and see if there are any fields in the column 'customerid' that equal 'userid' and if so not to post the form. Basically, I am trying to limit my users from posting more than once. Users will be able to login to my system and ma...

How to optimize this MySQL query

This query was working fine when the database was small, but now that there are millions of rows in the database, I am realizing I should have looked at optimizing this earlier. It is looking at over 600,000 rows and is Using where; Using temporary; Using filesort (which leads to an execution time of 5-10 seconds). It is using an index...

Stopping users posting more than once

Before posting my form I am checking the database to see if there are any previous posts from the user. If there are previous posts then the script will kick back a message saying you have already posted. The problem is that what I am trying to achieve isn't working it all goes wrong after my else statement. It is also probable that the...

PHP, MySQL, jQuery, AJAX: json data returns correct response but frontend returns error

Hi all, I have a user registration form. I am doing server side validation on the fly via AJAX. The quick summary of my problem is that upon validating 2 fields, I get error for the second field validation. If I comment first field, then the 2nd field does not show any error. It has this weird behavior. More details below: The HTML, JS...

Many-to-many relationships examples

I haven't found any MYSQL many-to-many relationships examples here and in google. What I am looking is to see a very simple example with php+mysql showing database's results. Can anybody write a very simple example? ...

Control process concurrency in PHP

I have programmed a simple app that every X minutes checks if an image has changed in several websites and downloads it. It's very simple: downloads image header, make some CRC checks, downloads the file, stores in a MySQL database some data about each image and process next item... This process takes about 1 minute to complete. The pr...

MySQL More Tables or More Rows

I am working on a game that I am going to open to the public to have on their game. The game stores lots of information (about 300 rows) per website and spends a lot of time updating values within this MySQL database. Is it better (faster/efficient) to add a new table for every website or to just have 1000's of rows in one table and add...

What would be my best MySQL Synchronization method?

We're moving a social media service to be on separate data centers as our other hosting provider's entire data center went down. Twice. This means that both websites need to be synchronized in some sense -- I'm less worried about the code of the pages, that's easy enough to sync, but they need to have the same database data. From my r...

Is MySQL caching occurring, how to fix it?

I think that MySQL or ASP.NET is caching my queries. I edited my MySQL sproc to remove some parameters but it keeps saying that those parameters are missing. How do I fix this or make it work again? Edit: I'm experiencing this problem : http://stackoverflow.com/questions/286585/mysql-caching Except that I don't have permissions to ...