mysql

PHP - Parsing an uft-8 file and inserting it to database gives messes up the special chars like é

On a webserver, I have a php script that parses a .sql file (which is stored directly on the server), and executes the queries on a mysql database. I have a lot of french characters that doesn't insert well: é becomes é. When I open the sql file with notepad++, I see that the encoding is "uft-8 without BOM". My script looks like thi...

SQL Concat Query

I have two tables like this: TABLE user( id CHAR(100) text TEXT ) TABLE post( postid CHAR(100) postedby CHAR(100) text TEXT FOREIGN KEY (postedby) references user ); I need a query that for each user concatenates the TEXT column of all posts of that user and put them in the text column of the user. the order is not ...

Salting my hashes with PHP and MySQL

Like most users, I'm simply trying to figure out a secure way to store passwords. What I haven't found here (or maybe it's my lack of understanding) is how to retrieve a salted hash in my database and separate the salt from the hashed password, especially with unique salts to each password while maintaining the salt+password in a single ...

PHP + MySQL encoding issues for Portuguese (PT-Br)

I'm developing a website in Brazilian Portuguese and I'm facing some really annoying encoding problems. Words that should be written this way: óbito are being written this way: �bito I have noticed that while the texts are still at the database they are ok. But when I use echo with PHP, the encoding problem comes up. List of things I ...

generate unique array values

hi all. I have a such problem which I couldn't solve in a good manner. My solution needs too much time and loop uses catastrophically big memory. So I need a help. I have 3 mysql tables. Gorups group_id group_name games game_id game_name questions question_id game_id question_name question_text question_groups question_i...

Cakephp, retrieve only certain number of rows from database?

I don't know if I'm missing something, or what, but I've been looking over the cakephp cookbook a lot lately and I don't think I have figured a way from it to get "x" number of rows (say 100) based on criteria.. right now I'm just using the find method to get all rows and then using my php controller to make use of only the ones I need, ...

Help with a possible performance problem (in a php pagination)

Hello I have a search engine, but in the pagination I have to redefine the searchterm in the url, I mean <a href='http://mysite.com/search.php?q=searchTerm&amp;currentPage=2'&gt;Next&lt;/a&gt;. Please tell me if I'm doing it well or there is another way to do it ...

How to convert default mysql modtimes into UTC date time using xslt

I need to convert default mysql modtimes into UTC formated datetimes using xslt. I have an xml document that contains dates that originated as mysql modtimes in the format: 2010-06-30 15:20:43.0 They are now in an xml document within an element "datestamp" 2010-03-16 13:52:56.0 In order to be published via an oai-pmh feed they need to...

How to store multiple sets of values in a database?

Right now I'm creating a web-app which requires that multiple sets of data (including a URL, title, and date) be stored in a DB. So for example, User1 may be storing Item 1 which consists of Example, http://example.com, and YY-MM-DD HH:MM:SS. And he may have multiple items with the same types of data. Before, I was sotring all the item...

Short URL Outbound Link Tracking in PHP and MySQL

I have a site that shortens links based on Noah Hendrix's tutorial on the subject. I decided that it would be great if I could track when users click the short URLs, similar to the way that HootSuite users can track their links with Ow.ly. I currently have a database which has the short URL stored along with the true URL and it's click...

Migrating data between two MySQL with different character_set%, messed up with utf8

Migrating Data from MySQL server1 to MySQL server2 server1 Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (x86_64) using readline 5.2 mysql> SHOW VARIABLES LIKE 'character_set%'; +--------------------------+------------------------------------------+ | Variable_name | Value | +------------...

Displaying multiple values from same name MySQL database field in Codeigniter & Dwoo

I am building a web application and have opted to use similar table and field names to Wordpress in my application. By that I mean I have a users table and a usermeta table similar to how Wordpress works. Forgive me for making this question so big, I opted to be as descriptive as possible in this question. The usermeta table has the fo...

How do I do this with Django objects.filter?

MYTable.objects.filter( where id = 42, 55, 65, and 55) and it returns a query set ? ...

How to add index to 18 GB innodb mysql table without affecting production performance?

How can I add index to an 18 GB innodb mysql table without affecting the production performance? The table is frequently accessed, I tried altering the table just now and it turns up to have locked more than 200 queries out, and that's bad for performance. Are there any other ways to do it? ...

Optimize LEFT JOIN on table with 30 000+ rows

I have a website where visitors can leave comments. I want to add the ability to answer comments (i.e. nested comments). At first this query was fast but after I populated the table with the existing comments (about 30000) a simple query like: SELECT c.id, c2.id FROM (SELECT id FROM swb_comments WHERE pageId = 1411 ...

MySQL Stored Procedure - How to process resultset in SP Help

How To process a result in a stored procedure Suppose i have sql = "SELECT fname, lname FROM students WHERE name ='Sam' "; How will i fetch this result in variable and loop in a SP like we do in PHP as: $sql = "SELECT fname, lname FROM students WHERE name ='Sam' "; $qSql = mysql_query($sql); if ($qSql ) { $fArr = mysql_fetch_array(...

CakePHP, injects "LEFT JOIN" (mentioning fields in an associated model) into my update attempts

This is driving me crazy, I am trying to do something like: $this->data = $this->Prox->read('proxy',$currentgetdata); $this->data['Prox']['checked'] = 2; $this->Prox->save(); where I have a model association of: class Prox extends AppModel { var $name = 'Prox'; var $primaryKey = 'id'; ...

Unix time in SQL

Is it possible to get the current UNIX timestamp with sql? ...

Java + Mysql UTF8 Problem

Hi, as the title said, I have a problem between java and mysql The mysql DB, tables, and columns are utf8_unicode_ci. I have an application that took some input from an xml, then compose the query... public String [] saveField(String xmltag, String lang){ NodeList nodo = this.doc.getElementsByTagName(xmltag); String [] pos = ...

Trade off between reading from database and memory storage of Java strings using servlets

Hello I'm in the process of setting up a system which will have to repeatedly parse large amounts of text (as a String or StringBuffer - which might be better?) acquired from the a data source. The text will be displayed and may consist of several thousand words and each time the text is parsed, each word may have to checked against a l...