I am implimenting role based access control in a tree structure (organization) that normally would be stored in LDAP but this time is in MySQL. Part of my requirement is to give people acccess to part of the tree. In LDAP I would use a ACI to filter part of the tree. I am just not sure on the best way to do this in PHP/MySQL.
What is th...
I have a timestamp field in my table. How do I delete records older than 10 minutes old?
Tried this:
DELETE FROM locks WHERE time_created < DATE_SUB( CURRENT_TIME(), INTERVAL 10 MINUTE)
Didn't work. What am I doing wrong?
EDIT: I used this code:
SELECT time_created, CURRENT_TIMESTAMP, TIMESTAMPDIFF( MINUTE, time_created, CURRENT_TIM...
I'm having a little practice regarding mysql stored procedures.
Here is the php file which calls it:
<?php
include('conn.php');
$cor=$_POST['course'];
$sql="CALL list('$cor')";
$result=mysql_query($sql);
?>
<table>
<tr>
<th>Name</th>
<th>Course</th>
</tr>
<?php
while($row=mysql_fetch_assoc($result)){
?>
<tr>
<td><?php echo $row['N...
I have a table with about 35 million rows. each has about 35 integer values and one time value (last updated)
The table has two indexes
primary - uses two integer values from the table columns
Secondary - uses the 1st integer from the primary + another integer value.
I would like to delete old records (about 20 millions of them) accordi...
Hi, in my php5 code i want to use the UNIX_TIMESTAMP function to convert a datetime to a unix timestamp without using php code to convert as i believe this way is quicker but how do you then get the unix timestamp out of the rowset ie how to index into the rowset
to get the integer unix timestamp out
Below is a summary of the database s...
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
$row = mysql_fetch_array($result, MYSQL_ASSOC) //it's not increase ?
}
i want increase two time in each loop?
for
<table>
<td>**1 times**</td><td>**1 times**</td>
</table>
...
This is a bit of an oddball question. I'm aware of using memcached to cache "read heavy" data in memory, but is it possible todo the same for writes?
For example: You have a chunk of data in memory (in memcached) and if you have to make any changes to that data, you make it in memory itself. At the end of a certain time period (hour, or...
I was wondering,
What will be my motivation to use constraint as foreign key in MySQL, as I am sure that I can rule the types that are added?
Does it improve performance?
...
I am using Hibernate and MySql.
I have a 2 tables:
User: id, name, type
City: id, name, type
type: id, name
Where user.type has foreign key to user_type.id. and as well city.
I would like before deleting a row in user_type table, to check if any row from any table is related to it.
my columns are mapped for example:
@ManyToOne(fet...
Hello all,
I have just exported a table using phpMyAdmin and I have tried to import this table into my local database by importing the sql file I have just exported. After phpMyAdmin imports 330 rows of the 15,000. It says:
1054 - Unknown column 'font_name' in
'field list'
How can anything go wrong, I thought it was straight for...
code-
$q="SELECT * FROM tbl_quevote WHERE que_id = '".$qid."' and voteby='".$uid."'";
$result = $mysqli->query($q) or die(mysqli_error($mysqli));
$num_rows = mysql_num_rows($result);
echo $num_rows;
Error:
Warning: mysql_num_rows() expects parameter 1 to be resource, object given in C:\xampp\htdocs\shizin\voting.php on line 13
how t...
I am writing a nested MySQL query where a subquery returns more than one row and hence the query can't be executed.
Can anyone suggest me a solution for this problem.
Thanks in advance.
...
I have a problem with character encoding when using subsonic (3.0.4) and mysql (5.1).
I don't know how to specify ISO 8859-2/Latin2 encoding in SubSonic.
...
Hi all,
after googling for a long time, I decided to ask this:
I've uploaded a site to a shared hosting that does not allow remote DB connection due to security issues (according to them).
the Data is very important to me and I'd like to back it up automatically on a daily basis (in addition to the hosts daily backup).
I'm writing the ...
I'm building a small application and setting up foreign key relationships between tables. However I'm confused as to WHY I really need this? What is the advantage - does it assist me when writing my queries that I don't have to perform any joins? Here's an example snippet of my database:
+-------------------+
| USERS |
+----...
I am creating a web base application using PHP and MySQL. I want it to be able to save any kind of user input characters, both English and non-English characters like Arabic or Japanese at the same time.
What should I do to achieve that?
...
I'm using jQuery and $.post(). My code snippet is as follows for chat .php :
<?php
$msg=$_POST['msg'];
mysql_connect("localhost","root");
mysql_select_db("user");
mysql_query("INSERT INTO space (name,msg,serial) VALUES('Test','$msg','1')");
?>
and here is the code for my HTML file :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran...
How to convert second select statement result to CSV String in main select statement ?
assume following SQL statement:
SELECT A1,A2, (SELECT aCol FROM Table2) as A3
FROM Table1
Now, I want to convert result of SELECT aCol FROM Table2 to CSV string that show at A3 field.
such as :
A1Value | A2Value | A3Value1, A3Value2, A3Value3
th...
CREATE TABLE profile_category (
id mediumint UNSIGNED NOT NULL AUTO_INCREMENT,
pc_name char(255) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY idx_name (name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
This is one of the tables in database that is entirely in utf8 charset. The problem is here (and I didn't new about it until now) that inde...
Hi,
I am looking for a message/queuing solution for my web based system running on Ubuntu.
The system was built on the following technologies:
Javascript (Extjs framework) - Frontend
PHP
Python (Daemon service which interacts with the encryption device)
Python pyserial - (Serial port interactions)
MySQL
Linux - Ccu...