mysql

there is something wrong with this Jquery post?

im trying to pass on the id attribute to the file.php, but its giving me 0 every time, when i try to insert it into the database, the javascript and the html is provided! $(function() { $(".follow").click(function(){ var element = $(this); var I = element.attr("id"); var info = 'id=' + I; $.ajax({ ...

MySQL: Fetching rows added last hour

Hi, I keep a record of logins in a table. I have columns for id, ip, date and time. From that record of logins I wanna fetch logins made only in the last hour. I'm sweaping through the MySQL docs on time and date functions, but I just can't seem to combine them correctly. Can somebody help me? ...

How do I show next result in MySQL on "onclick" in JavaScript?

I want to show a certain amount of results (say, 5) and make a: <a href="" onclick="<?php ShowNextResult(); ?>"> And use onlick to show the next 5 results. ...

What would be the relational way to store a tournament bracket in MySQL?

Right now I have a table for matches where each match has a reference to 2 competing participants and a winner, but there isn't a way to store the order of the rounds. ...

Character encoding issues and PHP - what encoding is this?

I have a file on my computer that I wanted to copy into a MySQL table using PHP. When I open the file the contents look fine, like normal text - but, when I attempt to read the file using PHP or insert into a MySQL table, I get all sorts of funky characters. I thought perhaps it was a utf-8 issue, so I tried setting the header header('C...

How do I keep mysql tables from wrapping in Windows cmd using DESCRIBE?

So given: CREATE TABLE stuff ( really_long_title int(10) NO NULL auto_increment, really_long_title_number_1 varchar(10) NO NULL auto_increment, PRIMARY KEY (blah) ); DESCRIBE table; I would like to be shown my table with two rows (blah and blah1) and attributes for each. Instead I'm shown the two rows of my table but in t...

How do I find if my a table is MyISAM or Innodb

Possible Duplicate: How can I check MySQL engine type for a specific table? Assuming that users is a table following command does not reveal if users table is MyISAM or Innodb. desc users; How do I find what is the type of users table? ...

How do I compare the results of two queries, and find matches between the two?

EDIT: Changed the question to be more clear. EDIT 2: The intention here to create an "add to list" and "remove from list" when outputting a catalog (I don't want a user to be able to add an item more than once) First of all, I'm not sure if this should be done in Coldfusion or MySQL. I have a query of items that retrieves items in a ...

XML vs MySQL for Large Sites

For a very large site such as a Social Network (say Facebook), which method would you recommend for user accounts storage? 1) Single XML files for each type of features, on the user's directory: basicinfo.xml, comments.xml, photos.xml, ... 2) MySQL, although not sure how to organize on this. Maybe separated databases for each feature? ...

How to implement Foursquare's "Mayor" feature - find the user with the highest score in the last N days?

In Foursquare, the user who has the highest score for a place in the last N days is awarded the Mayorship of that place. What is the most efficient way to implement that? A user could have checked into hundreds of places. To display all the mayorships that belong to a user, it'd be necessary to go through all those hundreds of places ...

How do I define table relationships in phpmyadmin 3.3.7?

I don't see the "relations view" that used to exist. Any suggestions? I'd rather not have to drop all of my tables in order to do this. ...

[PHP] reading utf-8 content from mysql table

Hi I have a mysql table with contents the structure is here: Now I have one record in it: I want to read and print the content of this table to html This is my code: <?php include("config.php"); $global_dbh = mysql_connect($hostname, $username, $password) or die("Could not connect to database"); mysql_select_db...

Is there a faster way to perform this mysql query?

Is there a faster way to perform this most simple query in terms of server load? I don't think I've ever tried anything other than this method: $sql = 'SELECT thing FROM table WHERE id="' . $id . '" '; $res = mysql_query($sql); $row = mysql_fetch_array($res); $thing = $row[0]; Any way to improve this? ...

Sorting by (order_by) foreign table value with Kohana ORM.

Is there any way to sort in orm by using a value from a forgin table? Can you do something like orm::factory("table")->order_by("table.foregin_table.column" , "ASC") or do you have to use some regular mysql and join the tables together old school? ...

Django models.py Circular Foreign Key

I have a django app which basically is just a photo album. Right now I have two models: Image and Album. Among other things, each Album has a foreign key to an Image to be its thumbnail and each Image has a foreign key to the Album it belongs in. However, when I try to use manage.py syncdb or manage.py sqlall I get errors saying the clas...

mysql CREATE VIEW not working from mysql_query

I have a code to create VIEW in mysql database which is working fine on my local server. It creates and crop view normally. But on my Online server it gives error "CREATE VIEW command denied to user" for online database I manually create VIEW in Database form PHPmyAdmin [Myadmin is in localhost online] it creating, SO i have permissio...

How to Nested Case in Select SQL?

I have this select Case SQL statement which compute the totalvolume of a given quantity. SELECT DropshipPackinglist.CaseNumber as 'CASE NO.', DropshipPackinglist.ItemNumber as 'BOM NO.', DropshipPackinglist.Quantity as 'QTY', CASE WHEN DropshipPackinglist.Quantity >=31 and DropshipPackin...

Calculate percentage of used fields(columns) in MySQL

Hi there, I would like to know if there is any query to calculate the count of used fields(columns) in a table for every row(record). I want to update my table new field called percentage usage by calculating (total number of used columns) / (total number columns) * 100 for all records. Any suggestion is appreciated. Thanks For ...

hibernate many-to-many association and spring hibernatetemplate doesn't work

I am using Spring HibernateTemplate, OpenSessionInViewFilter(actually I extended this class and created my own to switch to FLUSH.AUTO Mode) and Mysql for implementing hibernate many-to-many association. However when I save an object, corresponding many-to-many table's values are not inserted. Does anybody can help me? Thank you. here i...

PHP: Efficient way to store simple cache array in database?

Basically for a plugin for a dynamic site (site can be fairly large) I am caching results of some sort of search (because results are from an external search), the results can be 400-1500 characters in length. As the results come in an array, I use json_encode (faster than serialize) to store in the database, but ~1.5KB per entry (since...