Can’t install mysql-python (newer versions) in Windows

I solved it myself. I use the wheel installer from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python. There are two wheel packages there. The amd64 one refuses to install on my platform (Windows) but the other one works just fine. I mean the file with this name: MySQL_python-1.2.5-cp27-none-win32.whl Then install it by running this below command in the same folder with … Read more

Finding number position in string

With help of xdazz answer, I did some changes and got answer finally… SELECT myWord, LEAST ( if (Locate(‘0’,myWord) >0,Locate(‘0’,myWord),999), if (Locate(‘1’,myWord) >0,Locate(‘1’,myWord),999), if (Locate(‘2’,myWord) >0,Locate(‘2’,myWord),999), if (Locate(‘3’,myWord) >0,Locate(‘3’,myWord),999), if (Locate(‘4’,myWord) >0,Locate(‘4’,myWord),999), if (Locate(‘5’,myWord) >0,Locate(‘5’,myWord),999), if (Locate(‘6’,myWord) >0,Locate(‘6’,myWord),999), if (Locate(‘7’,myWord) >0,Locate(‘7’,myWord),999), if (Locate(‘8’,myWord) >0,Locate(‘8’,myWord),999), if (Locate(‘9’,myWord) >0,Locate(‘9’,myWord),999) ) as myPos FROM myTable; Demo

com.mysql.jdbc.PacketTooBigException

I just had to deal with the same error message, thrown by DriverManager.getConnection(URL,username,password). I even got the same “magic numbers” (4739923 > 1048576); googling for those “magic numbers” will show results from people also getting the error thrown by some DriverManager.getConnection statement. In my case, the error message about packet size was COMPLETELY MISLEADING; I … Read more

PHP/MySQL Pagination

SELECT col FROM table LIMIT 0,5; — First page, rows 1-5 SELECT col FROM table LIMIT 5,5; — Second page, rows 6-10 SELECT col FROM table LIMIT 10,5; — Third page, rows 11-15 Read the LIMIT section on the MySQL SELECT helppage. If you want to display the total number of rows available, you can … Read more

Using PHP to upload file and add the path to MySQL database

First you should use print_r($_FILES) to debug, and see what it contains. : your uploads.php would look like: //This is the directory where images will be saved $target = “pics/”; $target = $target . basename( $_FILES[‘Filename’][‘name’]); //This gets all the other information from the form $Filename=basename( $_FILES[‘Filename’][‘name’]); $Description=$_POST[‘Description’]; //Writes the Filename to the server if(move_uploaded_file($_FILES[‘Filename’][‘tmp_name’], … Read more