Can you please give me advise? I searched for questions but did not found something similiar to mine.
How do i make my user inputs automatically escaped when they are intended to use in SQL queries? I don't like in my code filled with something like
$var_x = $DB->Escape($_POST['var_x']);
$another_var = $DB->Escape($_POST['another_var']...
SELECT totalAmount
FROM tbl
BETWEEN 'date1' AND 'date2'
GROUP BY DATE(date created)
ORDER BY DATE(date created)
That gives me the total amount per day that is in the table. But what I want is the incremental value compared to the previous entry (not necessarily the previous day)
The table might be something lik...
I have a problem querying multiple tables in MySQL and am currently at my wits end.
I have unique IDs in each table, and am using an INNER JOIN to combine them; I am quite new to SQL and this may be the wrong method, hence me posting here:
Query:
SELECT res.UserID, res.QuizID, res.QuizResult, u.UserID, u.UserLogin, q.QuizID, q.QuizNam...
Hello,
I have been looking for a while now but I can not find an easy solution for my problem. I would like to duplicate a record in a table, but of course, the unique primary key needs to be updated.
I have this query:
INSERT INTO invoices
SELECT * FROM invoices AS iv
WHERE iv.ID=XXXXX ON DUPLICATE
KEY UPDATE ID = (SELECT MAX(ID)+1 F...
Hey Guys! I found you all very helpful.
I am using MySql 5.1 and Java. I have a big XML file and need to fill the data of XML file to MySql table.
For MySQL 5.1 there is a procedure (Using XML in MySQL 5.1 and 6.0), but when I try it in my database, it shows no error but on the same side it has no effect. Can anybody help me?
It will ...
There is a statement in the MySQL Docs (http://dev.mysql.com/doc/refman/5.0/en/adding-udf.html) that is bothering me:
"A UDF contains code that becomes part of the running server, so when you write a UDF, you are bound by any and all constraints that otherwise apply to writing server code. For example, you may have problems if you at...
I've installed MySQL as part of XAMPP.
While attempting to set up replication, I've added the following lines to c:\windows\my.ini:
[mysqld]
log-bin=C:/mysql-bin
server-id=1
As you can see, I've specified a full path name for the logging file, so there should be no doubt about where it is. I've also used a forward slash as recommended...
Hello,
I have an scenario with two MySQL databases (in UTF-8), a Java code (a Timer Service) that synchronize both databases (reading form first of them and writing/updating to second) and a Web application that lets modify data loaded in the second database.
All database access are made using IBATIS (but I detect that I have the sam...
I'm trying to add a row to an InnoDB table with a simply query:
INSERT INTO zip_codes (zip_code, city) VALUES ('90210', 'Beverly Hills');
But when I attempt this query, I get the following:
ERROR 1114 (HY000): The table `zip_codes` is full
Doing a "SELECT COUNT(*) FROM zip_codes" gives me 188,959 rows, which doesn't seem like too m...
I try to increment a field in mysql but it seems that it is not really working for some reasons ...
That is the query I run in mysql query:
UPDATE profil_perso
SET profile_views = profile_views +1
WHERE id = 30537
In the status bar it says : 1 row affected by the last command. No resultset returned. But it didn't seemed to work. At f...
MySQL seems to have an 8 hour time out on its connections. I'm running multiple WARs in Tomcat utilizing Hibernate for ORM. After 8 hours (i.e. overnight), I get broken pipes when it picks up an idle connection.
I've already traced through the code and made doubly sure I commit or roleback all transactions.
Here is my hibernate.cfg.x...
I am getting the following error:
mysql_connect(): Too many connections
It has completely shut down my site, which has been running seamlessly for several years.
Note: I have shared hosting with GoDaddy.
How do I fix this?
ALSO: is there a way to close all connections and restart when on a shared hosting plan?
...
These are tables I have:
Class
- id
- name
Order
- id
- name
- class_id (FK)
Family
- id
- order_id (FK)
- name
Genus
- id
- family_id (FK)
- name
Species
- id
- genus_id (FK)
- name
I'm trying to make a query to get a list of Class, Order, and Family names that does not have any Species under them. You can see that the table ha...
I am trying to import a large CSV file into a MySQL database. I have loaded the entire file into one flat table. i can select the data that needs to go into separate tables using select statements, my question is how do i copy the results of those select queries to different tables. i would prefer to do it completely in SQL and not have ...
I'm designing a very simple (in terms of functionality) but difficult (in terms of scalability) system where users can message each other. Think of it as a very simple chatting service. A user can insert a message through a php page. The message is short and has a recipient name.
On another php page, the user can view all the messages ...
i have a date in this format
May 30 2006 12:00AM
is there a equivalent of strtotime() in mysql that will let me convert this to a mysql date?
...
I am using a mysqli prepard query with php, the code is:
$retreiveQuery = 'SELECT username, firstname, lastname FROM USERS WHERE username = ?';
if ($getRecords = $con->prepare($retreiveQuery)) {
$getRecords->bind_param("s", $username);
$getRecords->execute();
$getRecords->bind_result($username, $firstname, $lastnam...
I am pretty new to PHP programming so I apologize if I am missing the obvious.
I have a site hosted at GoDaddy (Windows, PHP5, MySQL 5). I read this article: GoDaddy FAQ and created a php5.ini file in the root folder but when I try to connect to the database, I get the following error:
Fatal error: Call to undefined
function mysq...
There's a comment in another question that says the following:
"When it comes to database queries,
always try and use prepared
parameterised queries. The mysqli and
PDO libraries support this. This is
infinitely safer than using escaping
functions such as
mysql_real_escape_string."
Source
So, what i want to ask is: Why...
I was wondering if anyone has a suggestion for what kind of storage engine to use. The programs needs to perform a lot of writes to database but very few reads.
[edit] No foreign keys necessary. The data is simple, but it needs to preform the writes very fast.
...