mysql

MySQL+PHP: Implementing a good Model

In MVC-Model View Controller design you implement the model to work seperately and contain buisness logic, pulling information down from the database. I struggle so much with the design of implementing a good model. I know what information needs to be pulled down from the database, I just don't know the best way to implement it. I think...

MySQL Match Against query does not work with Urlencoded string

This is the table. CREATE TABLE `posts` ( `post_id` int(20) NOT NULL AUTO_INCREMENT, `post_archived` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'N', `post_updatedts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `post_author` int(20) NOT NULL DEFAULT '0', `post_date` timestamp NOT NULL D...

Relationship with Tables MySQL

Hello, I have some small issue with relationships with tables as below: I have created a login and registration script which has the following table name: members: fields: member_id, firstname, lastname, login, password Now i have made another table with this table name: phone fields: member_id, phoneid, name, number, prefix, time,...

Is there a reason MySQL doesn't support FULL OUTER JOINS?

Is there a reason MySQL doesn't support FULL OUTER JOINS? I've tried full outer join syntax in mysql many times and it never worked, just found out its not supported by mysql so just curious as to why? Thank you inadvance;-) ...

PHP - reformat multidimensional array to insert into MYSQL?

Hello, how can I parse php array like this: $cars= array( "Ford"=>array("C-Max"=>array("length"=>"4333","width"=>"1825","height"=>"1560"),"Escape"=>array("length"=>"4480","width"=>"1845","height"=>"1730") ,"Explorer"=>array("length"=>"4912","width"=>"1872","height"=>"1849"),"Fiesta"=>array("length"=>"3950","width"=>"1973","heigh...

System for tracking changes in whois records

What's the best storage mechanism (from the view of the database to be used and system for storing all the records) for a system built to track whois record changes? The program will be run once a day and a track should be kept of what the previous value was and what the new value is. Suggestions on database and thoughts on how to store...

what is the best way to store a tree structure in a relational DB?

There is the: put a FK to your parent method , i.e. each records points to it's parent Which is a hard for read actions but very easy to maintain And then there is a directory structure key 0001.0000.0000.0000 main branch 1 0001.0001.0000.0000 child of main branch one etc Which is super easy to read, but hard to maintain. Wha...

Querying a database representation of a tree (MySQL)

I have two tables, one that contains nodes and second that contains the relationships between them like so: Table A (named Node) NodeID | NodeName 100 | Name 1 101 | Name 2 102 | Name 3 Table B (named Relationship) NodeParent | NodeChild 100 | 101 101 | 102 I need to execute a query that needs to f...

Large MySQL query and insert

hey everyone im new here as well as to php only been at it for about 2 months kinda learning as i go. what i need to get done right now is to take data from about 16 different tables in a data base and duplicate the tables. the table are for applicants and either have an application id in common or a family id in commmon the id's are jus...

MySQL as Linked Server on SQL Server 2008 - Data Length Mismatch

I am trying to set up a third party MySQL as a Linked Server on SQL Server 2008. When I try to access the data via a simple OpenQuery below I get an error. SELECT * FROM OpenQuery(SERVERNAME, 'SELECT * FROM table') The error message: OLE DB provider 'MSDASQL' for linked server 'SERVERNAME' returned data that does not match expected...

Sending a value from a dropdown box to PHP via jQuery

Hey guys, I'm trying to take values from a dropdown two boxes and send them to a PHP file which will draw an appropriate field from a mySQL database depending on the combination chosen and display it in a div without refreshing the page using AJAX. I have the second part sorted, but I'm stuck on the first part. Here is the HTML: http:/...

Use wordpress database for other script

My website used to work on wordpress engine but now I'm writing my own script. The problem is that users passwords in wp_users table are encoded in a strange way... Can anyone please tell how should I encode it so that it worked on my new script? ...

Crazy characters - trying to insert into UTF-8

Hello. I'm trying to create a script that copies data from an old legacy mysql database into my new utf-8 formatted database. One particular field is causing me trouble, its a latin1 field - and one record has the following in it: !-#$%'&*£¥ When the update is performed, I get the following error message: Zend_Db_Statement_Except...

SQL Syntax Error

Hi, I am trying to upload a members database with login and create user facilities. Whenever I upload the .sql file to the host i am getting an error at the bottom of the page saying: MySQL said: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ÿþ/' ...

MYSQL ERROR 1248 (42000): Every derived table must have its own alias

I cant for the life of me figure out why this is erroring ...

What does the first argument to MySQL's Decimal function do?

Using MySQL 5.0.27 This query: SELECT CAST('543.21' AS DECIMAL(100,2)) returns 543.21 So does this one: SELECT CAST('543.21' AS DECIMAL(2,2)) In fact, I am having trouble figuring out what effect the parameter has. I am using it to aggregate numeric values in a varchar column (for legacy reasons!!) and round off to 2 decimal places. ...

Drupal site not behaving - process of elimination

I have two versions of a Drupal site running on my local dev environment. Site X boots perfectly; site Y doesn't - rather than running index.php, install.php is called. So far, I've: Stepped through site Y with a PHP debugger; index.php does not seem to be called at all. Pointed site Y at the database for site X to see whether there w...

Mysql: Order of results with "select <fieldname> from" is different to order of results with "select * from"

Hi all. i have a mysql db with a table 'difficulties' with a few records. If i do "select * from difficulties" i get them back in the order they were added, ordered by primary key id: mysql> select * from difficulties; +----+-------+-----------+--------+----------+-----------+ | id | value | name | letter | low_band | high_band |...

Converting SQL Server to MySQL

Hi, is it possible to convert a SQL Server database file to a MySQL Database file and if so what would be the best way to go about doing this. Thanks. ...

MYSQL ordering data from 1 table using the 2nd table

Is there a MYSQL query I can use to order items from a second table. My example I'm listing My Stores... each store has a number of products in a diffrent table. so my store listing displays the number of products in that store.. is there an easy MYSQL query so i can order my stores by number of products my store doesnt hold a value o...