mysql

SQL REPLACE not working

There are only two columns and I want to UPDATE only if menu_id exists. Otherwise I want to insert a new row. Here's my query: REPLACE `dol_subs_menu_access` SET `menu_id` = '{$aVars['menu_item']}', `mlevels` = '{$sMemLevels}' This creates a new row everytime. Is there something I'm missing? ...

MySql: Simple Problem with Creating Tables & Foreign Keys

Hello people, I have problems with creating tables & foreign key. (errno:150) here is a screenshot Updated Image: http://img264.imagevenue.com/img.php?image=14866_db_122_223lo.jpg Maybe the problem is the database design. -- ----------------------------------------------------- -- Table `mydb`.`projekt_user` -- -----------------------...

How to count aggregates over a date in MySQL

I'm trying to do a cumulative aggregate in MySQL. My raw data looks like this: (my dates are month/day/year) user_id created_at source 1 1/1/01 foo 2 1/1/01 foo 3 1/2/01 bar 4 1/2/01 foo 5 1/3/01 foo .... Given this, I'd like to make a result t...

ASP.NET, PHP, SQL Server, MySQL hosting provider for developer?

I am looking to find a web hosting provider that provides ASP.NET and PHP hosting. The purpose is pretty much just a programming playground for me to develop in and possible show some of my work. As I use ASP.NET and PHP I am looking for a provider that provides hosting for both of these technologies as well as access to MS SQL Server a...

ASP.NET MVC + MySql Membership Provider, user cannot login

Hello, I've been playing around with using MySql as the membership provider for asp.net mvc forms authentication. I've got things configured correctly as far as i can tell, and i can create users via both the register action and asp.net web config site. however, when i try to login with one of the users, it does not work. it returns an ...

How do I run PHP in a local browser using Ubuntu

I'm getting this error when I attempt to run phpMyAdmin from XAMPP. There was an existing mysql installation on this machine previous to my installation and running of XAMPP. When I start XAMPP both mysql and apache2 start up successfully. I can access the mysql database with a PHP script but not through phpmyadmin. Error MySQL said: D...

How to store date with HH,MM, AM/PM to MySQL

I was playing around with this http://www.phpform.org/ to create a form. One of form html is the following. I am not sure what kind of type I should use it for HH, MM and AM/PM. Should I use TINYINT with 2 length for HH, MM and VARCHAR with 2 length for AM/PM? Should I have separate field for each? ... ... <li id="li_1" > <l...

MySQL Online Backup Method

I was looking around for the best method to do an online backup of MySQL stored data. I was no completely satisfied with the previous answers. Im not asking for a specific method for now, I asking which "road" do you consider best. Preferably it should be free and as easy as possible. Thank you very much. Ps: I hope this qualifies a...

Insert Mysql with PHP - problem with foreign key insert

Hi, I have 4 Tables [project_select] UserID (fk) | project_id (fk) | project_category_id (fk) [project_category] project_category_id | category [projects] project_id | projectname [project_user] UserID | Name How can I insert Data with php in the tables project_category, projects and project_user, to get automatically the values in...

Moving data between identical database schema's in MySQL

I have 2 databases with identical schemas. One is a master database serving production/marketing purposes (probably 95% SELECTs) and the other is a "slave" and runs SELECTs/INSERTs for orders, customers, etc for a specific micro-site. The reason for the separation is not all micro-sites will run the same products/specials/coupons etc an...

Mysql keywords with rails.

My one column name is "usage" and it's conflicting with mysql keywords. To solve out that issue i was passing usage like `usage` with ActiveRecord. That solved my problem. CsvHeader.find(:all,:conditions => ["`usage` = ?",usage])) Right now i am attaching db2 as my database. db2 is not accepting &&. so i have replaced && with and. Ano...

MySQL: Rewriting this subquery?

I am trying to build a new table such that the values in the existing table are NOT contained (but obviously the following checks for contained) in another table. Following is my table structure: mysql> explain t1; +-----------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default...

PHP - Friend List

Hey, How would I create a Friend List e.g. User can add friends into their list. Here is how it goes: Log's in $qry="SELECT * FROM users WHERE username ='$login' AND password='$thepass'"; Add Friends, Remove friends How would I do that in PHP? ...

When is it necessary to escape double quotes and other characters when inserting them into MySQL database?

When is it necessary to escape double quotes and/or special characters when inserting into a text field in MySQL? Assuming you have a text field that holds descriptions or articles that have double quotes and/or ampersands, is it necessary to escape them before writing them to the database table? ...

Apache Crashing On adding extension=php_mysqli.dll to php.ini

Hi! So I've been installing on my own computer Apache and PHP, and this went well. The versions are: php-5.2.14-win32-installer httpd-2.2.16-win32-x86-no_ssl And I've been trying to install Mysql support with no luck. I tried a few changes to the php.ini file, and understood that as soon as i enter extension=php_mysqli.dll And restar...

SQL statement to get all customers with no orders

I have a typical Persons table and an Orders table defined in such a way that I can do JOIN query as the following to return Orders for all Persons. SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo FROM Persons INNER JOIN Orders ON Persons.id=Orders.Person_id The question is, how do I write a statement that would return all ...

mySQL Insert only when field is different.

I am using the following sql statement: $sql = "INSERT INTO counter (uid, placeid, lastdate) VALUES ('" . $uid . "', '" . $place->place->id . "', '" . $added . "') ON duplicate KEY UPDATE count = count + 1`"; This keep tracks of how many times people check in. I do not want multiple check ins a day, so when if someone checks in twic...

.net mySQL Connector for a 64 bit machine

My local computer is 64 bit but the downloads for the .Net mySql connector found here: http://dev.mysql.com/downloads/connector/net/ are 32 bit. I installed the 32 bit file however, whenever I try to input any new connector information after the 1st keystroke the box disappears. So I'm assuming that it has more to do with my machine be...

Does adding a unique constraint slow down things?

I have three columns in my table. +-----------+-----------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-----------------------+------+-----+---------+-------+ | hash | mediumint(8) unsigned | NO | PRI | 0 | | | nums | int(10) unsi...

sql - insert into multiple tables in one query

assuming that i have two tables, names and phones and i want to insert data from some input to the tables, in one query- How can it be done? Please, if it can be done, explain the syntax. ...