mysql

Connecting to MySql database handle via PHP

Before looking into my question, lets consider the fopen in C. There are multiple ways of opening a handle fopen("abc.txt", "r"); fopen("abc.txt", "w"); fopen("abc.txt", "rw"); Similarly, will we be able to connect to a MySql database. To be more specific and clear, if i want to just read the database, all i need is select query. But...

Using phpmyadmin to manage duplicates

Hi! I'm looking for a tool that allows me to easily manage duplicate entries in the MySQL database. In a sense, I don't want to make my columns 'UNIQUE', but I want to review the records that happen to have exactly the same value in a column. It would be nice if I could craft such an SQL query that shows only such records using the us...

MySQL multiple tables access query

Hi, I am new to web development... mostly i learn my own.. I got to design a database structure so to store items similar to tags and posts in a blog. The design would be: _____________ Tag Table TAGID | TAGNAME _____________ _____________ Post Table POSTID | POSTNAME _____________ _____________ Tag Post Relation Table TAGID | POSTID _...

Security for social networking website

Possible Duplicate: What security issues should I look out for in PHP How to protect my site(social networking) from being hacked?just suggest some methods that are in common? i am using php for scripting & mysql for database and i am using CodeIgniter(php framework). if you know some good tutorial or ebooks then provide me ...

Using multiple GROUP_CONCAT in MySQL 4

Is it possible to use multiple GROUP_CONCAT in the SELECT clause? I'm asking because when I run my query, I do not get all the results, and the data in my GROUP_CONCAT columns are doubled. My GROUP_CONCAT columns are the last two in my SELECT clause. This is what I have: SELECT cases_details.id, cases_details.agency_number, cases_relati...

Need for splitting reads and writes in Elgg

Hi all, I was looking into the configuration options of the Elgg, the open source social networking site. There was an option which allowed splitting the database connectivity into read and write and even multiple connections for reads and writes. I am not sure as why the splitting of read and write is needed. If I am not clear ...

can i delete rows from 2 tables in one single SQL statement?

Hi there. I have 2 tables one called "REVIEW" and the other "REVIEW_DESCRIPTION" if i do a join to get all the data from both: SELECT * FROM reviews INNER JOIN reviews_description ON reviews.reviews_id=reviews_description.reviews_id WHERE reviews.customers_id = 54183 based on this i would like to delete rows in both tables that mat...

variable is not set & form submission error question

Having a little bit of trouble with this section of code: if(!empty($_POST['RemoveRequest']) && isset($_POST['RemoveRequest'])){ $action = $_POST['RemoveRequest']; } echo '<form method="post" action="'.$page_name.'"> <input type="submit" value="[Remove Request]" name="RemoveRequest" /></form></td>' .'</tr></table>'; if($action == 'Rem...

MySQL slow query with join even though EXPLAIN shows good plan

Hi, I have the following scenario: In a MySQL database, I have 2 MyISAM tables, one with 4.2 million rows, and another with 320 million rows. The following is the schema for the tables: Table1 (4.2M rows) F1 INTEGER UNSIGNED NOT NULL PRIMARY KEY f2 varchar(40) f3 varchar(40) f4 varchar(40) f5 varchar(40) f6 smallint(6) f7 smallint(6) ...

MySQL Phone table: How to specify a unique primary contact number per ID?

My table is as follows: CREATE TABLE IF NOT EXISTS PHONES ( number VARCHAR(10), id INT, type VARCHAR(10), PRIMARY KEY (number), FOREIGN KEY (id) REFERENCES TECHNICIANS(id) ON DELETE CASCADE ) ENGINE = INNODB; I would like to specify for each id one primary contact number. I was thinking of adding a ...

mysql, create field based on existing data

I want to add a field if possible that contains data from another field on the same table. In this case I want everythhing in table.newfield to show values from table.oldfield that are less than 100. Can I do this in sql? Or shall I stick to doing this in a select query for reports? Mysql 5,1 innodb strict mode ...

MySql If statements

I have a simple table that logs simple events an administrator does. Nothing complicated. One of the columns is userid, so I can reference the user's name from the users table: SELECT u.username FROM `users` u, `history` h WHERE u.userid = h.userid My issue is that the internal system also logs events (just like a user), but there i...

MySql with more then one Column

I have this table ------------------ 1 | 20,00 | A | 2 | 20,00 | A | 3 | 20,00 | A | 4 | 20,00 | A | 1 | 50,00 | B | 2 | 50,00 | B | 3 | 50,00 | B | 4 | 50,00 | B | I wold like to produce this one using group by. id | A | B | ---------------------- 1 | 20,00 | 50,00 | 2 | 20,00 | 50,00 | 3 | 20,00 ...

How to dynamically use checkbox to get data from mysql? - jquery

Hi all, I am new to jquery and php but I am trying to use a checkbox to grab stuff from a mysql database. To further explain, I want a checkbox and when checked it will place the id of the checkbox in a mysql query and display the results from the database. So, if I check off this box: <input name="apple" type="checkbox" id="apple" ...

mysql.sock stopped working on rails3RC ruby 1.9.2

Rails 3.0.0.rc ruby 1.9.2dev (2010-05-31 revision 28117) [x86_64-darwin10.4.0] Today I upgraded to rails 3.0.0RC (from beta4) and ruby 1.9.2 (via RVM). Now when I do rake db:create in a new test app I get the below error. Anyone know what I'm doing wrong? I did 'bundle install' with no errors. DEPRECATION WARNING: Calling a method in ...

Datamapper (Overzealous Edition), Codeigniter and Has Many Clarification

Firstly, I would like to just it out there that I am an ORM noob. I've never used an ORM in my life and have reached a point in my day-to-day developing that I need to do some crazy advanced relationships that I believe Datamapper Overzealous Edition can help me with as I am using Codeigniter. In my database I have the following tables;...

mysql query for timezone conversion

hi, is there a way to convert from unix timestamp to GMT in mysql while running the query itself?? My query is as follows: SELECT r.name , r.network , r.namestring , i.name , i.description , r.rid , i.id , d.unixtime // this is the unix time i am asking to print , d.ifInOctets FROM range AS r INNER JO...

Get list of MySQL databases, and server version?

My connection string for MySQL is: "Server=localhost;User ID=root;Password=123;pooling=yes;charset=utf8;DataBase=.;" My questions are : What query should I write to get database names that exist? What query should I write to get server version? I have error because of my connection string ends with DataBase=. What should I write in...

Can't see my error in this jQuery table expand

Hi folks. I'm following this tutorial: http://www.javascripttoolbox.com/jquery/ And I'm trying to get table rows that are populated by mySQL to expand to show the details. What's strange is firebug shows the rows as hidden (greyed out), and when I click the above row, the rows get un-greyed out. The problem is that they are not actual...

MySQL syntax error (in SELECT query)

I have two MySQL tables: Group(gr_id, gr_name, gr_description, parent_id) Group_has_User(User_id, Group_id) I'm trying to execute the query: SELECT group.gr_id, group.gr_name, group.gr_description, group.parent_id FROM group, Group_has_User AS gu WHERE (group.gr_id = gu.Group_id) AND gu.User_id = 1 It gives an error: You have an err...