mysql

PHP and MySQL problem.

How do I enter the plus(+) and minus(-) signs into a MySQL database and output them + - as normal all while still using mysqli_real_escape_string(); if there is a better way please let me know. ...

MySQL join performance vs correlated queries

Hi, I'm wondering if a 'normal' inner join leads to higher execution performance in MySQL queries than a simplistic query where you list all tables and then join them with 'and t1.t2id = t2.id' and so on .. ...

SQL: How to select elements in a rectangle range from a large continuous matrix? **UPDATED**

I'm having a hard time working out the following problem efficiently. I have a 15000x15000 xy matrix. I'm storing element locations in this matrix by defining a x,y coordinate for the element. I want to display a part of the matrix in a so called viewport. The viewport dimensions are e.g. 1600x1000 Consider the following db structure: ...

How can this kind of SQL injection work even though there is not security consideration at all?

bob'); drop table students; -- In PHP,this will fail: mysql("statement1;statement2;"); There can be only one statement,so I really doubt how can the above injection actually work at all? ...

trapping a MySql warning

Hi all In my python script I would like to trap a "Data truncated for column 'xxx'" warning durnig my query using MySql. I saw some posts suggesting the code below, but it doesn' work. Do you know if some specific module must be imported or if some option/flag should be called before using this code? Thanks all Afeg import MySQLdb ...

How do I convert a db3 file (Palm Pre database) to a MySQL file?

I've copied the db3 database file on my Palm Pre to my computer and would like to convert it to a MySQL database (so I can print the memos). (Or, better, I'd like to find a GUI like PHPMyAdmin that can read the db3 file.) How can I access that data on a PC best? Thanks. Ari ...

Ordering by the first alphabetical char in a column in MYSQL

A table in a MYSQL database has address details- eg... add1, add2, add3, district, postalTown, country Ordering by postal town is usually fine, but some details have numbers in the postalTown column. For example 1420 Territet or 3100 Overijse. This will mean these will appear at the top above Aberdeen or Bristol. Is there a way of order...

Connecting to mySQL database from ASP.Net (vb)

HI, I am a fairly experienced ASP developer making the move to ASP.net. I am trying to open a database connection to a MySQL database but I am finding it overly complicated and not at all user friendly. Is there no way to open a database connection, get a recordset and Move, Insert, and Delete on the fly? Is there no .AddNew, .MoveNext...

Can anyone please explain "storing" vs "indexing" in databases?

What is storing and what is indexing a field when it comes to searching? Specifically I am talking about MySQL or SOLR. Is there any thorough article about this, I have made some searches without luck! Thanks ...

Can't make JDBC connection to MySQL (using Java, IntelliJ, and Linux)

I am having issues trying to get a database connection using the code below: try { Class.forName("com.mysql.jdbc.Driver"); Properties p = new Properties(); p.put("user", user_name); p.put("password", password); connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1/jsp_test", p); }...

Importing redefined SQL data from old app to new one.

Hi, I've nearly finished rewriting (with some new features) my Symfony (left a bit bad taste in mounth) application into Rails. There is some amount of data which I need to import from my old application into the new Rails app. Problem is that schema was dramatically changed and some foreign key values should be updated. I am wonder...

VARCHAR as foreign key/primary key in database good or bad?

Is it better if I use ID nr:s instead of VARCHARS as foreign keys? And is it better to use ID nr:s isntead of VARCHARS as Primary Keys? By ID nr I mean INT! This is what I have now: category table: cat_id ( INT ) (PK) cat_name (VARCHAR) category options table: option_id ( INT ) (PK) car_id ( INT ) (FK) option_name ( VARCHAR ) I COU...

Can you do queries against two databases if mysql_select_db was already used?

I have code that in the connection setup selects the database using mysql_select_db(). $link = mysql_connect('localhost', 'user', 'pass'); mysql_select_db("database1"); Can I later run a query against two databases such as: SELECT database1.row, database2.row FROM database1.table, database2.table WHERE database1.row = database2.oth...

Raise an event from MySQL and handle it from VB.NET (or something similar)?

I'm working with MySQL 5.1.39 and Visual Studio 2008 and connecting both with MySQL Connector Net 6.1.2. What I'd like to do is once a MySqlConnection object is created, be able to handle the "event raised" when a field in a specific row in a given table is updated. I mean, when that value in that table has been manually changed or mod...

Mysql on the command line (can't use all keyboard buttons)

Using mysql directly from the command line (running on Ubuntu 9.10, standard bash terminal), I am unable to use certain keyboard buttons like: Delete, Control-(arrow right), Control-(arrow left) Which gets returned to me as: ~;5C;5D respectively. I'm assuming there must be a flag in mysql that fixes this but I have been unable to fin...

My final mysql db, could someone check if the tables are correctly made?

I have these tables: category table: cat_id (PK) cat_name category_options table: option_id (PK) cat_id (FK) option_name option_values table: value_id (PK) option_id (FK) value classifieds table: ad_id (PK) (VARCHAR) something like "Bmw330ci_28238239832" poster_id (FK) cat_id (FK) headline description price etc.... posters table: po...

PHP & MySQL - math and array problems

I'm trying to add all the values from the grade_points field for example 10, 12.5, 2.1 and then divide it by how many times grade points where entered into the database for example 24.6 / 3. I know that $total_rating_points is an array but I don't really know how to convert the array so I can add the total grade points and then divide i...

run two queries on two tables to get one list of results with mysql/php

I have two tables each with a field we will call widgetid. I need to run a query on both tables, that will return a single list of widgetid's from both tables. I have no idea how to do this. What i have now is: $result = mysql_query("SELECT * FROM `inventory` WHERE find_in_set('$serial', items)") or die(mysql_error()); ...

Liquibase diff generates changeset using wrong case on tablenames

I'm performing a diff on a remote mysql database using LiquiBase, and finding that the changeset that is generated uses the incorrect casing for table names (all lowercase). This subsequently causes the update to fail. Liquibase v1.9.5 Database : MySQL Local OS: Windows 7 Remote OS: Ubuntu Am I doing something wrong, or is this a ...

How to handle PDO exceptions

Hi, I'm trying to work with PDO class on php but I have some trouble to find the right way to handle errors, I've wrote this code: <?php // $connection alreay created on a class which works with similar UPDATE statements // I've simply added here trim() and PDO::PARAM... data type $id = 33; $name = "Mario Bros."; $url = "http://ninten...