mysql

PHP security question?

I just wanted to know what are some basic PHP security techniques I should use when creating a web page that accepts articles? I'm fairly new to PHP and was wondering what will hold the fort down until I'm a security expert? ...

SHA function issues

I have this php code from my login.php if (isset($_POST['logIn'])) { $errmsg = ""; $logname = mysqli_real_escape_string($dbc, trim($_POST['usernameIn'])); $logpassword = mysqli_real_escape_string($dbc, trim($_POST['passwordIn'])); $query = "SELECT user_id, username FROM members WHERE username = '$logname' AND password =...

Adding database results to array

Hi all, I am having a mental blank here and cannot for the life of me figure out a solution. My scenario is that I am programming in PHP and MySQL. I have a database table returning the results for a specific orderid. The query can return a maximum of 4 rows per order and a minimum of 1 row. Here is an image of how I want to return th...

Does somebody have a working sample of PHP session_set_save_handler ?

PHP Version 5.1.6 All day trying..I'm breaking my head now... I understand it but can't make it work. I need to store the session data in a mysql database, cause we're balancing the request among 2 servers, so regular sessions wont work... I need to use this function ... session_set_save_handler ... and I cant make it work..any help grea...

MySQL unique clustered constraint not constraining as expected

I'm creating a table with: CREATE TABLE movies ( id INT AUTO_INCREMENT PRIMARY KEY, name CHAR(255) NOT NULL, year INT NOT NULL, inyear CHAR(10), CONSTRAINT UNIQUE CLUSTERED (name, year, inyear) ); (this is jdbc SQL) Which creates a MySQL table with a clustered index, "index kind" is "unique", and spans the t...

Is the syntax written in descrition is correct for MySQL Triggers? will it work?

Is the syntax written in descrition is correct for MySQL Triggers? will it work? CREATE OR REPLACE TRIGGER myTableAuditTrigger 2 AFTER INSERT OR DELETE OR UPDATE ON myTable 3 FOR EACH ROW 4 BEGIN 5 IF INSERTING THEN 6 INSERT INTO myTableAudit (id, Operation, NewName, NewPhone) 7 VALUES (1, 'Insert ', :NEW.N...

CakePHP - get last query run

I want to get the last query CakePHP ran. I can't turn debug on in core.php and I can't run the code locally. I need a way to get the last sql query and log it to the error log without effecting the live site. This query is failing but is being run. something like this would be great: $this->log($this->ModelName->lastQuery); Thanks i...

Creation time of Innodb tables

CRETAE_TIME column of "TABLES" table from INFORMATION_SCHEMA shows the same CREATE_TIME for all my innodb tables. It means all these tables were created between 2010-03-26 06:52:00 and 2010-03-26 06:53:00 while actually they were created a few months ago. Does the CREATE_TABLE field change automatically for Innodb tables? ...

Can my Perl program execute code stored in a database?

Is it possible to save some Perl code in a database then retrieve it using a select statement and then execute that Perl code? I have tried using eval, but that doesn't seem to work. Here is what I'm trying right now and it doesn't seem to work: my $temp = $qryResults[0]; print $temp."\n"; eval{"$temp"}; the output is $con->Disconne...

Datatype query on datetime and tinyint

Hi , I have a Mysql datetime column, what should be the corresponding datatype in a java entity bean class for this column? What would the java-type be for a Mysql tinyint? ...

diff between tables

I have two tables, with the same structure, for example: table "first' with columns 'a','b','c' and table 'second' with the same columns. How to find difference betweet those two tables? Of course, I can make some script on python, that will make set(a)-set(b), but I think there is some way to do it in mysql. UPD: Table 'first' a |...

Query to find the data for every month of last year from the given date using mysql?

I want data for the the last 1 year from the given date For example: I have date 2013-06-01 and I want data as follows also data I want is from three table using Group By or something else Month | Amount | Total_Data June 2013 100 5 May 2013 80 4 - 100 5 - 100 5 July 2012 ...

What are advantages of using a one-to-one table relationship? (MySQL)

What are advantages of using a one-to-one table relationship as opposed to simply storing all the data in one table? I understand and make use of one-to-many, many-to-one, and many-to-many all the time, but implementing a one-to-one relationship seems like a tedious and unnecessary task, especially if you use naming conventions for relat...

Newbie's problems with MySQL and php

I'm a real newbie with php and MySQL. Now I'm working on the following code which should search the database for eg. all the Lennons living in Liverpool. 1) How should I modify "get.php" to get the text "no results" to appear if there are no search results. 2) How should I modify "index.php" to get the option values (city and lastname)...

Using XAMPP Install of MySQL with Netbeans 6.8/MySQL Workbench

All, For all of this I am using Mac OSX Snow Leopard. I have happily used XAMPP to develop PHP backed sites in the past with no problems(as you'd expect for such a simple to set up package). I am now trying to set up this MySQL install in Netbeans 6.8 (for now just trying to get a sample database backed webapp to run). My issue is tha...

How to fetch the data from binary log file and insert in our desired table in MySQL?

How to fetch the data from binary log file and insert in our desired table in MySQL? I am on my way of scripting a PHP code for Audit Trail, in this I encountered a situation that if there will be new table created then I will not be available with triggers for that new table and hence no tracking could be done for that, so if I code i...

Add information through a stored procedure and PHP?

I have a form which contains a lot of elements, my DB guy has generated an SP and now i need to call that stored procedure. My form has twenty elements, when i click on submit the data must be saved in database. I know how to do this on insert query, but how to call an SP and perform this operation. There are 10 tables where the data is...

Is there any way to automatically create a trigger on creation of new table in MySQL?

Is there any way to automatically create a trigger on creation of new table in MySQL? ...

What would be better, (1 database + 4 tables) or (2 databases + 2 tables each) ?

Hi there, I would like to be advised on what would be better (in regards to performance) A) 1 DATABASE with 4 tables or B) 2 DATABASES (same server), each with 2 tables. The tables size and usage are more or less similar, so the 2 tables on Database 1 would be similar usage/size to the 2 tables on database 2 The tables could have...

Step through mysql stored procedure

Is it possible to step through a mysql stored procedure, watching the values of variables at each step. ...