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
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.
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?
Is there a good open source or reasonably priced EER modeling tool for MySQL besides MySQL Workbench? I find the MySQL Workbench interface to be clunky. I would like to be able to manage my production schema beginning all design changes in the EER and propogating those out to my schema for created and altered tables. Is anyone use a tool they love to manage their environments in this way?
Thanks. - Nick
When using MySQL 5.1 Enterprise after years of using other database products like Sybase, Infomix, DB2; I run into things that MySQL just doesn't do. For example, it can only generate an EXPLAIN query plan for SELECT queries.
What are the other things I should watch out for?
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..
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?
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)
);
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 a mySQL table which the data in one of its columns is in a language other than English.(Persian)
when i input data in the table , it is shown properly but when i want to show the data in a php file it displays like this:????
well,what should i do in order to show the data in its correct form?
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
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.
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.
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?)
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?
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?
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.
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... ?
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?
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?
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)..!!
Using an array like this:
$data = array
(
'host' => 1,
'country' => 'fr',
)
I would like to create a MySQL query that uses the values of the array to form its WHERE clause like:
SELECT *
FROM table
WHERE host = 1 and country = 'fr'
How can I generate this query string to use with MySQL?
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?