mysql

80 3 column rows, or 1 81 column rows

Hi there, I Have some data to store, I must store this data for every user, The data is more or less key: 0 value: 107, key: 1 value 213 There are about 80 key/value sets per user So my question is, Do I have one row that is basically user_id key1, key2... key80 or do I have 80 rows of user_id, key, value Data I must ...

Cannot find MySQL Reference in Visial Studio 2008

Please, help me I want to add mysql reference in visial studio 2008 but I cannot find it. Can I download mysql reference and add it in to visial studio or not, or what should I do ??? ...

Node.JS and MySQL drivers

Is there a Node.JS Driver for MySQL that is commonly used other than http://github.com/masuidrive/node-mysql ? This driver is unstable (says the creator). It seems like there is not much activity with node.js database drivers. Is there a reason for this or is it just because Node.JS is so young? ...

Mysql add mult-column index with repeated rows.

Having the next table: id -> incremental field_1 -> foreignkey field_2 -> foreignkey I want to add the next index ALTER TABLE my_table ADD unique index(field_1, field_2); How ever I have (due a bad application validation) I have a lot of repeated rows (by repeated I mean same field_1 and same field_2, having just id as difference)...

Can I run php script in background mode?

Now, I am developing an SNMP webserver and I want to get the data from MIB in the Windows to insert in the MySql data base. I use SNMP connection which provide in PHP, so I want my php script always run and no interface in the background for updating the database. Can I do like this or there are the better way to do. Please, help me. ...

How to rewrite a subquery to use joins when you used DISTINCT in the subquery?

I have a query where I use a sub query, and I would like to rewrite into a join, to have better performance. The subquery uses DISTINCT as there are many records, and the problem I have is that they end up multiple times in the join when I use the join. So how do I rewrite a query like this to use join: SELECT * FROM table1 a ...

query a mysql table for rows that have the same month value and store as a php array for later use displaying them on a calendar

the subject basically sums it up, but i am working on a calendar in php for a client that should pull events from a table and display them in the appropriate cells. the calendar table is working no prob, but what i am trying to avoid is making a separate DB call for each day of the month. i am trying to figure out a way to store the re...

Database structure for efficient storage and retrieval

Ive got a database that receives links and content related to a specific football club,and the way im storing the content at the moment is in 2 seperate tables,1 that stores the links and the details,fm_sources, and another that stores club specific information,fm_club, that will be used to run queries against the fm_sources content to f...

mysql support to xquery?

does mysql supports xquery? if yes then which version? ...

Two similar applications on different domains but same users

I'm planning on building two applications using Zend Framework that are very similar but serve two different purposes that can't be part of the same application or be combined into one. However, modules are something I'm considering. The issue I'm running into is if a user registers for the first application I want that information be a...

NullReferenceException in MySqlClient.NativeDriver

I have a long running program that exectues some mySQL-Queries every 5 minutes (timed thread). After it has run for approximately 10 hours a NullReferenceException is thrown with the following stacktrace: at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId) bei MySql.Data.MySqlClient.Driver.GetResul...

Hashed passwords updated through JDBC become corrupt. (More of encoding problem than hashing)

I've tried the following with MySQL UTF-8 and Latin-1, to no avail. I hash my passwords (in this case toSecurify) using SHA-1 like so: if(toSecurify == null) { throw new Exception("toSecurifyString must not be null"); } try { MessageDigest messageDigest = MessageDigest.getInstance("SHA-1"); byte[] sha1HashBytes = new by...

$row=mysql_fetch_array($result); only returns even rows...

We have this code: $rowArray; $rowID = 1; $query = "SELECT idCentros FROM centros"; $result = mysql_query($query); $numrows=mysql_num_rows($result); while($row = mysql_fetch_array($result)){ $rowArray[$rowID] = $row['idCentros']; $rowID = $rowID +1; } $numrows returns 4 (the rows we have in that table)......

MySQL query help needed to get clients who haven't bought anything in more than 180 days!

I have a table Orders which stores the info about orders(including OrdersName,OrdersSurname,OrdersEmail,OrdersPhone) which is the info I need to get. It contains a field OrdersFinishedTime which is a DateTime field which stores the data when the order was finished. What I need to do is select OrdersName,OrdersSurname,OrdersEmail,Orders...

Optimize a simple JOIN or IN query

I have this query: SELECT DISTINCT id, label FROM bbproduct_cust WHERE CUSTNO IN (SELECT CUSTNO FROM customer WHERE SLSRPTGRP = '1996') AND DEPTNO = '0' ORDER BY label ASC EXPLAIN shows id select_type table type possible_keys key ...

How to handle NULL values in mysql/php?

In MSSQL Server, we make queries for null values like below: SELECT name, ISNULL(about, ''), contact FROM `user_profile` WHERE userid=1 But when I am trying to do the same with MYSQL then it gives error. What is the logical and easy way to handle NULL values in php/mysql scenario. Thanks ...

Creating a variable by pulling a value from a MySQL database

Hello, I am using a MySQL table called "login" that includes fields called "username" and "subcheckr." I would like to run a PHP query to create a new variable equal to "subcheckr" in the table where "username" equals a variable called $u. Let's say I want to call the variable "$variable." How can I do this? The query below is what ...

Confusion about varchar datatype.

Hi there, My server has my SQL version of 5.0.91-community, now i have to store a long string of approx about 500 character more or less, i thought of going with text data type but then someone told me it slows the performance, i wanted to know more about varchar and it's limit. i used to think that varchar is only limited to 255 char...

PHP & MySQL - How can I flag my database when a user deletes their account and after two weeks if the user has not logged in really delete the account

I asked a question earlier on how would I go about deleting a users account and I got a suggestion that I should flag my database that the user has deleted their account but not actually delete the account until after two weeks or so. So my question is now how would I flag my database and then have the account deleted after two weeks i...

MySQL Get latest record by date from mutiple tables with values from lookup tables

I want to get the latest MainNumber, Serial, BarType and Notes for a given MainNumber, if they exist. Note that BarType is stored in a lookup table and referenced with BarID. Unreason came up with this: SELECT @MainNumber, COALESCE(n.Notes, 'None') FROM numbers LEFT JOIN notes n ON numbers.MainNumber = n.MainNumber LEFT JO...