mysql

Designing a table in mysql.

Mysql , php newbie here. Please be nice . I have a list of colonies - colony1 , colony2,..., colony100. Say Colony5 is nearby to colony4, colony9 and colony10. Colony4 is nearby to colony5, colony9, colony10 and colony11 . Different colonies have different number of nearby colonies. How do I store and fetch this data in mysql ? Cur...

Really simple MySQL JOIN not working?

What am I doing wrong? Seriously confused. SELECT * FROM photos WHERE user_id = 1 JOIN photos_albums ON photos_albums.photo_id = photos.id The context is, I have a table to store photos, and another table to store photo albums (not shown). I also have a cross-referencing table photos_albums to store which photos are in which albums. ...

Zend Paginator displays wrong page count when query has "distinct"

Hi all I'm using Zf 1.10 on a project, and have been using Zend_Paginator together with Zend_DbTable queries quite successfully until this bit. The query requires a DISTINCT keyword to remove duplicate rows created by a join, but when I add it, the paginator incorrectly displays navigation for two pages of results when there is only in...

PHP: Display rows value same with all union limit

<? // Connect database include("cat-config.php"); // Get all records in all columns from table and put it in $result. $result=mysql_query(" (select * from stok_lukisan where `Ukuran` LIKE '20x25' AND `Kategori` LIKE '1' ORDER BY `Kode` ASC limit 3) union all (select * from stok_lukisan where `Ukuran` LIKE '3...

Creating a recursive function in php to re-structure a recordset?

Hello I was hoping someone might be able to advise on how best to do this. I have a database resultset that looks something like this: PARENT CHILD Cat Tiger Cat Lion Cat Panther Mammal Cat Mammal Dog Creature Mammal What I require is a function that when passed this resultset, will r...

hw to traverse tree in mysql??

node (id , name ,parentid); tree (id, parent id) this is my table structure i want 2 store in this procedure i want to insert nodes id with its all parents eg this is node table contents +----+------+----------+ | id | pid | nodename | +----+------+----------+ | 1 | NULL | 1 | | 2 | 1 | 2 | | 3 | 1 | ...

need good sql library for php

hello, SO need library like crystal (crystal-project.net). at this time i use crystal, but this library not really for me at the moment (bad join and table prefix support, don't have function for get rows count). i don't need in ORM or abstraction library. i just need good mysql wrapper with chain method support (->order_by('-id')->li...

Drupal Development: I need a good idea!!

Hello everybody. I'm starting developing a Web Site for a Sport Club. This site will have a "main" site with some "institutional" content, and every sport that is present in the club will have it's own micro-site. For example, i'll have this sitemap. Club +++History +++About Rugby (one random sport) Blog Photos Videos User Comme...

MySQL creating and populating the database

Hi, I have downloaded the MySQL 5.2.5.1 version. I need to create the database and populate it. O have the data file in .csv format. I'm running the Mysql on windows. So when I create the database and a table in it, I want to populate the data from a file on my PC which is in .csv format. I did it in this way: load data local infile 'un...

MySQL cartesian product conditions

Hi I need alittle help with a mysql query. I have 3 tables x1 x2 x3 1 1 1 2 2 2 2 2 2 and I have 2 joins select distinct x1.int1 as a, x2.int1 as b, x3.int1 as c from x1 JOIN x2 JOIN x3 but I would like to generate the cartesian product with the condition that the results should contain just the just the 3 numbers from ...

php, javascript and mysql live data problem

Hi all, I'm very new to web programming, but I have some data that I would really like to present in a constantly updated time series graph on my website. So I have been trying to prototype some code that will display the latest integer value that has been added to a database. The database table I want to reference is being constantly in...

What can cause "too many database connections"

My Wordpress website got a "error establishing connection to database" massage. My host informed me it was because my "user" had too many database connections that were open at once. This caused an error making additional connections, and thus the massage. This has been corrected by killing deadlocked database connections. There were a...

MYSQL -populating the database

How do we populate the data into mySql windows 5.1. version?I have .csv files. I'm not allowed to use the load data command. Please help me out. ...

XAMPP MySQL Terminating worker thread 1

Hi, I used to work with XAMPP to build PHP applications. Once I tried Zend engine and uninstalled it. After that, MySQL in XAMPP is not working. It is giving "Terminating worker thread 1" error. When I check ports, MySQL has status Service: MySQL_ZendServer51. Pleas help me how to reassign it back to XAMPP? I have reinstalled XAM...

php mysql if id in field

Hello, My database comments ID mID aID attachID 1 1 6 1 2 2 6 1 3 3 6 1 4 8 6 2 5 4 6 2 So i'd like to allow access to user with mID to access attachID. If they are viewing attachID 1, so users with mID of 1 or 2 or 3 can view. rest mID cannot. EDI...

MySQL Calculate Time Online

Would it be possible to calculate time online from a table of something like logtype time ---------------- login 2:30 logout 2:45 login 3:20 logout 4:50 login 5:00 login 5:10 logout 6:00 It would have extra logins because sometimes the server crashes and doesn't add logout. Can you do somethi...

HTTP authenticate a directory via an existing users table in a database.

I wish to tie my user accounts into HTTP for a specific directory of my website and normally that wouldn't be too much of a problem, because I could either edit the htpasswd file or use mod_auth_mysql (which I'm not too familiar with). However, the passwords are encrypted using SHA1 and a salt. How can I HTTP authentication password an...

PHP/MySQL: Updating nonexistent column value

So, this query: mysql_query("UPDATE item SET name = 'foo' WHERE name = 'bar'"); is returning 1, but the value 'bar' doesn't exists in the table. As expected, nothing has changed in the database itself, but shouldn't mysql_query() return 0 in that case? ...

AS3+PHP+MySQL : home-made online chat not always reactive

Hello, I coded some kind of online chat system with a Flash (AS3) client that sends and retrieves data from a PHP script that communicates with a MySQL database. It works well, except for the fact that occasionally, my client doesn't get one of the new chat lines even though they are correctly registered in the database. Here is the ba...

installing MySQLdb for Python 2.6 on OSX

I am trying to install MySQLdb for Python 2.6 as per these instructions: http://www.tutorialspoint.com/python/python_database_access.htm When I get to this step: $ python setup.py build I get the error: users-MacBook-Pro:MySQL-python-1.2.3 user$ sudo python setup.py build sh: mysql_config: command not found Traceback (most recent call...