Skip to content

Tag: mysql

How to change sql_mode at runtime

My MySQL server’s sql_mode setting is set to STRICT. I want to change it to TRADITIONAL for a particular application I’m developing. However it’s not possible for me to do this at the server level. …

best practice in mysql?

I need to store historical data for something in mysql (only last 7 days) – should I just make an extra column for each or what is the acceptable way to?

Good Alternative DBAL to Doctrine2 DBAL [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 1 year ago. Improve this quest…

Calculating rank in PHP/MySQL

I’ve got a table in MySQL lets just say for example its got two fields Username, GameName and Score. I want to calculate the rank of a user for an indivudal game name so I could do the query SELECT * …

Paginate WordPress $wpdb Query?

I have this query: I’m using this because WordPress can’t properly order meta_values that uses numbers, anyway…everything works fine except I have no clue on how to paginate this using wp_pagenavi. Any idea? Answer Although I wouldn’t recommend it, you could try changing the properties…

MySQL and PHP – insert NULL rather than empty string

I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)? Answer To pass a NULL to MySQL,…

MySQL: dates before 1970

I’m working on a church site which has many events before 1970, these events starts from 1001 to today, how can I store the dates in MySQL? This works fine only for dates after 1970, how can I store dates before this year? What kind of datatype should I have in MySQL? Now I’ve set my column to dat…

More efficient query in mysql

I want to know how do they do a query with only one textbox in the page, but the current text in the text box can be used as a parameter for the query. I’m currently using the query below but I don’t …