I work with several different databases and find myself trying connecting to these quite often to test a query. I use the database specific tools to connect to the DB and run the query.
I find these DB specific tools like SQL Query Analyzer (SQL-Server), Oracle Enterprise Manager, MySQL Query Browser to be quite clunky and slow when it ...
In a MySQL database, I have a table which contains itemID, itemName and some other fields.
Sample records (respectively itemID and itemName):
vaX652bp_X987_foobar, FooBarItem
X34_bar, BarItem
tooX56, TOOX_What
I want to write a query which gives me an output like:
652, FooBarItem
34, BarItem
56, TOOX_What
In other words,...
Hi,
I have a Java webapp using Hibernate and MySQL. If the site isn't used for a few days, the MySQL connection goes stale, and I am met with the following exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state.
From experience using...
I would like to embed HTML inside a PHP if statement, if it's even possible, because I'm thinking the HTML would appear before the PHP if statement is executed.
I'm trying to access a table in a database. I created a pulldown menu in HTML that lists all the tables in the database and once I select the table from the pulldown, I hit the...
When I run an sql query using the ZF wrappers, all the numeric values return as strings.
What do I need to change so the values will return in the same data type as they are in the DB?
...
I have a really simple function:
function experience_query($id) {
$sql = @mysql_query(
"
SELECT * FROM table WHERE id = $id
");
return("$sql");
}
When I call this function:
$q = categories_query("1001");
while( $list = mysql_fetch_assoc($q) )
{
extract($list);
echo $name;
}
I am getting an error" "mysql_fetch_assoc(): supplied arg...
Quick question what's the correct way to use ResultSet and PreparedStatement to access an ENUM field in MySQL?
...
I have one table packets
packets contains 2 fields id and total
they are both bigint length 20 and primary keys
only id is auto increment
in every record total = id
i got 10000 records let's say id = 1 - 10000 and total = 1 - 10000
i got 2 almost identical queries 1 results in a very very long loading time and one completes almost...
When using the SQL MIN() function, along with GROUP BY, will any additional columns (not the MIN column, or one of the GROUP BY columns) match the data in the matching MIN row?
For example, given a table with department names, employee names, and salary:
SELECT MIN(e.salary), e.* FROM employee e GROUP BY department
Obviously I'll get...
This is a follow up on another problem i had with getting-the-last-record-inserted-into-a-select-query
I am trying to edit a query that Andrea was kind enough to help me with yesterday which works fine for one page but I am trying to create a similar query without much luck.
What I need to to is for every board display the board name, ...
I know how to pipe one MySQL query into another:
SELECT user_name FROM users WHERE user_id=( SELECT user_id FROM entries WHERE header="foo" );
Out of pure intellectual curiosity, how I dynamically choose a column or a table?
Ex:
SELECT (
SELECT column_name FROM column_names WHERE id = 1
) FROM (
SELECT table_name FROM tab...
I have something similar to the following:
SELECT c.id
FROM contact AS c
WHERE c.id IN (SELECT s.contact_id
FROM sub_table AS s
LEFT JOIN contact_sub AS c2 ON (s.id = c2.sub_field)
WHERE c2.phone LIKE '535%')
ORDER BY c.name
The problem is that the query takes a very very very long time (>2minutes), but if I take the ...
I have a long-running process in MySQL. It has been running for a week. There is one other connection, to a replication master, but I have halted slave processing so there's effectively nothing else going on.
How can I tell if this process is still working? I knew it would take a long time which is why I put it on its own database in...
Hi All,
I am working on a development copy of a MySQL / InnoDB database that is about 5GB.
I need to restore it pretty frequently for testing alter scripts, and using the mysqldump file is taking quite a while. The file itself is about 900MB and takes around an hour to load in. I've removed data inserts for unimportant tables, and do...
Problem: My articles have the right urls: for example, newsite.com/article. However, by clicking an article I get an empty article. I can see my sidebar.
I moved my Joomla installation to a different folder in my server.
I want to change my domain from OldSite.com to NewSite.com.
I am not sure whether I need to change the database or n...
It is pretty standard practice now for desktop applications to be self-updating. On the Mac, every non-Apple program that uses Sparkle in my book is an instant win. For Windows developers, this has already been discussed at length. I have not yet found information on self-updating web applications, and I hope you can help.
I am building...
Hi all,
Im actually new to using this function.. and was using preg_replace and addslashes previous to finding it.
I'm mostly curious, because Im about to go through, and tighten security in the posting areas in my first large app, and wanted to know the best instances where this function is effective, and highly recommended. I've seen ...
Hiya,
I've been asked to support and take on a PostgreSQL app, but am a MySQL guy - is this a realistic task?
...
Im getting this error when Im trying to update data in the database.
this is my database.php file
<?php
$db_name = "db";
$db_server = "localhost";
$db_user = "xxxx";
$db_pass = "zzzzzzzzz";
$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name)
or die(mysqli_error());
?>
update.php
<?php
require 'database.php';
$...
I'm hitting some quite major performances issues due to the use of "ORDER BY"-statements in my SQL-code.
Everything is fine as long as I'm not using ORDER BY-statements in the SQL. However, once I introduce ORDER BY:s in the SQL code everything slows down dramatically due to the lack of correct indexing. One would assume that fixing th...