mysql

I'm confused about searching between dates in mysql

Here, I changed one of my table's column type to standard mysql date format. <form action="'.$self.'?action=search" method="post"> <ul> <li>Oda No:</li> <li><input type="text" name="ro"/></li> <li>Check in:</li> <li><input type="text" name="cn"/></li> <li>Check out...

any third party free Java library that can calculate grades based upon marks of student ?

Hi i am making a school information software. Is there any third party reliable library that can be used for calculating grades of students referring marks for the same from specified database.It should be flexible enough to let client specify criteria for grade calculation in terms of standard deviation, median etc. ...

error occurred during data insert in mysql

my code - require 'database.php'; $uid = $_SESSION['UserId']; $title = $_POST['imgtitle']; $tag = $_POST['imgtag']; $date = date("d-m-y"); $q = "INSERT into album (`o_id`, `title`, `src`, `tag`, `date`) VALUES('$uid', '$title', '$image_name', '$tag', '$date'"; $result = $mysqli->query($q) or die(mysqli_error($mysqli)); if ($result)...

Need help with MySQL query & PHP

I have the following 3 tables: (PK = Primary Key, FK = Foreign Key) Files Table File ID (PK) File Name ... ------------ --------- 1 a.jpg ... 2 b.png ... 3 c.jpg ... . . . . . . Tags Table Tag ID (PK) Ta...

Mysql Query group by

Hi, I am trying to make a query to get some results: I have a table with sote data: client | price 1 | 100 1 | 150 1 | 200 2 | 90 2 | 130 2 | 200 3 | 95 3 | 120 3 | 250 I would like with one query to select the results and order it by price and client and get them in this form, ordered by the best price of each clint: 2 | 9...

DATE_FORMAT() in MySQL query

I'm trying to change this timestamp 2010-08-02 00:28:20 to month/day/year - 08/02/10 ..in the query (I know that doing it in the query is faster). $sql = "SELECT * FROM posts ORDER BY post_date DESC"; I tried using the DATE_FORMAT() in the query many ways but I can't seem to get it right.. Can someone please share how to ...

Not able to delete the database(mySQL) record in PHP, where did i go wrong?

Hi, I am trying to delete the records from the users table in mysql, the code goes like this. if(isset($_GET['id'])) { //create query to delete the record $query = "DELETE FROM users WHERE id =" . int($_GET['id']) or die(mysql_error()); //execute query if($mysqli->query($query)) { //print number of affected ro...

Why in cpanel databse size is showing 0.00MB?

Why in cpanel database size is showing 0.00MB while when i take backup of database then it is 1.2 MB? ...

Hibernate JPA, MySQL and TinyInt(1) for Boolean instead of bit or char

Hi Here is my JPA2 / Hibernate definition: Code: @Column(nullable = false) private boolean enabled; In MySql this column is resolved to a bit(1) datatype - which does not work for me. For legacy issues I need to map the boolean to a tinyint not to a bit. But I do not see a possibility to change the default datatype. Is there any? ...

Foreign key to one of many tables?

The usual way of setting a foreign key constraint is to choose which table the foreign key will point to. I'm having a polymorphic relation between 1 table and a set of table. That means that this table will have a relation with one of those tables in the set. eg. images: person_id, person_type subordinates: id, col1, col2...col9 pro...

Preventing SQL injections with PHP and Zend Framework - how?

I'm trying to defend the sign-in form on my page from SQL injections. On the serverside, I use Zend Framework (Zend_Db,Zend_Db_Table_Abstract), but its build-in injection prevention functions: quote, quoteInto, quoteIdentifier don't make their work well (as far as I know how to use them). Other ways like mysql_real_escape_string, addslas...

suPHP / PHP scrip timeout

After my host enabled suPHP, a previously working script has been timing out after ~3min (it varies, but the script has not run for more then 3, AFAIK). The odd part is, the script is not throwing any errors that I can see (and yes, full PHP error reporting/logging is enabled and all MYSQL queries have been checked for errors, also) it s...

Match against with multi values - the right way?

Hello guys, i really hope that someone can help me with my problem. I would like to realize a match against query with multiple searchstrings. In the moment it looks like this: SELECT result.* FROM ( SELECT A.TITLE AS title MATCH(A.TITLE) AGAINST('$searchstring1' IN BOOLEAN MODE) AS REL, MATCH(A.TITLE) AGAI...

MYSQL select count of rows that fall in a month for every month of the year.

With the table: id date_from date_to --------------------------- 1 2010-01-01 2010-03-01 2 2010-02-07 2010-05-01 3 2010-07-05 2010-07-10 I am trying to return a result which has one row for each month of the year that lets me know how many rows were active in that period. So for the above I would want the result ...

Remove duplicates using only a MySQL query?

I have a table with the following columns: URL_ID URL_ADDR URL_Time I want to remove duplicates on the URL_ADDR column using a MySQL query. Is it possible to do such a thing without using any programming? ...

'+' character not saving through CKEditor/PHP/MySQL/HTMLPurifier

Hi there, I am trying to get UTF-8 encoding working with CKEditor/PHP/MySQL/HTMLPurifier. I have converted the character sets of the database tables/fields to utf8-unicode-ci. I have set the following in the ckeditor config: config.entities = true; config.entities_latin = true; config.entities_greek = true; config.entitles_processNum...

MySQL - How can I update a table with values from another table?

Hello, i'have the task to repair some invalid data in a mysql-database. In one table there are people with a missing date, which should be filled from a second table, if there is a corresponding entry. TablePeople: ID, MissingDate, ... TableEvent: ID, people_id, replacementDate, ... Update TablePeople set missingdate = (select re...

Delete sql rows where IDs do not have a match in another table

Hi, please can I have some help on this. I'm trying to delete orphan entries in a table. I have 2 tables like this: table files: | id | .... ------------ | 1 | .... | 2 | .... | 7 | .... | 9 | .... table blob: | fileid | .... ------------ | 1 | .... | 2 | .... | 3 | .... | 4 | .... | 4 | .... | 4 | .... | 9 | .... The ...

How do you get a NOW() value in C# using the MySQL Connector?

Hello, Is it possible in an easy way to get the NOW() timestamp from an UPDATE query? I'm trying to save the "lastupdated" value in the local cache, or is there in any way possible to get the exact MySQL server time which the update query was executed? Best Regards; Görgen ...

Using MySQL to search through large data sets?

Now I'm a really advanced PHP developer and heavily knowledged on small-scale MySQL sets, however I'm now building a large infrastructure for a startup I've recently joined and their servers push around 1 million rows of data every day using their massive server power and previous architecture. I need to know what is the best way to sea...