mysql

mysql check collation of a table

Simple question, how can I see what collation a table has? I.E. I want to see: +-----------------------------+ | table | collation | |-----------------------------| | t_name | latin_general_ci | +-----------------------------+ Thanks for your help. ...

WordPress installation duplicating

I have a domain: example.com. There are various WP installations for different languages in subdirectories, e.g. /en/, /fr/, /es/. I have used the English language (/en/) folder and the _EN database as templates for the new foreign language installations and their databases. I changed the usual suspects in the new databases. This meth...

How can I retrieve records from one table and related records from another table in one query?

I have two tables, items and itemmeta. items has item_id which links it to itemmeta which has itemmeta_id, item_id, meta_key and meta_value. I did this so if i needed to add a special flag or value to an item i didn't have to keep changing the items table. Now i am paying the price for flexibility. I want to know if i can combine a quer...

Select N records for each category and order by X

I have a database table that contains blog posts. I want to show on the homepage one (or more) post for each category, ordering by date, for example. So my posts table looks like this: id | title | description | cat | filename | date How would I create such a query? I've thought to use group-by or a subselect but I'm not sure if it's ...

simplifying a MySQL query, pulling table name dynamically from table data

Hello I have a mysql table and one of the fields is 'template'. This field will point to the correct template table to reference the unique fields for that particular template. So for example if table.template = 'news', I also need to pull the info from the news_template table to have the complete set of listing info. Right now I only...

Intermittent problem with UTF-8 characters

I am running a fairly standard LAMP stack. The problem is an intermittent rendering of UTF-8 characters correctly. About 50% of the time the non-ASCII UTF-8 characters render correctly (e.g. with appropriate diacritical marks), but about 50% of the time I get the '?' rendition instead. If I reload the page, sometimes it corrects the pro...

I keep getting this - Unknown column 'rec_label' in 'field list'

here is my code <? if ((!$_POST['id']) || (!$_POST['format']) || (!$_POST['title'])) { header ("Location: /show_addrecord.html"); exit; } $db_name = "testdb2"; $table_name = "my_music"; $connection = @mysql_connect ("localhost", "spike", "9sj7En4") or die (mysql_error()); $db = @mysql_select_db ($db_name, $connection) or die(mysql_error...

Webapp using ASP/NET and MySQL

Hello all, in these days I'm going to evaluate pros and cons in choosing the software requirements of a web application wich will be potentially scale very faster (imagine a farm of 100 servers). As you can imagine, a drive aspect of my choice is about the costs. Here my own consideration: [+] ASP.NET is a very robust, efficient and we...

User content table formatting?

I understand the part of inserting data in the database for creating a database driven user content website but how to do formatting? Say i insert the "Privacy policy" Now some text may require to be bold, some may be underline, some may have different size, spacing, etc. So do we have to insert each word 1 by 1 or how to handle this? Us...

Random text from MySQL with button click and no refresh with PHP

Hi, I was wondering if someone could point me in the right direction for this: I have a MySQL database with and id and a text string, i want to be able to display it, and with the click of a button display another random phrase without having to refresh the whole page. I have look quite thoroughly and have no found no answer for this ...

php show slave status

im not to sure why im getting a Warning: mysql_fetch_array(): when running this query $query="SHOW SLAVE STATUS;"; $result = mysql_db_query("aid", $query, $con); ...

Singleton function

Is it possible to create a singleton function inside of mysql? BackStory: Looking to recreate Oracle's "sequence" functionality inside of MySQL for a project so that all numbers returned are contiguous and unrepeated TIA ...

Ajax Array Display Control - Pagination

I have an area which gets populated with about 100 records from a php mysql query. Need to add ajax pagination meaning to load 10 records first, then on user click to let's say "+" character it populates the next 20. So the area instead of displaying all at once will display 20, then on click, then next 20, the next... and so on with n...

Is naming tables september_2010 acceptable and efficient for large data sets dependent on time?

I need to store about 73,200 records per day consisting of 3 points of data: id, date, and integer. Some members of my team suggest creating tables using month's as the table name (september_2010), while others are suggesting having one table with lots of data in it... Any suggestions on how to deal with this amount of data? Thanks. =...

db schema to store and read multiple level access control

Scenario: I have organization, in org I have departmenst, in depts' I have groups, in groups I have users. I have courses. I can give access to any combination of users/groups/departments/organizations. Each level inherit the access it's parent has (so every course which is available to the organization is also available to all of it's ...

MySQL commands (not SQL statements) from PHP

Is it possible to, from within a PHP script, execute the same commands you could with the MySQL client? I know I could theoretically call 'system' to invoke the mysql client installed on the system, but I am not sure how to avoid interactivity (I don't want a REPL/shell, I just want to fire a command). Is there a way to execute command...

What's the best way to build a user to user messaging feature in codeigniter?

e.g. like emailing but in a website.. I've googled and can't seem to find anything. ...

MySQL Text Fields and Memory Usage

I am working on an application that allows users to dynamically add questions to web forms. We use MySQL as the backend, and I am trying to find the fastest, most efficient way of storing the form data. Previously, we stored the data in a separate table for each form section. The columns were named according to a system that allowed u...

Database design for Group Notification System

I am trying to create a group notification system. If I am in a group, then anyone who comment on the group's wall, a notification will send out to every group member. Here is my database design: I have two tables: Notification and NotificationRead. NotificationRead +userId (String) +lastRead (int) - default is 0 Notification ... +time...

Most efficient way to populate array from database values?

If I wanted to get a list of product_ids with a certain brand. I would do this: $id_list = array(); $qry = 'SELECT product_id FROM products WHERE product_brand = :brand'; $STH = $this->pdo->prepare($qry); $STH->execute(array("brand" => $brand)); $STH->setFetchMode(PDO::FETCH_ASSOC); while($row = $STH->fetch()) { $id_list[] = $row['p...