mysql

Customer attribute on email order confirmation?

I have created a custom attribute called "leave_out" that I have added to the customer register form and it works fine - saves to db and I can retrieve through the customer info tab in the admin. I want to include the value of this attribute on the order confirmation email though - how? ...

Magento Checkbox for bundle products needs qty

With a bundled product in magento you can select various types of options - drop down for example adds a Qty box so you may choose the quantity of items from the drop down. I am using Checkboxes instead as i need many choices and need a Qty box associated - how is this possible? I've spent hours trying to code this. ...

issue with preorder tree traversal algorithm in php

I had been working on "Preorder tree traversal algorithm" as a part of my daily task.. what I came across was that for MySQL, we need to lock a table and after insertion or deletion of any entry, we need to unlock the particular table (I succeeded in my task though).... I juz wonder why we do this??? apart from this case, where else do ...

MYSQL moving information with php

I am wondering if it is possible to automate or by button press to move mysql table information from one table to another table deleting it from the first table and putting it in another table? Using php. My mysql table is big and the page that adds the information to that table has 70 query's on it which slows the page refresh times. ...

Quotes, PHP, MySQL

I feel daft asking this, but it's driving me potty. How can I make this string: Children\''s Toy Suitable for insert to a MySQL database and escape the characters properly? Thanks ...

mysqli link is dropping

I have a function that takes 2 variables, one for the database connection and the other for a query. For some reason, the mysqli link isn't happy unless it is inside the function; It isn't enough to just pass the link. Has anyone else had this happen and what can I do to avoid instantiating the db object inside the function. This does ...

InnoDB row level locking performance - how many rows?

I just read a lot of stuff about MyISAM and InnoDB as I have to decide which type to use. There was always mentioned 'row level locking'-support for InnoDB. Of course this only makes sense at a certain amount of rows. How many would that (circa) be? EDIT: Apparently I mis-worded my question. I know what table locking and row locking m...

What's wrong with this PHP-MySQL CREATE TABLE query?

First, I'm just starting to learn MySQL with PHP. My query copy/paste directly from my IDE: $query = "CREATE TABLE IF NOT EXISTS $table_messages ( id int(11) unsigned NOT NULL auto_increment, show tinyint(1) unsigned NOT NULL default '0', to varchar(255) ...

How to insert ' in DB using Hibernate.

Hi all, I'm using hibernate for all DB operations. My problem is that, I want to insert an string in table which contains ' e.g. rea9'ea/rea9'ea. While inserting it I'm getting the following exception Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that c...

MySQL - Ideal Field Type For Fixed Width Binary Data

If I want to store binary data (hash values) and they're always 128bytes long, what field type should I use? BLOBs are nice, but they aren't fixed width (and result in dynamic tables).. CHAR requires a charset. ...

Caching row ranks in MySQL?

I have a column I want to sort by, with periodical updates on the rank (daily). I currently use this in code get all rows from table order by column rank = 1 foreach row in table update row's rank to rank rank++ this takes an update for each row in MySQL. Are there more efficient ways to do this? ...

Installing PostGresQL & MySQL in Mac OS X running MAMP?

Well, I have MAMP installed on my Mac OS X, and I've got PostGres up and running, but am wondering how I can use it with PHP? I'm assuming that there's something I need to do where I compile PHP so that it can use both, but, I'm not sure how to do that if PHP has already been installed? Or, if there's something unique I need to do to g...

How many MySQL rows are too many?

I'm working on a website that utilizes essentially a database with a table of organizations, one row for each organization. Each organization can have an unlimited number of attached keywords. The keywords are represented in a separate table from the organizations where each row is simply the primary key, the keyword, and the primary k...

Mysql join query

SELECT description FROM diagnosis_mapping LEFT JOIN diagnosis_codes ON diagnosis_codes.codeid = diagnosis_mapping.codeid SELECT description FROM diagnosis_mapping LEFT JOIN diagnosis_codes ON diagnosis_codes.codeid = diagnosis_mapping.secondarycodeid How to merge these 2 queries and get info in a s...

Is performing a count() calculation slowing down my mysql query?

I'm still learning about MySQL. I may be making a very basic error, and I'm prepared to be chastened here... What this query is trying to do is select the top members from our website based on a count of the number of book and recipe reviews they have made. I'm making a calculation of the total in the SQL query itself. The query is s...

Inserting Related MySQL Data with AUTO_INCREMENT

I'm looking at a database that has 3 tables into which I have to insert data: resource id (AUTO_INCREMENT) name resource_item id (AUTO_INCREMENT) name resource_id (FK ref resource.id) resource_item_business_function id (AUTO_INCREMENT) business_function_name resource_item_id What I'm struggling with is the fact that ...

MySQL comments causing messed up bind parameter count with Perl DBI

I've got the following Perl code which makes a DBI call: my $artsql = q{ *** SNIP A BUNCH OF SQL *** where a.article_id != ? and at.type_name != 'List Element' -- don't get list children and aw.flowstate = 'Published' and a.visible_as_article = 1 } ...

Prevent user from creating tables and or databases with hyphens

Is there way in MySQL to prevent someone from creating tables and/or databases with hyphens? (Other than striping privileges from the user.) For example, if we have user IamADummy who wants to do this, CREATE TABLE `I-am-a-bad-table-name`; OR CREATE DATABASE `Bad-Idea`; Is there a setting that would stop the user from doing so?...

password limitations in SQL Server and MySql

Does MySql 5.1 and SQL Server 2008 (Web edition, Standard) have any functional password limitations other than length limits? Are metacharacters in any form a bad idea to use, like bang, pipe, hash, any slash, carrot, and so on? I know that MySql 5.1 has a password length limitation of 16 characters that is hardcoded, but I was wonderin...

Which MySQL data types should I not be quoting during an INSERT?

As a beginner with MySQL, I want to get this right. My main hangup right now is the DECIMAL type. From the docs: As of MySQL 5.0.3, values for DECIMAL columns are represented using a binary format that packs nine decimal (base 10) digits into four bytes. Before MySQL 5.0.3, DECIMAL columns are represented as strings and st...