When table was set up with a column that has a foreign key and is set to cascade (delete child when parent is deleted) what would the sql command to change this to be restrict? (can't delete parent if it has children)
...
If I have a column set up as Boolean in MySql, a query returns the value as either 0 or 1.
Is it possible to do something like this
SELECT `bool_value` AS "yes" OR "no"
What I mean is, return two different strings based on whether it is true or false.
...
dear all..i have this data inside DB:
line model serial
fa01 kd-g335ud 105x0001
fa01 kd-g335ud 105x0002
fa01 kd-g335ud 105x0003 //up to 20pcs or regardless of the number of goods in the db
fa02 kd-r311ed 105x0001
fa02 kd-r311ed 105x0002 //up to 20pcs or regardless of the number of...
Pretty straightforward question.
I use InnoDB for everything else, for a couple of reasons. Is it a performance hit over MyISAM for a 'high-traffic' table?
...
I have a weird problem. When I run this script I get 10 records from the database but they are all exactly the same. I have no idea what I am doing wrong or how to fix it. Please help me.
I have tables AMCMS_highscores , AMCMS_users , AMCMS_games I want to look inside the AMCMS_highscores table, get the last 10 records but only where th...
I have this query, which works...
UPDATE `contacts`
SET `calls_to`=`calls_to`+1
WHERE `contact_no` = '0412345678';
What I also want to do is add a value to the cost field. From my understanding, the way to do this would be...
UPDATE `contacts`
SET `calls_to` = `calls_to`+1,
`cost_to` = `cost_to`+0.25 ...
Do I really need to do mysql_close()? Why or why not?
Is there a trigger that closes the link after mysql_connect even if I don't do mysql_close?
...
hello all...
i have a field inside table inspection,it is inspection_datetime.
the type of field is datetime, so that make the data like yy/mm/dd hh:mm:ss.
my question is how do i do if i want to show date only from the data?
...
Hi,
I have following query on a MySQL DB:
SELECT * , r.id, x.real_name AS u_real_name, u.real_name AS v_real_name, y.real_name AS v_real_name2
FROM url_urlaube r
LEFT JOIN g_users u ON ( r.v_id = u.id )
LEFT JOIN g_users x ON ( r.u_id = x.id )
LEFT JOIN g_users y ON ( r.v_id2 = y.id )
WHERE (
(
FROM_UNIXTIME( 1283205600 ) >= r.from
AN...
Hello, guys.
I have a problem with sql query in php:
select
user, name, outlet, switch, port, vlan, mac, status
from access where
user like '%'
and name like '%'
and outlet like '%'
and switch like '%'
and port like '%'
and vlan like '%'
and mac like '%'
and status like '%'
order by 'user';
When r...
Hello..
I have a database table as follows:
line model serial range serial
fa01 kd-g335ud 105x0001 105x0001-105x0200
fa01 kd-g335ud 105x0002 105x0001-105x0200
fa01 kd-g335ud 105x0003 105x0001-105x0200
fa02 kd-r311ed 105x0001 105x0001-105x0500
fa02 kd-r311ed 105x0002 105x0...
For PCI compliance, is there any recommended Encryption Key Management Software? Open source preferable, but commercial is ok too. Is there a tool or software that provides both?
...
I have a table with autoincrement field, I have for example 1,2,3 values, when I insert 4 and delete it the next will normally be 5. I delete 5 and after a long time , say 1 week when I insert new record the next is again 4.
Can somebody tell me why this happen , why when I insert a new record after a long time its getting the last inse...
hello.i newbie this my first project,I don't know how to resolve any problems about the repetition of data
i have an input page.
it consist of 2 textfield:
Model,
Serial,
and one combobox:
1. line.
i want if there is input twice,
I mean here is a double input data,
will be out warning "data already exists".
how do i do that?i ...
I'm still pretty new with MySQL and I don't know the best way to do this.
I have a table with incremented values, and if the values exceed a certain limit, I'd like to know. So lets say I have this table with a current column and capacity column. A row in current is incremented by user input and I want to know when the value in a curren...
I'm making a KSSN (Korean ID Number) checker in PHP using a MySQL database.
I check if it is working by using a file_get_contents call to an external site.
The problem is that the requests (with Hangul/Korean characters in them) are using the wrong charset.
When I echo the string, the Korean characters just get replaced by question mark...
I have the following code that adds a record to my MySQL database via PHP:
Contact is just a plain string.
$contact = mysql_real_escape_string(stripslashes($_POST["contact"]), $con);
$sql="INSERT INTO custom_downloads (contact) VALUES ('$contact')";
Is this good enough to prevent any sort of SQL injection attacks? What else can I do ...
I get error 1452 when trying to do this:
ALTER TABLE test.potovanja
ADD CONSTRAINT usr_ind
FOREIGN KEY (username)
REFERENCES test.users (username)
(Error Code: 1452 Cannot add or update a child row: a foreign key constraint fails (test., CONSTRAINT #sql-1110_2_ibfk_1 FOREIGN KEY (username) REFERENCES users (username))). Reference key...
Hi folks!
I have a CodeIgniter/PHP Model and I want to insert some data into the database.
However, I have this set in my 'raw' SQL query:
ON DUPLICATE KEY UPDATE duplicate=duplicate+1
I am using CodeIgniter and am converting all my previous in-controller SQL queries to ActiveRecord. Is there any way to do this from within the Activ...
I'm have 5 tables.
First products like:
id | country_ids | category_ids | users_ids
1 | 1,4,6 | 4,5,6,70 | 5,6,9
2 | 5,6,3 | 4,8,2,11 | 1,5,8
Second countries like:
c_id | c_name
1 | Åland Islands
2 | Antarctica
...
Third categories like:
cat_id | cat_name
2 | Small
4 | Large
....