I'm storing a string in mysql with the ENCRYPT() function. I want to fetch a row where that string is matched, but the new ENCRYPT() call gives me a different value, so they never match.
This is expected as i'm not (and can't) give it a consistent salt:
http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html#function_encrypt
...
This is my query for available rooms in choosen period:
SELECT rooms.room_id
FROM rooms
WHERE rooms.room_id NOT IN (
SELECT reservations.room_id
FROM reservations
WHERE ( reservations.arrivaldate >= $arrival_datetime
AND reservations.departuredate <= $departure_datetime
)
OR ( ...
Hi,
I would need simply select the last entered row specified by condition,e.g:
SELECT ID from bugs WHERE user=Me
I need to return only the very last ID entered by user 'Me'. Is there any simple way? Thank you
...
Just a quick question.
Is there any performance difference between using PDO::fetchAll() and PDO::fetch() in a loop (for large result sets)?
I'm fetching into objects of a user-defined class, if that makes any difference.
My initial uneducated assumption was that fetchAll might be faster because PDO can perform multiple operations in ...
How would you go about creating a preview button for a form using PHP & MySQL.
...
I have code as
$db_name = "db";
$outputfile = "/somewhere";
$new_db_name = 'newdb';
$cmd = 'mysqldump --skip-triggers %s > %s 2>&1';
$cmd = sprintf($cmd, escapeshellarg($db_name), escapeshellcmd($output_file));
exec($cmd, $output, $ret);
if ($ret !=0 ) {
//log error message in $output
}
Then to import:
$cmd = 'mysql --database...
is the code given is executable in Windows system? as it seems to be Linux commands
echo 'create database foo2' | mysql -uroot
mysqldump --skip-triggers -uroot foo | mysql -uroot foo2
EDITED
I am executing the following code but I am not getting what I expect..
<?php
mysql_connect('localhost','root','********');
echo 'c...
I have a script that has a GET variable: $_GET['percentage']
I have a MySQL table of data.
Now lets say that there are 100 rows of data in this table.
In pseudo-code:
SELECT data FROM table
Now would it be possible to select $_GET['percentage'] of random data from table?
For example (again in pseudo-code):
$_GET['percentage'] = 10...
I am using the below storedproc to generate the Insert statements of a specified table
It is build-ed without any errors. Now i want to return the result set in "V_string" as output of the SP
DELIMITER $$
DROP PROCEDURE IF EXISTS `demo`.`InsertGenerator` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `InsertGenerator`()
SWL_return...
Any can tell me how to second time auto connect with twitter from my site.
I did... the following CODE
if(empty($outh_key_db)){
$token=$_SESSION['oauth_token'] ;
$outh_secr_db=$_SESSION['oauth_token_secret'];
$con = mysql_connect("localhost","rathin","xxxxxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
...
I have a table where each row has a start and stop date-time. These can be arbitrarily short or long spans.
I want to query the sum duration of the intersection of all rows with two start and stop date-times.
How can you do this in MySQL?
Or do you have to select the rows that intersect the query start and stop times, then calculate ...
Hi,
I want to get some results via query simillar to:
SELECT
* FROM
users LEFT JOIN
IF (users.type = '1', 'private','company') AS details ON
users.id = details.user_id WHERE
users.id = 1
Any ideas?
...
Is there an equivalence of ($)PGDATA (Postgres) for MySQL?
...
I don't know why but the code below is working when I have a different query:
$result = mysql_query("SELECT * FROM student WHERE IDNO='".$_GET['id']."'")
?>
<?php while ( $row = mysql_fetch_array($result) ) {
?>
<?php list($year,$month,$day)=explode("-", $row['BIRTHDAY']); ?>
<tr>
<td width="30" height="35"><font si...
I asked a question yesterday about password safety...
I am new at security...
I am using a mysql db, and need to store users passwords there. I have been told in answers that hashing and THEN saving the HASHED value of the password is the correct way of doing this.
So basically I want to verify with you guys this is correct now.
It i...
Hello,
I am trying to increment a INT column by 1 if a certain field is not null on an update request, currently I have this update too columns,
public function updateCronDetails($transaction_reference, $flag, $log) {
$data = array (
'flag' => $flag,
'log' => "$log"
);
$this->db->where('transaction_refere...
Hi guys,
I am parsing an XML file with PHP and inserting the rows in a MYSQL database.
I am using PHP simplexml_load_files to load the XML and a foreach to loop through the array and insert the rows into my database.
It works perfectly fine with small files i am testing, but it comes to reality I need to parse a large 500mb XML file a...
Hi all,
I don't have phpMyAdmin installed in my web site.
Sometimes I was doing some select SQL command at the backend,
but when I typed in this command to show all records from table Users:
select * from Users;
The records were printed as ???? | ??? ??? ??? |.
I don't want to make any permanent changes to the charset in the datab...
I have the following PHP code that i use to create a database, a user, and grant permissions to the user:
$con = mysql_connect("IP.ADDRESS","user","pass");
mysql_query("CREATE DATABASE ".$dbuser."",$con)or die(mysql_error());
mysql_query("grant all on ".$dbuser.".* to ".$dbname." identified by '".$dbpass."'",$con) or die(mysql_error()...
Hi guys,
I am a newbee to django and jython. I need to create and save image thumbnails in database. I am using django running on jython and mysql database. I was exploring python imaging library, but the i found out that i wont work with jython.
How do i create image thumbnails using jython and then save them in mysql db?? Any kind of ...