mysql

MYSQL & PHP: mysql ignoring first row

I have never had this happen before. The query is very simple by the way. $q = mysql_query("SELECT * FROM $TABLE"); while($r = mysql_fetch_array($q)) { echo $r['fieldname']; } edit: the first column (row) is skipped. but when I deleted the first column, the second one was ignored. (SOLVED) I figured it out. I declared m...

How can I prevent Hibernate + c3p0 + MySql creating large numbers of sleeping connections?

I'm using GWT with Hibernate, c3p0 and MySQL to produce a web app with a limited audience (max 50 users per day). During testing I found that Hibernate was opening a connection with each session but not closing it, irrespective of use of the close() method. My current configuration is as follows: hibernate.connection.driver_class=com.m...

what mysql query is better?

i got 2 mysql queries, that retrieve the same data?, what one do you think is better to use and why? taking into account standards, and better code etc. sorry if this is a stupid question, but im a curious cat! so here goes: QUERY 1: SELECT * FROM (( SELECT u.username, u.picture, m.id, m.user_note, m.reply_id, m.reply_name, m.dt FR...

How to replace NOT EXISTS nested select with JOIN

Hey there, I'm kinda stuck trying to optimise a query which has a NOT EXISTS clause on a nested SELECT. I've been rewriting my queries containing nested selects, changing them to joins, but on this occasion I'm not sure how to combine that with the NOT EXISTS clause. I have the following query: SELECT `reg_no`, COUNT(*) AS `records_foun...

i have problem in mysql

Error Code: 1109 Unknown table 'chaindb.credit_trans' in field list i have error-code 1109 in call procedure in mysql help me,please ...

Update C# client whenever database is updated

I am using MySQL with C# / Visual Studio 2008. I need to know any method so that if one user updates the database, all the logged in users over the network, are notified that a change has been occurred. If i logged in the database through my application, at that time the serial no of the latest record in the database was 10, and then i s...

Float or decimal for prices?

Hi all, Which type (Float or decimal) is best used to store prices in a database? Thx ...

How to use reverse engineering in my eclipse

i am using MySql workbench and My Eclipse 8.6. and making a Hibernate-spring program. Is it possible to use reverse engineering feature in my eclipse with MySql work bench in so that DAO and hbm files can be generate like Derby. How can i do this with MySql workbench. this is a URL of using reverse engineering in my eclipse. http://www.m...

Indexing based on Peano-hilbert curve?

Hello, I have a x,y,z 3D points stored in MySQL, I would like to ask the regions, slices or point neighbours. Are there way to index the points using Peano-Hilbert curves to accelerate the queries? Or are there more efficient way to store the 3D data in the MySQL? thanks Arman. ...

What is the nicest way to select the current week in MySQL

At the moment I have something like this... SELECT SUM(a.PaidSingle) AS PaidSingle, DATE_FORMAT(a.TimeIn, '%a') AS weekDay FROM Attendance AS a JOIN MemberDetail AS m ON m.id = a.MemberID WHERE m.CardNumber = '$cardNo' AND WEEK(a.TimeIn, 0) = WEEK(NOW(),0) GROUP BY weekDay ORDER BY a.TimeIn But it dawned on me after writing i...

Commands out of sync when using mysqli and prepared statements

Hello, I am trying to do some calls, but the 2nd query fails with command 'Commands out of sync; you can't run this command now' error. The code looks like this: $sql="call listReport();"; $results = mysqli_query($link,$sql); $arr=array(); while($row=mysqli_fetch_array($results)) { array_push($arr,$row); } mysqli_free_result($res...

MySQL transactions: multiple concurrent transactions and data integrity

I'm using transactions for managing data across several MySQL InnoDB tables in a reasonably complex web application. Briefly, a given transaction works as follows: Data is read from a row in a "user_point_totals" table Various machinations calculate what the user's new point total should be A new entry is created in the "user_point_to...

I need to create a custom query using specific characters from database

What i have is a rather large database of flight numbers based on divisions. the flight number is entered as following eg: CCC-NOC001 where the number breaks down as follows CCC airline Code NOC division Code and 001 actual flight number. Now i am trying to create a filter that will select flight number from the schedule based on the di...

Optimizing Python Code for Database Access

Hi, I am building an application with objects which have their data stored in mysql tables (across multiple tables). When I need to work with the object (retrieve object attributes / change the attributes) I am querying the sql database using mysqldb (select / update). However, since the application is quite computation intensive, the e...

Why does select statement influence query execution and performance in MySQL?

I'm encountering a strange behavior of MySQL. Query execution (i.e. the usage of indexes as shown by explain [QUERY]) and time needed for execution are dependent on the elements of the where clause. Here is a query where the problem occurs: select distinct e1.idx, el1.idx, r1.fk_cat, r2.fk_cat from ent e1, ent_leng el1, rel_c r1, _tax_...

sql time functions

how can I do the analogous to SELECT EXTRACT(EPOCH FROM TIMESTAMP '2001-02-16 20:38:40') in PostgreSQL, but in JDBC? thanks ...

MySQL: Is it better to have an index and a small filesort or no index and no filesort?

I have a large database (180k+ rows and growing fast) of location data and am plotting them on a google map. For a given view port, I just want to serve up a sample of 100 applicable points. The database is therefore queried by lat/lng, but if I put an index on these rows the problem is that the sample of 100 points will be either at t...

Complex query. Help me, please!

I have a table type: id | text | tel | time ---------------------------- 1 | text1 | tel1 | unixtime 2 | text1 | tel1 | unixtime 3 | text1 | tel1 | unixtime 4 | text2 | tel2 | unixtime 5 | text3 | tel3 | unixtime 6 | text3 | tel3 | unixtime I want it "clean", try to delete all rows where is text = tel, and leave one with the l...

MySQL datetime into PHP

I have found a proper solution to my "problem" but even after reading mysql pages, I don't understand the logic behind it. I currently store registration information in my system in a "datetime" formatted field in one of my tables (YYYY-MM-DD hh:mm:ss). When I want to display the data on one of my php pages, simply posting the exact fi...

MySQL ND SSL in PHP5.3.3

According to http://www.php.net/manual/en/mysqlnd.overview.php MySQLND now supports SSL Does anyone know of any examples of setup of an SSL connection with MySQLND? Is the assumption that you just use the existing mysqli route but under the hood it's using MySQLND? ...