Re: [PHP-DB] mysqldump permissions

2011-06-05 Thread kesavan trichy rengarajan
Give the user show view permission
http://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html#priv_show-view
On 06/06/2011 7:57 AM, Ron Piggott ron.pigg...@actsministries.org wrote:

 I created a VIEW “table” yesterday. Last night when the cron job ran to
back up the database I received this error:


 mysqldump: Couldn't execute 'show create table
`bible_anagrams_rss_feed_summary`': SHOW VIEW command denied to user


 I use the following syntax to do the backup of the database each day
within the context of a cron job:


 date=`date -I` ; mysqldump –uUSER –pPASS --all-databases | gzip 
/home/path/backup_$date.sql.gz


 Even when I have given the mysql backup user all the permissions available
within the control panel of my web site hosting company I still get the same
error. These are the permissions I have available.

 SELECT
 INSERT
 UPDATE
 DELETE
 INDEX
 CREATE TEMPORARY TABLE
 EXECUTE
 CREATE
 ALTER
 DROP
 LOCK TABLES
 REFERENCES
 CREATE ROUTINE

 How to resolve the error?

 Ron

 The Verse of the Day
 “Encouragement from God’s Word”
 http://www.TheVerseOfTheDay.info


Re: [PHP-DB] SELECT WHERE length of content question

2011-03-09 Thread kesavan trichy rengarajan
Have a look at this:
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_char-length

On Thu, Mar 10, 2011 at 9:49 AM, Ron Piggott ron.pigg...@actsministries.org
 wrote:


 Is there a command in mySQL that would allow me to SELECT the rows where
 the `fax` column is more than 11 characters long?

 OR

 Do I need to use PHP to assess this?

 Ron

 The Verse of the Day
 “Encouragement from God’s Word”
 http://www.TheVerseOfTheDay.info



Re: [PHP-DB] Oracle PDO UTF-8 problem

2011-01-13 Thread kesavan trichy rengarajan
Try increasing this: PDO::MYSQL_ATTR_MAX_BUFFER_SIZE

More info here: http://php.net/manual/en/ref.pdo-mysql.php
On Thu, Jan 13, 2011 at 7:23 PM, Karsten Lehmann lehm...@maqsima.de wrote:

 Hello

 I try to read a 2000 character long string out of database. The database is
 an oracle 10g Express Edition with UTF-8 character set. To read the string
 we use the PDO abstraction layer with oci-driver. If the 2000 character
 contains one or more UTF-8 characters we get the problem that PDO truncate
 the result of the database, with the following message:

 Warning: PDOStatement::fetchAll() [pdostatement.fetchall]: column 5 data
 was too large for buffer and was truncated to fit it in
 C:\wamp\www\wp\bp.php on line 115


 The definition of the database column is

 TESTSTRING VARCHAR2(2000 CHAR)

 CHAR means that we can store up to 2000 characters independent from the
 encoding of the character (e.g. UTF8).


 I also init the PDO with UTF8

 $dbh = new PDO('oci:dbname=' . $db_name . ';charset=UTF8', $db_user,
 $db_pw);


 If i read the same string with java and JDBC-driver it works fine, so i can
 exclude a database error.

 How i have to configre PHP/PDO to be aware of the truncation of the result
 string?

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] ON DUPLICATE KEY UPDATE

2010-11-27 Thread kesavan trichy rengarajan
Read through this:
http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html, especially
the last 2 paragraphs.

On Sun, Nov 28, 2010 at 12:40 PM, Ron Piggott 
ron.pigg...@actsministries.org wrote:

 My question is with the syntax below: If the “ON DUPLICATE KEY UPDATE
 `name` = '$name'” occurs will $_SESSION['referral_clients_reference'] be
 populated with the mysql_insert_id() value?  If not, should I just query for
 it?  Ron

 mysql_query(INSERT INTO `referral_clients` ( `reference` , `name` ,
 `paypal_email` , `last_update` ) VALUES ( NULL , '$name', '$paypal_email',
 CURRENT_TIMESTAMP ) ON DUPLICATE KEY UPDATE `name` = '$name';);

 $_SESSION['referral_clients_reference'] = mysql_insert_id();

 The Verse of the Day
 “Encouragement from God’s Word”
 http://www.TheVerseOfTheDay.info


Re: [PHP-DB] Database and Table creation

2010-10-19 Thread kesavan trichy rengarajan
Hi Ethan,

Database Creation: http://www.php.net/manual/en/function.mysql-create-db.php
 http://www.php.net/manual/en/function.mysql-create-db.phpAdding Tables,
Extract Data: http://www.freewebmasterhelp.com/tutorials/phpmysql/1

http://www.freewebmasterhelp.com/tutorials/phpmysql/1Explore the function
list on the left from the first link if you are curious.

Kesavan.

On Wed, Oct 20, 2010 at 9:23 AM, Ethan Rosenberg eth...@earthlink.netwrote:

 Dear List -

 Thanks for your help.

 Using PHP, how do I create a database, add tables to it, then add and
 extract data from the tables.?  Sample code please.

 Please be aware that I am a newbie.

 Ethan



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] finding out if a user left our website ?

2010-08-25 Thread kesavan trichy rengarajan
Have a look at this: https://developer.mozilla.org/en/DOM/window.onunload

https://developer.mozilla.org/en/DOM/window.onunloadBut, as someone
pointed out a few days ago, please do not post stuff that is not related to
PHP DB.

On Thu, Aug 26, 2010 at 6:32 AM, Vinay Kannan viny...@gmail.com wrote:

 Hello Guys,

 Wanted to know if there is a way for us to find out, when a user moves away
 from our website( closing the window and entering a different url in the
 address bar )

 closing the window i guess, we could use the javascript onclose or
 something
 similar but for the user moving away from my website by entering a
 different
 URL is what i would like to be able to find out.

 Thanks,
 Vinay



Re: [PHP-DB] CURDATE

2010-08-16 Thread kesavan trichy rengarajan
Try:
DATE(date_accessed) = CURDATE().

Have a look at this:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_dateto
understand what's happening.

Regards,
Kesavan.

On 17/08/2010 6:26 AM, Ron Piggott ron.pigg...@actsministries.org wrote:

I am wondering why:

SELECT * FROM `bible_concordance_usage` WHERE `date_accessed` = CURDATE()

Doesn't work when `date_accessed` is column type timestamp

And

What would work?

Ron




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with mysql data sorting using php

2010-05-17 Thread kesavan trichy rengarajan
take a look at this:
http://datatables.net/examples/data_sources/server_side.html

On Mon, May 17, 2010 at 5:30 PM, nagendra prasad
nagendra802...@gmail.comwrote:

 Hi Artur,

 I am a beginner to this stuff. So, If you or anyone can give me some
 example
 codes or may be some links for my reference that would be a great help.

 Best,
 Guru.

 On Mon, May 17, 2010 at 12:57 PM, Artur Ejsmont ejsmont.ar...@gmail.com
 wrote:

  Hehe. Then a method: ) just make a query builder method like 'findSongs'
  with all the params ( optional or mandatory ) like page, limit, sortby,
  filters etc. then inside build SQL based on args.  Just be careful - SQL
  injection is your enemy here. From app pass all the args from get/ post
 and
  that's it. Good luck.
 
  On 17 May 2010 08:18, nagendra prasad nagendra802...@gmail.com
 wrote:
 
  DB is like more then 500MB
 
  and it will grow day by day :)
 
 
 
 
 
  On Mon, May 17, 2010 at 12:46 PM, Artur Ejsmont ejsmont.ar...@gmail.com
 
  wrote:
  
   If the DB i...
 
 



Re: [PHP-DB] Updating MySQL Database after install

2010-05-04 Thread kesavan trichy rengarajan
You need to use the ALTER statement.
doc: http://dev.mysql.com/doc/refman/5.1/en/alter-table.html
http://dev.mysql.com/doc/refman/5.1/en/alter-table.htmlexample:
http://www.1keydata.com/sql/sql-foreign-key.html

On Wed, May 5, 2010 at 8:21 AM, Karl DeSaulniers k...@designdrumm.comwrote:

 Hi,
 I am wanting to get some pointers on how to update my MySQL database after
 there is already members.
 For eg, I am trying to set some foreign keys that were not part of my
 database when I installed it.
 There are members in that database. Can I update the database with the new
 .sql file without loosing my current info? If so, how?
 Fields in the user table have not changed except foreign keys have been
 assigned to it.
 TIA,

 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com




Re: [PHP-DB] Calculator

2010-03-16 Thread kesavan trichy rengarajan
http://www.javascriptkit.com/script/cut18.shtml

JS based solution would be the easiest.

On Wed, Mar 17, 2010 at 3:07 PM, Karl DeSaulniers k...@designdrumm.comwrote:

 Hello,
 I have been asked to see if I can set up an online calculator.
 I was wondering if anyone had some pointers on where I can lear/find
 a script that calculates percentages.
 The regular math part I think I can figure out.
 Its not a complicated calc, just basic math and percentages calc, a payment
 calc if you will.
 TIA

 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com




Re: [PHP-DB] Upgrading PHP Version 5.1.6

2010-03-05 Thread kesavan trichy rengarajan
Well, you can always backup your databases through phpMyAdmin (export) or
from commandline using mysqldump just to be on the safer side.

On Sat, Mar 6, 2010 at 12:51 PM, David McGlone da...@dmcentral.net wrote:

 On Friday 05 March 2010 12:35:43 Vinay Kannan wrote:
  Hello,
 
  I am currently using  php version 5.1.6 and now m thinking of upgrading,
 i
  got php installed long time back using WAMP, i wanted to know if theres
 an
  easy way to upgrade directly, without having to remove this version, i
 also
  have a good number of databases, and it would be a pain, if i am required
   to uninstall the current version of wamp and then reinstall the newer
   version.

 I am not experienced at all with WAMP, because I've always used LAMP, but
 I'd
 suspect that WAMP works like LAMP and uninstalling PHP will not remove any
 MySQL tables.

 --
 Blessings
 David M.
 I have been driven to my knees many times by the overwhelming conviction
 that
 I had nowhere else to go.

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Prepared Statement Insert Problem

2009-07-21 Thread kesavan trichy rengarajan
Remove the quotes around the variables in all your statements.
For example, this statement:
mysqli_stmt_bind_param($submitadmin, isss, '$numrows', '$admin',
sha1('$password'), '$email');

could be rewritten as:
mysqli_stmt_bind_param($submitadmin, isss, $numrows, $admin,
sha1($password), $email);

On Tue, Jul 21, 2009 at 8:01 PM, Jason Carson ja...@jasoncarson.ca wrote:

 Hello everyone, I have a problem.

 I use the following to *try* and insert data into my MySQL database...

 //Variables come from a form
 $username= $_POST['username'];
 $password = $_POST['password'];
 $email = $_POST['email'];


 //Connect to the database
 $connect = mysqli_connect($hostname, $dbusername, $dbpassword,
 $database)or die(cannot connect);


 //Find out how many rows in the database
 $aidcount = mysqli_query ($connect, SELECT * FROM administrator);
 $numrows = mysqli_num_rows($aidcount);


 //The next 3 lines are using prepared statements to insert data but the
 //second line ...mysqli_stmt_bind_param.. results in this error...
 //Fatal error: Only variables can be passed by reference in file.php line
 46

 $submitadmin = mysqli_prepare($connect2, INSERT INTO administrator VALUES
 (?, ?, ?, ?));

 mysqli_stmt_bind_param($submitadmin, isss, '$numrows', '$admin',
 sha1('$password'), '$email');

 mysqli_stmt_execute($submitadmin);

 ...anyone know how I can solve this problem so I can insert data into my
 database with prepared statements?


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Re: [PHP] A prepared statements question

2009-07-12 Thread kesavan trichy rengarajan
Why don't using consider using PDO for this purpose? Examples can be found
here: http://au.php.net/manual/en/pdo.prepare.php

On Sun, Jul 12, 2009 at 2:52 PM, Daniel Brown danbr...@php.net wrote:

[Redirected to PHP-DB: php...@lists.php.net]


 On Sun, Jul 12, 2009 at 00:31, Jason Carsonja...@jasoncarson.ca wrote:
  Hello everyone,
 
  I am having a problem getting my prepared statements working. Here is my
  setup...
 
 index.php - authenticate.php - admin.php
 
  1)index.php has a login form on it so when someone enters their username
  the form redirects to another page I call authenticate.php.
 
  2)In the authenticate.php file I want to use prepared statements to
  interact with the MySQL database. I want to compare the username
 submitted
  from the form with the username in the database.
 
  3)If the login username was legitimate then you are forwarded to
 admin.php
 
  Its step 2 I am having problems with. Here is what I have but I don't
  think it makes any sense and it doesn't work.
 
 
  $link = mysqli_connect($hostname, $dbusername, $password, $database);
  $stmt = mysqli_prepare($link, SELECT * FROM administrators WHERE
  adminusers=?);
  mysqli_stmt_bind_param($stmt, 's', $username);
  $result = mysqli_stmt_execute($stmt);
 
  $count=mysqli_num_rows($result);
 
  if($count==1){
  header(location:admin.php);
  } else {
  echo Failure;
  }
 
  Any help is appreciated.
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



 --
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 Check out our great hosting and dedicated server deals at
 http://twitter.com/pilotpig

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Get ID of ROW when using aggregate functions

2009-04-08 Thread kesavan trichy rengarajan
there is  probably a better way to achieve this, but, this is a quick
solution

mysql SELECT * FROM test where sallary IN (SELECT MAX(SALLARY) FROM test
GROUP BY company);
+++---+-+
| id | name   | company   | sallary |
+++---+-+
|  2 | Peter  | Novell|   12000 |
|  3 | Steven | Microsoft |   17000 |
+++---+-+
2 rows in set (0.00 sec)

the answer to your question might lie by looking at this:
mysql SELECT * FROM `test` GROUP BY company;
++---+---+-+
| id | name  | company   | sallary |
++---+---+-+
|  1 | Jane  | Microsoft |   1 |
|  2 | Peter | Novell|   12000 |
++---+---+-+
2 rows in set (0.00 sec)

SQL experts here please enlighten us..


On Wed, Apr 8, 2009 at 6:54 PM, Ondrej Kulaty kopyto...@gmail.com wrote:

 Hi,
 I have following table:

 id int(11)
 name varchar(255)
 company varchar(255)
 sallary int(11)

 CREATE TABLE `test` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `company` varchar(255) NOT NULL,
  `sallary` int(11) NOT NULL,
  PRIMARY KEY (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin2 AUTO_INCREMENT=1 ;

 With rows:

 INSERT INTO `test` (`id`, `name`, `company`, `sallary`) VALUES
 (1, 'Jane', 'Microsoft', 1),
 (2, 'Peter', 'Novell', 12000),
 (3, 'Steven', 'Microsoft', 17000);

 I want to select person from each company with a highest sallary.
 I run this SQL:

 SELECT id,name,company,MAX(sallary) FROM `test` GROUP BY company;

 And result is:

 id name company MAX( sallary )
 1 Jane   Microsoft   17000
 2 Peter  Novell12000

 Why it returned Jane (id 1) as a person with highest sallary (17000) when
 obviously Jane has sallary of 10 000?

 Thanks for any help.



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Retrieving Image Location in MySQL

2009-03-07 Thread kesavan trichy rengarajan
drop the images into a folder within your WAMP servers htdocs
directory and then update your database tables with the new location..
for security reasons you will not be able access files outside your
web directory through PHP

 On Sun, Mar 8, 2009 at 11:34 AM, Sashikanth Gurram sashi...@vt.edu wrote:

 Hi,
 I have tried it in 3 browsers (Chrome, firefox and internet explorer) and 
 none of them has given me any image.
 -Sashi

 Phpster
 wrote

 Bet the image is not readable from the web server.

 Bastien

 Sent from my iPod

 On Mar 7, 2009, at 5:04, Sashikanth Gurram sashi...@vt.edu wrote:

 Hi,

 Yes. But I assign the location of the image ( 
 C:\Users\Sashikanth\Desktop\Bldgs_lots\Burruss.jpg) to the $location 
 variable by using the mysqli_fetch_array($data) command. I send a query to 
 the db and the result is obtained and the image location is stored into 
 $location. So it is pretty straightforward. But I cannot understand why is 
 it not displaying the picture after retrieving the image. Should I use any 
 other additional commands to display the picture? Or do I need any changes 
 in my PHP configuration file?  I have checked the Config file and the ; 
 sign infront of extension=php_gd2.dll has been removed.

 Thanks,
 Sashi



 Hello,

 Does something like this work on your php script?

 $location=..\..\Bldgs_lots\Burruss.jpg

 OR

 $location=..\Bldgs_lots\Burruss.jpg




 GR
 Muhsin



 Sashikanth Gurram wrote:

 This is the location where I have saved  my images.
 /C:\Users\Sashikanth\Desktop\Bldgs_lots\Burruss.jpg
 /I have loaded the above location exactly into my database. But when I
 call it using

 /echo img src='$location' border='1' height='150' width='200'
 alt='$build' ;/

 It is simply giving me some blank empty space, with the name of the
 picture in the blank space (Since I am using alt). So, as I see it,
 the retrieval part is working fine, but the displaying of the image is
 not functioning properly. I am using a WAMP server. Any kind of
 suggestions are welcome.

 Thanks,
 Sashi

 PS: For Reference, I am posting my entire code below again. The image
 retrieval part is towards the end of the code.

 /html
 body
 form action=mysqli.php method=post
 br
 div align=center
 Building Name:select name=name
 option value= Select a Building/option
option value=Military BuildingMilitary Building/option
option value=Monteith HallMonteith Hall/option
option value=New Residence Hall-Career Services SiteNew
 Residence Hall-Career Services Site/option
option value=Williams HallWilliams Hall/option
option value=Women's Softball FieldWomen's Softball
 Field/option
option value=Wright HouseWright House/option
 /select
 /div
  input type=submit /
 /form
 img src=mysqli.php?

 ?php
 // Connects to your Database
 $host=**;
 $user=***;
 $password=;
 $dbname=*;
 $cxn=mysqli_connect($host, $user, $password, $dbname) ;
 if (!$cxn=mysqli_connect($host, $user, $password, $dbname))
  {
  $error=mysqli_error($cxn);
  echo $error;
  die();
  }
 else
  {
  echo Connection established successfully;
  }
 //Define the variables for Day and Month
 $Today=date(l);
 $Month=date(F);
 $build=$_POST[name];
 $low_speed=2.5;
 $high_speed=4;
 $hour=date(G);
 $minute=date(i);
 if ($minute=00  $minute=14)
  {
  $minute=00;
  }
 elseif ($minute=15  $minute=29)
  {
  $minute=15;
  }
 elseif ($minute=30  $minute=44)
  {
  $minute=30;
  }
 else
  {
  $minute=45;
  }
 $times=10:$minute;
 $sql=SELECT buildingname, parking_lot_name, empty_spaces, distance,
 round(distance/($low_speed*60),1) AS low_time,
 round(distance/($high_speed*60),1) AS high_time, Location FROM
 buildings, buildings_lots, parkinglots, occupancy2, Image where
 (buildings.buildingcode=occupancy2.building AND 
 buildings.buildingcode=buildings_lots.building_code AND
 parkinglots.parking_lot_code=buildings_lots.parking_lot_code AND
 parkinglots.parking_lot_code=occupancy2.parking_lot AND
 Buildings.BuildingCode=Image.BuildingCode) AND buildingname='$build'
 AND month='$Month' AND day='Monday' AND Time='$times';
 $data = mysqli_query($cxn,$sql);
 if (!$data=mysqli_query($cxn,$sql))
  {
  $error=mysqli_error($cxn);
  echo $error;
  die();
  }
 else
  {
  echo br;
  echo Query sent successfully;
  }
 echo br;
 echo h1 PARKING LOT INFORMATION h1;
 echo table border='1' cellspacing='5' cellpadding='2';
 echo tr\n
  thBuilding/th\n
  thParking Lot/th\n
  thEstimated Number of Empty Spaces/th\n
  thDistance (Feet)/th\n
  thEstimated walking time to the building/th\n
  /tr\n;
 while ($row=mysqli_fetch_array($data))
  {
  extract($row);
 $building = $row[0];
$parking_lot = $row[1];
$Number_of_Empty_Spaces = $row[2];
$Distance = $row[3];
$time_l = $row[4];
$time_h=$row[5];
$location=$row[6];   echo tr\n
td$building/td\n
td$parking_lot/td\n  
 td$Number_of_Empty_Spaces/td\n

Re: [PHP-DB] Problem with PDO exceptions

2009-03-07 Thread kesavan trichy rengarajan
yup, I have set the  |PDO::ATTR_ERRMODE| attribute to
|PDO::ERRMODE_EXCEPTION|
and I am still not getting an exception!

My Code is something like this:
$query = $db-prepare($sql);
$query-execute($bind);
$row = $query-fetch(PDO::FETCH_ASSOC);

wher $db is the PDO obj and $sql is the sql query and $bind is the bound
parameter

On Sun, Mar 8, 2009 at 5:35 PM, Zoltan Ormandi ormandi.zol...@webfunteam.hu
wrote:
 Hi,

 Did you set the value of the |PDO::ATTR_ERRMODE| attribute to
 |PDO::ERRMODE_EXCEPTION|?

 Btw, I don't think ||prepare would throw an exception even for a malformed
 query, but ||execute definitely should.

 Regards,
 Z




Re: [PHP-DB] Problem with PDO exceptions

2009-03-07 Thread kesavan trichy rengarajan
I am sorry, setting |PDO::ATTR_ERRMODE| attribute to
|PDO::ERRMODE_EXCEPTION|  *does* throw an Exception when the table cannot be
found. Stupid me; I was trying to catch Exception rather than a
PDOException.

On Sun, Mar 8, 2009 at 6:03 PM, kesavan trichy rengarajan k...@trk7.comwrote:

 yup, I have set the  |PDO::ATTR_ERRMODE| attribute to
 |PDO::ERRMODE_EXCEPTION|
 and I am still not getting an exception!

 My Code is something like this:
 $query = $db-prepare($sql);
 $query-execute($bind);
 $row = $query-fetch(PDO::FETCH_ASSOC);

 wher $db is the PDO obj and $sql is the sql query and $bind is the bound
 parameter


 On Sun, Mar 8, 2009 at 5:35 PM, Zoltan Ormandi 
 ormandi.zol...@webfunteam.hu wrote:
  Hi,
 
  Did you set the value of the |PDO::ATTR_ERRMODE| attribute to
  |PDO::ERRMODE_EXCEPTION|?
 
  Btw, I don't think ||prepare would throw an exception even for a
 malformed
  query, but ||execute definitely should.
 
  Regards,
  Z