mysql

Mysql migration tool, source parameter string | connection string for sql server

Hi all, I always got failed to "fetching of list failed error" this is my connection string in asp.NET "Data Source=maywood\XSQLSERVER;Initial Catalog=maywood_test;Integrated Security=SSPI" What exactly i should input at Mysql migration tool for source parameter string FYI,'maywood' is my conputer name and i am using sql sevrer 2000. ...

Why is mysql_num_rows returning zero?

I am using C MySQL API int numr=mysql_num_rows(res); It always returns zero, but in my table there are 4 rows are there. However, I am getting the correct fields count. what is the problem? Am i doing anything wrong? ...

Getting avoiding locked SELECT:s in MySQL when using MyISAM

MyISAM uses table level locking which means that SELECT:s are blocked while INSERT/UPDATE:s are running. To mitigate the problem of blocked SELECT:s I've been recommended to configure MySQL with these parameters: low_priority_updates=1 concurrent_insert=2 What are the drawbacks of using low_priority_updates=1 and concurrent_insert=2...

Useful PHP database class

I am working on a small PHP website. I need a MySql database access class that is easy to configure and work with. Does not need to be a full framework, I only need a max. few classes. ...

Show number of visits in the last 24 hours, broken down by the hour...

Hi there, I'm storing a timestamp in a mysql table every time somebody visits the site for the first time. I wind up with data that looks like this: 2009-08-02 04:08:27 2009-08-02 04:07:47 2009-08-02 05:58:13 2009-08-02 06:28:23 2009-08-02 06:34:22 2009-08-02 08:23:21 2009-08-02 09:38:56 What Im wanting to do with this data is creat...

How to make an unread topics list with mysql

What is an efficient way to display a list with unread posts in a forum? It is possible to track the user and logging each post he or she visits and registering it in a new table. I think this is not very efficient. What is a more efficient way to do this? ...

Unpredictable behavior due to different MySQL versions

I have installed different versions of PHP and MySQL on wampserver for testing purposes. However, phpMyAdmin gives a warning that: "Your PHP MySQL library version 5.0.51a differs from your MySQL server version 5.1.36. This may cause unpredictable behavior." Is this going to cause problems?? If yes, what should be done? I am not able to...

How do I update if exists, insert if not (aka upsert or merge) in MySQL?

Is there an easy way to INSERT an row when not exists, or to UPDATE if it exists, using one MySQL query? ...

Strange characters in mysql dbase

When I type strange characters like é or ë and store it in a mysql dbase; the character will be converted to: é It probably will have to do something with my character set. But i don't now where to start. On top of the page i inserted: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> The collocation of the fiel...

Few Google Checkout Questions

I am planning to integrate a Google Checkout payment system on a social networking website. The idea is that members can buy "tokens" for real money (which are sort of the website currency) and then they can buy access to some extra content on the website etc. What I want to do is create a Google Checkout button that takes a member to t...

MySQL append , prefix a range of numbers with 0.

I have around a few thousand rows with which contain 3 digit numbers starting with 100 and ranging to 199 which i need to prefix with 0. There are also thousands of other numbers 4 digit numbers as well which i don't want to change. I need find all the 3 digit numbers in the range and prefix only those ranging from 100 -199 with a 0 so ...

Do I need htmlentities() or htmlspecialchars() in prepared statements?

In an article http://dev.mysql.com/tech-resources/articles/4.1/prepared-statements.html, it says the followings: There are numerous advantages to using prepared statements in your applications, both for security and performance reasons. Prepared statements can help increase security by separating SQL logic from the data being su...

Pass PHP Array via jQuery Ajax

Hello all, I've got a php array: $toField = explode(",", $ids); //Which looks something like '24,25,26,29' I want to pass this array via jQuery AJAX, with this: <form id="myForm"> <input type="hidden" value="'.$toField.'"> <input type="submit" id="sendMessage" class="faceboxSubmit" name="ok" value="Send Reply"/> </form> And ...

MySQL 'create schema' and 'create database' - Is there any difference.

Taking a peak into the 'information_schema' database and peaking at the metadata for one of my pet projects, I'm having a hard time understanding what (if any) differences there are between the 'create schema' command and the 'create database' command for MySQL. Are there any differences? If not, is this a rather typical pattern of beha...

Simplest way to implement backend server for multiplayer JavaScript game? (COMET/longpolling)

I've been writing a game in JavaScript, and it's time to make it multiplayer. I would like to use AJAX long-polling to get the current game state, as well as implement the lobby. The server just needs to perform basic functions, like store the gamestate in the mysql database, retrieve the gamestate, and format the scoreboard. I think...

Mysql join with where clause

I have two tables I want to join. I want all of the categories in the categories table and also all of the categories subscribed to by a user in the category_subscriptions table. essentially this is my query so far: SELECT * FROM catagories LEFT JOIN user_category_subscriptions ON user_category_subscriptions.category_id = catago...

mysql fetching only one field

Is there an easy method to extract only one field. For instance: $sql = "SELECT field1 FROM table"; $res = mysql_query($sql) or die(mysql_error()); $arr = mysql_fetch_assoc($res); $field1 = $arr['field1']; My feeling says this could be done much easier. ...

How to optimize this MySQL slow (very slow) query?

I have a 2 gb mysql table with 500k rows and I run the following query on a system with no load. select * from mytable where name in ('n1', 'n2', 'n3', 'n4', ... bunch more... ) order by salary It takes a filesort and between 50 and 70 seconds to complete. When removing the order by salary and doing the sorting in the application,...

Question about freeing memory in a php script

I just saw this in a script mysql_free_result($rawdb); I saw it on a script somewhere, it ran a mysql query and saved the results to an array, right after adding to the array, it ran that which I assume free's the memory used from the mysql query. I am just asking to verify, is it a good idea to do this? I have a couple mysql querie...

Does mysql_real_escape_string() FULLY protect against SQL injection?

On http://www.justinshattuck.com/2007/01/18/mysql-injection-cheat-sheet/?akst_action=share-this , there is a section that claims you can bypass mysql_real_escape_string with certain Asian character encodings Bypassing mysql_real_escape_string() with BIG5 or GBK "injection string" に関する追加情報: the above chars are Chinese Big5...