Hi,
I've created a MySql function and would like to raise an error if the values passed for the parameters are invalid. What are my options for raising an error within a MySql function?
Thanks,
Don
How do I find out which user entered the most articles and then count how many articles that user entered using PHP & MySQL.
Here is my MySQL tables.
CREATE TABLE users_articles (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT UNSIGNED NOT NULL,
title TEXT NOT NULL,
acontent LONGTEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE users (
user_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
username VARCHAR(255) DEFAULT NULL,
pass CHAR(40) NOT NULL,
PRIMARY KEY (user_id)
);
I was wondering if some one can give me an example on how to delete an image using PHP & MySQL?
The image is stored in a folder name thumbs and another named images and the image name is stored in a mysql database.
This may be a dumb question, but I was just watching a screencast on MySQL replication, and I learned that a master database doesn't send SQL over to a slave for replication, it actually sends data over in binary, which makes importing extremely fast. I started wondering, "if a database can export and import binary, why do mysqldumps / imports take so long?" Is there a way to get mysql to dump a database in binary in a similar fashion to speed up that process as well?
I really want to play around with Liferay,but unfortunately MySQL won't install on my PC running Ubuntu Karmic. Is it ok if i start up LAMPP normally and use its MySQL or the world will fall apart?
i am converting from access to mysql
i have a table in access where one of the columns is an autonumber
when i transfer the data into the mysql database (where i also have a column that is auto_increment), should i be transfering the auto_increment data into the auto_increment column, or will it auto_increment itself?
how do i ensure that if i do not transfer the autoincrement data from access, that it auto_increments properly?
Hello,
How can i generate database diagrams from my database automatically in mysql? I saw mysql workbench and it's very nice except for the fact that it doesn't allow me to copy the diagrams to clipboard and save it in MS Word. Please help.
Thanks in advance :)
So I already have a database setup with a few columns and a few rows already inserted in. I'm trying to create a view that you would just input information into a form and press Submit, then a row would be added to the MySQL database with the information you just typed in.
I believe you can do this with admin, but I would like to try without admin and I'm not sure if this is possible? I've been using the MySQL commandline to add rows as of now..
Hello,
How can I read from mysql and write the same in http output stream.
So its like if send a request http://www.xyz.com/download/A
it should return me data for A from mysql through php.
The data is plain text.
Thanks
PS: I am new to php.
I have some demanding mysql queries that are needed to grap same datasets from several mysql tables.
I am thinking of creating a table or view to gather all demanding columns from other tables, so as to increase performance.
If I create that table, I may need to do extra insert / update / delete operation each time other tables updated.
if I create view, I am worrying if the performance can be greatly improved. Because data from other tables are changing very frequently. Most likely, the view may need to be created first everytime before selecting it.
Any ideas? e.g. how to cache? other extra measures I can do?
I am operating on a (not so) large graph having about 380K edges. I wrote a program to count the number of 3-cliques in the graph. A quick example:
List of edges:
A - B
B - C
C - A
C - D
List of cliques:
A - B - C
A 3-clique is nothing but a triangle in a graph. Currently, I am doing this using PHP+MySQL. As expected, it is not fast enough. Is there a way to do this in pure MySQL? (perhaps a way to insert all 3-cliques into a table?)
Why MySQl don't wont to store unicode character ??? Yes, it is rare hieroglyph, you wouldn't see it in the browser.
UTF16 is U+2B5EE
Warning: #1366 Incorrect string value: '\xF0\xAB\x97\xAE' for column 'ch' at row 1
Is it possible to store this character in MySQL?
When I try to put a value into a DATE field which is invalid, MySQL seems to use 0000-00-00 instead. Is there a way I can do this "check" without updating a DATE field? And to do it from for example PHP?
Like, is there a way I can query the MySQL server and ask "Hey, is this DATE, TIME or DATETIME valid to you?"
Or is there maybe an even better way of doing it?
when I input
mysql -u root -p XXXX dbname < c:/filename.sql
alway get this error "error 1064 <42000:" you have an error in your SQL suntax; check the manual that corresponds to your MySql server version for the right syntax to use near .....
what is wrong with this statement?
I'm porting some stored procedures from Informix to MySQL, but I have two stored procedures on Informix that have same name and different parameters.
In MySQL, I can't create two SP with the same name, and also can't create a SP with default values in parameters.
so, do someone out there know any hackery or black magic that may help me solve this problem?
thanks.
on a test for Java-MySQL-Restlet application, I write to database at 4reqs/second for 120 seconds.
In this write I insert a row that has foreign key which has the same value for all rows, and this exception occurs:
Could not recover transaction. Original exception follows. com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'idPxxx' at row 1
Only 5% of requests fails to this exceptions, others works.
Regards
Hi all,
I have the following table.
mysql> select * from consumer2;
SERVICE_ID SERVICE_TYPE CONSUMER_FEEDBACK
31 PRINTER 1
32 PRINTER -1
33 PRINTER 0
34 PRINTER -1
35 PRINTER 0
31 PRINTER 0
32 PRINTER 1
35 PRINTER 1
31 PRINTER 0
From the above table i need to select the bottom 4 values using mysql
i need to get the output as follows
SERVICE_ID SERVICE_TYPE CONSUMER_FEEDBACK
31 PRINTER 0
32 PRINTER 1
35 PRINTER 1
31 PRINTER 0
Please help me.Thank u in advance.
is there an equivalent of oracle's rowid in mysql?
delete from my_table where rowid not in (select max(rowid) from my_table group by field1,field2)
I want to make a mysql equivalent of this query!!!
What i'm trying to do is, : The my_table has no primary key.. i'm trying to delete the duplicate values and impose a primary key (composite of field1, field2)..!!
I'm trying to select the order total sum ($) and invoice count over a 5 day period in a single query. I can't seem to get this to happen though. The current query I have is here...
SELECT
COUNT(id) as invoice_count,
SUM(orderTotal) as orders_sum,
UNIX_TIMESTAMP(created) as created
FROM ids_invoice
WHERE DATE_ADD(created, INTERVAL +1 DAY)
AND userId = '.$userId.$whereSql
I'm not entirely sure DATE_ADD is the right function I'm looking for
I'm fairly new to mysql date functions so perhaps I just missed the function I needed when going through mysql docs.
I am Looking for a Function that insert "Any" form values to mysql, update or delete.
(not OOP)
I have found a function here:
http://tr.php.net/manual/en/function.mysql-query.php
Thanks in advance
I have table with advertisement in MySQL. I would like to rotate banners by order (NOT RANDOM). What function or mechanism I need to SELECT advertisement from MySQL table to show it in order, like 1, then 2, then 3 ... then again 1,2,3... ?
My import of sql via the mysql console is rather slow and as our sql file is increasing every day I would like to know if there are any alternatives on how to import a sql file faster.
Changing to oracle or other systems is no option, the configuration has to stay the same.
Currently the sql file is: 1.5 Gb
I'm on Wamp with Apache 2.2.14, PHP 5.2.11 and MySQL 5.1.41.
Any suggestions?
This question is about Mysql Binary logging.We need to move the Binary logging to a different hard disk . What is the configuration change required in Mysql?.Currently Binary logs go into the same folder as the ibdata and there is a replication slave running which needs the binary logs