mysql

[C++/C] How to get a list of hosts connected to a mysql server

I am trying to get a list of hosts connected to a mysql server. How can i get this? What should i do after connecting to the mysql server. Code snippets will really help. Also whats the best api to use to connect to mysql using c++? ...

Restricting an SQL query to certain fields in a table not used by the query

I have a products table, with the fields productname, category and cost, of type varchar, varchar and double. I then have a sales table, with the fields productname, cost, and saledate, of type varchar, double and date. Lastly, I have a purchases table with the fields purchase, cost and purchasedate, of type varchar, double and date. ...

Extensible DB editor

I'm using MySQL. In my DB there are several tables, containing fields with data, serialized in custom binary format. (Actually, these fields contain lists of fixed-format records, like a "sub-table".) I need a tool to be able to edit those fields by hand while my own fancy data administration UI is still in development. I wonder, if t...

grouping common results in sql

I have a products table, with the fields product, category and cost, of type varchar, varchar and decimal. I then have a sales table, with the fields client, productname, quantity, cost, and saledate, of type varchar, varchar, int, decimal and date. I want to show all of the products sold for a month, say the current month. However, I...

Re-direct query not working

Hello, The code below is supposed to redirect the user to the index file if the user ($uid) has submitted an entry in the last hour. It's not working. Any idea why not? Thanks in advance, John $queryuidcount = "select loginid from submission where datesubmitted > (NOW() - INTERVAL 1 hours) AND loginid = '$uid'"; $uidresult = mysql...

MySQL Query COUNTing incorrectly

Well, I realise that in fact it's more likely to be my logic that's counting wrong ;) So here's my query: SELECT code.id AS codeid, code.title AS codetitle, code.summary AS codesummary, code.author AS codeauthor, code.date, code_tags.*, tags.*, users.firstname AS authorname, users.id AS authorid, ratingItems.*, FORMAT((...

MySQL for easy statistics

I'm planing to automatizate process of statisitcs collecting at work, and decided to use MySQL to store data. I'm working for tourist info-centre, so statistics (once a month) looks something like this: Date:  1 2 3 4 5 6 7 8 9 10 ... Museum  5 3 12 34 1 ... Kremlin 5 1 43 12 9... So the first column is the list of the objects (diff...

sync 2 MediaWiki weekly?

hello, we have to mediawiki (like wikipedia) installation one is public and one is internal we do the normal work with the internal adding/changing/deleting text articales and pictures we want to sunc and update the external one on weekly bases, what is the best approach? note: we are using 2 windows servers (but willing to change to...

Mysql Full-Text Search - Searching for part of a keyword

I've read about full-text search functions in mysql. But in these methods you have to search for exactly right spelled complete words. For example if your text contains 'Bitdefender 2009' and you search for Bit, you get nothing SELECT * FROM logs WHERE MATCH (log) AGAINST ('Bit 09' IN BOOLEAN MODE); So are there any solution for this...

Returning multiple columns and grouping by month

I have three tables products, sales and costs. The sales and products table each have a costs field of type decimal and a date field of type date. Additionally, the sales table has a productname field, which is matched to a productname field in the products tables. The products table also has a category field. I want to select all sa...

Removing accents chars from arabic text

Hi, I've a database with collation of utf8 / utf8_bin. DB have arabic text with accent chars (kasar etc). I want to search text without accent chars. What i did is, i wrote 'like' query ... WHERE replace(field1,0x[CODE],'') like '%[arabic text]%' --- where [CODE] is the accent char. This is working fine when i write static utf arabic...

Fastest MySQL operator checking for not 0 in indexed columns: > or !=

What would be the fastest way to check for not 0 in an indexed column, using: WHERE column != 0 or WHERE column > 0 Do one of the above work better with indexed columns, or are they pretty much the same with regards to speed? ...

Recursion for json_encode only on failed MySQL query

Scenario: Two different objects that get their data from a MySQL database (originally, then subsequently from a serialized/unserialized SESSION key) are causing a recursion error for json_encode, but ONLY when another, later INSERT query has failed. The INSERT query will fail when certain elements are NULL (as mandated by the table str...

How to display info using Java AWT?

Hi, I've developed an application using servlets, MySQL and Tomcat. I've been asked to create a version of this application that does not require the use of a server. I've researching and I think that what I need is to create windows where I can show information to the user and to retrieve information from the users. I've learned how...

How to check only the first two letters from a mysql cell?

Hi, I want to check a row in an mysql table for the username in php, if the username starts with ab to write an text. the username is in a cell and looks like this: ab_12345453. Thanks, Sebastian EDIT: thank you all for your reply. but i need something else. i need this for joomla, i don't need to make an query, i just use: $user->u...

How to extract random entries from multiple mysql tables directly from database?

I am trying to extract a maximum of 5 entries randomly from two tables combined directly from database. kinda like this SELECT RANDOM FROM table1,table2 LIMIT 0,5) I am aware that I can filter the result later on from PHP, but I want only 5 random rows from database. These multiple tables might have different database structure ...

Collecting votes across multiple sites

I am looking for a solution that allows people to submit their vote to the main site via a voting system or banner. At the moment, I am aware of one solution that works with drigg and drupal, but it requires url redirect or mod_rewite that is not currently available on the clients server. Is anyone aware of a solution that would allow...

Calling stored procedure ignoring output parameters

I need to call MySql procedure as a plain text. Procedure has output parameter. I'm not interested in returned data. What do I need to pass as output parameter to ignore it? PS: I know that using of SqlParameters is good and safe, but it is not my case. ...

problem in mysql queries in using union

hello i was looking for a way to combine different mysql queries in a php file so this is my code : $sql_query = "SELECT b.*, u.username AS MY_Sender FROM table_users u, table_blogs b WHERE b.reciever = '0' AND u.user_id = b.sender UNION SELECT b.*, u2.username AS MY_Recipient FROM table_users u2, ...

mysql_fetch_array problem

Hi guys, i am trying to do a guestbook in php but i am having some problems with mysql_fetch_array function. I don't understand why. I try to debug by putting die("Error ".mysql_error()) but nothing prints out. I guarantee that all my variables are correctly initialized. Here is my code : <?php $nbmessagesPP = 10; mysql_connect(HOST...