mysql

Using the erlang mysql module, how is a database connection closed?

In using the erlang mysql module the exposed external functions are: %% External exports -export([start_link/5, start_link/6, start_link/7, start_link/8, start/5, start/6, start/7, start/8, connect/7, connect/8, connect/9, fetch/1, fetch/2, fetch/3, prepare/2, execute/1, execute/2, ...

PHP - SQL query to get update time from table status

This is my php code (I already have a connection to the db): $result = mysql_query("SHOW TABLE STATUS FROM mydb LIKE 'mytable';"); while ($array = mysql_fetch_array($result)) { $updatetime = $array['Update_time']; } echo $updatetime; I get: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL r...

Query to add a column depending of outcome of there columns

I have a user table 'users' that has fields like: id first_name last_name ... and have another table that determines relationships: user_id friend_id user_accepted friend_accepted .... I would like to generate a query that selects all the users but also add another field/column say 'network_status' that depends on the values of use...

sql question regarding sum() and tax (MySQL 5.0.89)

Select id, sum(amount), vat From transactions WHERE id=1; Each record in this table has a vat percentage, I need to get the total amount in all records, however each amount has to be multiplied by its vat %. Is there away to do this without looping through all records? ...

Failed to link mysql5.1.39\bin\libmySQL.dll

When trying to link to mysql5.1.39\bin\libmySQL.dll, I get an error: fatal error LNK1107: invalid or corrupt file: cannot read at 0x2D0 Anyone familiar with this? ...

MYSQL query to get all entries with specific time, from PHP?

I'm trying to query a mysql table which places its date in the following format: yyyy-mm-dd hh:mm:ss So it's date and time, and that's all in a single field. Now from php I want to get the time and query the table to only return entries where the date field is less than 24 hours old. I'm having issues with the system because PHPs get ...

[C# n MySQL] Creating a database using Connector/NET Programming?

How to create a database using connector/net programming? How come the following doesn't work? string connStr = "server=localhost;user=root;port=3306;password=mysql;"; MySqlConnection conn = new MySqlConnection(connStr); MySqlCommand cmd; string s0; try { conn.Open(); s0 = "CREATE DATABASE IF NOT...

how to tackle a custom forms database

I'm currently researching a project for the place that I work in. We are trying to create a system that will allow forms to be set up dynamically from a database. My question is what database structure would best suit something like this? I currently have a structure of: forms_form forms_formfields forms_formdata I don't think this ...

How can I efficiently retrieve a large number of database settings as PHP variables?

Currently all of my script's settings are located in a PHP file which I 'include'. I'm in the process of moving these settings (about 100) to a database table called 'settings'. However I'm struggling to find an efficient way of retrieving all of them into the file. The settings table has 3 columns: ID (autoincrements) name valu...

Working with foreign keys - cannot insert

Hi everyone! Doing my first tryouts with foreign keys in a mySQL database and are trying to do a insert, that fails for this reason: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails Does this mean that foreign keys restrict INSERTS as well as DELETES and/or UPDATES on each table that...

Can i use MAX function for each tuple in the retrieved data set

Hi, My table result contains fields: id count ____________ 1 3 2 2 3 2 From this table i have to form another table score which should look as follows id my_score _____________ 1 1.0000 2 0.6667 3 0.6667 That is my_score=count/MAX(count) but if i give the query as create TEMPORARY TABLE(select id,(co...

how to store a 2D game world in mysql

I am making a 2D game in javascript/ajax, that will be using data stored in mysql database. Every user have got his own "area" made of small squares that can have some values. But I have no idea, how to store values of each square in mysql, when each user can have area with different width or height. Do you have some idea? ...

MySQL IDE recommendation?

Duplicate of http://stackoverflow.com/questions/9185/what-is-the-best-mysql-client-application-for-windows#9205 http://stackoverflow.com/questions/40902/looking-for-mysql-ide Hello, I've been wondering what you guys are using to write,debug,test your SQL queries there days? The requirements are quite simple: Auto-complete Synta...

Having a problem inserting a foreign key data into a table using a PHP form

I am newbee with PHP and MySQL and need help... I have two tables (Staff and Position) in the database. The Staff table (StaffId, Name, PositionID (fk)). The Position table is populated with different positions (Manager, Supervisor, and so on). The two tables are linked with a PositionID foreign key in the Staff table. I have a staff r...

PHP & MySQL question user submitted data?

I was wondering how can I allow users to enter HTML and CSS to the there profiles safely using PHP and MySQL like they do on MySpace. ...

How add column order in careers table???

this table i want to create job_id dynamic Jobs Title text Job Description text job_Order combo box to choose after what job or at first position in the website i create form to add job and i want to create combo box to choose how will view in first position in career page. i using job_...

MySQL count problem

I have 3 tables users(id,name),groups(id,name) and users_groups(user_id,group_id). users and groups have many to many relationship, so the third one is for storing users and groups relations. I would like to select all the data from groups with user count in each group. So far I came up with this: SELECT groups.*, COUNT(users_groups.use...

Mysql_insert_id with Doctrine

Hi! I have a couple of tables (mySQL) that i would like to update with the help of Doctrine. The products table id is auto-incrementing, and here's a brief description on what I would like to do: $prod = new Products(); $prod->type = '0'; $categ = new CategoriesToProducts(); $categ->cat = '111'; $categ->product = $...

Managing User Profiles with PHP/MySQL for Beginners

I am beginner in PHP/MySql and would develop a simple site that has user management. I like the idea of using OpenId's (like stackoverflow uses). I wonder from where to start? What should I read? I have not much time so probably will net enter in all details of PHP user session management, this because I search something like User pro...

Error #1064 in mySQL Query

I get the following error in the query below: #1064 - 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 ')))' at line 1 Code Snippet: INSERT INTO test_bans( ip, Expiration ) VALUES ( "0.0.0.0", DateAdd( "d", 1, Date( ) ) ) Tab...