mysql

How can i rollback my last delete command in mysql?

i accidentally deleted some huge rows from a table.. How can i rollback it? I executed the query using the putty ... I'll greatful if any of me guide me safe out this hole.. ...

Mysql Query optimisation

Query 1: SELECT cid, dl FROM chal WHERE cid IN ( SELECT cid FROM c_users WHERE uid = 636587 ); Query 2: SELECT chal.cid AS cid, chal.dl AS dl FROM chal, c_users WHERE uid = 808 AND chal.cid = c_users.cid; cid is primary key in chal cid and uid are...

How Can I Put Meta_Compare in the Database-Query? [Wordpress]

or something like > current date <?php $currentdate = date("Y-m-d G:i:s", $timestamp); $querystr = " SELECT * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta AS term ON( $wpdb->posts.ID = term.post_id AND term.meta_key = 'vst_ort' ) LEFT JOIN $wpdb->postmeta AS course ON( $wpdb->posts.ID = course.post_id AND course.meta_key = 'vst_date' ) ...

imported database dump from latin1 db to utf8 database

I used iconv to convert from latin1 to utf8 when I did an mysql dump of a database from mysql v4.0.21, and imported it onto a new server mysql v5.0.45 It was latin1 on the old server, it’s utf8 on the new server, so I ran this on the mysql dump: iconv −f latin1 −t UTF−8 quickwebcms_2010-03-01.sql It ran successful, then I imported it o...

"Should I use multiple indices in Solr?", and some other quick Q

Imagine a classifieds website, a very simple one where users don't have login details. I have this currently with MySql as a db. The db has several tables, because of the categories, but one main table for the classified itself. Total of 7 tables in my case. I want to use only Solr as a "db" because some people on SO thinks it would be...

MySQL FLOAT & decimals

Datatype of field in the DB is FLOAT and the value is 18.7. I'd like to store and display this on page as 18.70. Whenever I enter the extra 0 it still only stores it as 18.7 How can I store the extra 0 ? I can change the data type of the field. ...

max(length(field)) in mysql

If I say: select max(length(Name)) from my_table I get the result as 18, but I want the concerned data also. So if I say: select max(length(Name)), Name from my_table ...it does not work. There should be a self join I guess which I am unable to figure it out. Can anyone please provide me a clue? Thanks, ...

Why does this query return nothing?

This query works fine but I'm having trouble trying to figure out why it does not return anything if the user does not have any categories in the table "user_categories"? This is the table structure: users: user id, username, user city categories: category id, category name user_categories: user id, category id SELECT users.*, GROUP...

Your PHP MySQL library version differs from your MySQL server version

I've recently upgraded MySQL on my Debian 5.0.4 server to 5.1. Now phpMyAdmin shows the following warning: Your PHP MySQL library version 5.0.51a differs from your MySQL server version 5.1.43 Is it likely to cause any problems? ...

How can i package mysql db into my installer like(install4j)

Hi guys, i am working on developing accounting program and i am using mysql DB, and i use install4j for making windows installer, i can package jre in my installer, but my question is how can i package mysql DB in this installer, thanks. ...

anti spamming in php

hey guys , today i visited my website and i saw someone insert more than 1000 query in my story table my script is in php/mysql and i have captcha enabled and i wonder how he can do such a thing a simple form and in another function , it checks $vars and validate them and then insert in database im sure he is using a bot to do ...

insert value at the begining of an array in php

my array is $hello= array( Code => 'TIR', Description => 'Tires', Price => 100 ) now i want to add a value in array begining of an array not the end of an array.... and results i want is $hello= array( ref=>'World', Code => 'TIR', Description => 'Tires', Price => 100 ) UPDATE actually i need any value that is coming will be added in...

Help find security flaws in this MySQL page?

I am trying to find security flaws in a MySQL page. It is an assignment for a class learning about SQL. Through a textbox, they will be given access to a database to submit queries and see if it returns the correct data sets. I want to find out if there's anything malicious they could do. This is the result of a SHOW GRANTS query: Gran...

MySQL JOIN / GROUP_CONCAT second table?

Hello! So I have this query that works perfectly: SELECT users.*, GROUP_CONCAT(categories.category_name) AS categories FROM users LEFT OUTER JOIN user_categories ON users.user_id = user_categories.user_id LEFT OUTER JOIN categories ON user_categories.category_id = categories.category_id WHERE users.user_city = 'brooklyn' GROUP BY users...

CHECK mysql not working (no error)

CREATE TABLE batsman ( InningId int NOT NULL, PlayerId int NOT NULL, BatsmanOrder int(2) NOT NULL, BatScore int NOT NULL default 0, Balls int NOT NULL default 0, sixes int NOT NULL default 0, fours int NOT NULL default 0, `out` varchar(10) NOT NULL, /*Foreign*/ catcher int, /*Foreign*/ bowler int, /*Foreign*/ Primar...

Database-Independent MAX() Function in SQLAlchemy

I'd like to calculate a MAX() value for a column. What's the proper way to do this in sqlalchemy while preserving database independence? ...

If I'm only planning to use MySQL, and if speed is a priority, is there any convincing reason to use SQLAlchemy?

SQLAlchemy seems really heavyweight if all I use is MySQL. Why are convincing reasons for/against the use of SQLAlchemy in an application that only uses MySQL. ...

Optimizing Multilevel MySQL subqueries (folksonomy and taxonomy)

I was reading the great tagging article by Nitin Borwankar and he started me thinking of the ways to implement differnet levels of searches using two tables. tags { id, tag } post_tags { id user_id post_id tag_id } I started with the simple example of T(U(i)) which means all tags of all users that have an item i. I was ab...

MYSQL: Private messaging system, large single table versus many small tables

I'm considering a design for a private messaging system and I need some input here, basically I have several questions regarding this. I've read most of the related questions and they've given me some thought already. All of the basic messaging systems I've thus far looked into use a single table for all of the users' messages. With ind...

mysql php query HAVING clause

Hi! Im trying to get this query to work but i get this error: Unknown column 'zips.city' in 'having clause' `$query = "SELECT zips.* FROM zips HAVING zips.city LIKE '%$city%' AND zips.stateabbr LIKE '%$state%' LIMIT 1"; $result = mysql_query($query) or die (mysql_error());` my zips table has a...