mysql

What's the difference between utf8_general_ci and utf8_unicode_ci

Between utf8_general_ci and utf8_unicode_ci, are there any differences in terms of performance? ...

MySQL error 2013

Hi to all, In MySQL, how can I solve the error below? 2013: Lost connection to MySQL server at 'reading authorization packet', system error: 0 Regards, Babu. ...

PHP/MYSQL - Pushing it to the limit?

I've been coding php for a while now and have a pretty firm grip on it, MySQL, well, lets just say I can make it work. I'd like to make a stats script to track the stats of other websites similar to the obvious statcounter, google analytics, mint, etc. I, of course, would like to code this properly and I don't see MySQL liking 20,000,0...

MySQL - Duplicate table

I need to duplicate a table in MySQL, making the new table empty. That is, I need to copy only the structure of an existing table to a new one. ...

How can I properly use a PDO object for a Select query

I've tried following the PHP.net instructions for doing Select queries but I am not sure the best way to go about doing this. I would like to use a parameterized Select query, if possible, to return the ID in a table where the name field matches the parameter. This should return one ID because it will be unique. I would then like to us...

Simple MySQL database question

Hi, I'm very new to databases and I have a quick question. How would I design my MySQL database if I have these fields: ID, lat, long, date - multiple dates, time - multiple times I know I should put it into two tables, right? And how would those two tables look? Thanks! ...

Use current auto_increment value as basis for another field in the same INSERT query - is this possible in MySQL?

In my table (MySQL) I have these fields: id - primary, auto_increment hash - base 36 representation of id I'd like to populate both fields at once, using a stored procedure to compute the base 36 equivalent of the value id receives on INSERT. Something like this: INSERT into `urls` (`id`,`hash`) VALUES (NULL,base36(`id`)); Obviou...

mysqldump passthru returncode's

Hello, I am trying to do a mysql dump via php. This is the code $backupFile = $table. "-". date("Y-m-d-H:i:s") . '.gz'; //Command nog aanpassen.... $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; //$status = system($command); echo $backupFile ."<br>"; $status = passthru...

modifying multiple tables in one query with aprepared statement

I have the following prepared query I am using with mysql and php. It is to allow users to be added to a particular category, passed in via $subcat. $alterQuery = "UPDATE AUCTIONS SET subcat= ? WHERE article_no= ?"; if ($altRecord = $con->prepare($alterQuery)) { $altRecord->bind_param("ss", $subcat, $pk); $altRecord->e...

returning query where field is null

I am trying to use the following query with my table: SELECT ARTICLE_NO, USERNAME, ACCESSSTARTS, ARTICLE_NAME, date_format(str_to_date(ACCESSSTARTS, '%d.%m.%Y %k:%i:%s'), '%d %m %Y' ) AS shortDate FROM AUCTIONS WHERE upper(ARTICLE_NAME) LIKE '%hardy%' and subcat = 'null' ORDER BY str_to_date(ACCESSSTARTS, '%d.%m.%Y %k:%i:%s'), article_n...

multiple where clause in query failing

I am trying to select the following query from my table: SELECT ARTICLE_NO, USERNAME, ACCESSSTARTS, ARTICLE_NAME, date_format(str_to_date(ACCESSSTARTS, '%d.%m.%Y %k:%i:%s'), '%d %m %Y' ) AS shortDate FROM AUCTIONS WHERE SUBCAT = 'fake' and USERNAME = 'testuser' ORDER BY str_to_date(ACCESSSTARTS, '%d.%m.%Y %k:%i:%s'), article_no limit...

Check for a null value from a database -- failing

I am retrieving 3 fields from a database, and by default, only the username field will have content. The other information will be added in from a user application. I want to show the field as "No Info" if there is no entry in the field. I am trying to use both empty() and is_null() to no avail. A var_dump of $row['firstname'] and $row['...

dynamically naming a variable?

I have a table with various auctions, where each record has both a username and a category. More than likely, there will be multiple records with the same username and category. There are four different types of categories. I am wondering if it would be possible, given the prepared query below, to have the second bound parameter be the ...

What does ER_WARN_FIELD_RESOLVED mean?

When SHOW WARNINGS after a EXPLAIN EXTENDED shows a Note 1276 Field or reference 'test.foo.bar' of SELECT #2 was resolved in SELECT #1 what exactly does that mean and what impact does it have? In my case it prevents mysql from using what seems to be a perfectly good index. But it's not about fixing that specific query (as it is an irr...

MySQL architecture question regarding null columns vs. joins

Hello, I have an application where I'll have repeating events. So an event can repeat by day, "every n days", by week, "every n weeks on Mon/Tue/Wed/etc", and by month, "every n months on the 1st,2nd,3rd,etc". What is the best way to handle this from a table design perspective? I can think of two ways but I'm not sure which one is bett...

How to move a MySQL database to an external hard disk?

I am running OS X 10.5 and I do not know much about MySQL configuration. I am using a local MySQL database to deposit data from an application but it is getting close to my hard disk's capacity. What do I need to do to get the database stored on my external hard disk? Where can I get documentation to learn how to do this? ...

PHP/MySQLi: SET lc_time_names and DATE_FORMAT() into a mysqli query??

Hi, I use the next code to retrieve data from a table in the database: $check_sql = 'SELECT personID, name, DATE_FORMAT(persons.birthdate, "%d de %M, %Y"), birthplace, countryID FROM persons WHERE personID = ?'; if ($stmt->prepare($check_sql)) { $stmt->bind_param('i', $pid); $stmt->bind_result($personDB, $name, $birthdate, $birthpl...

PHP Unique Text Field?

I've got a table and I have a text field with a URL again, I don't want any rows with duplicate URL's but I'd rather not do a check before inserting, is there no way to make a text field unique or could you suggest another field type to use? ...

Syncronize data between alike tables in mdb file and MySQL server schema

I am looking for a way to manage syncronization between an Access mdb file for an application, and a MySQL schema containing a copy of the same tables. This arose from the fact that the application doesn't support MySQL as a backend, but I am looking for a way to utilize MySQL for other in-office applications using the data the first ap...

MySQL AVG() value not resetting on every row.

Hello, I have this very weird results when trying to fetch the AVG() field from my "reponse" field. Query : SELECT AVG(Reponse.note) as noteMoyenne, Categorie.titre, Autorisation.typeEvaluateur, COUNT(DISTINCT Autorisation.id) as nbEvaluateur FROM reponses as Reponse, categories as Categorie, questions as Question, auto...