RE: [PHP-DB] Institute

2004-11-09 Thread Murray @ PlanetThoughtful
 May you pls. suggest me a good institute for learning PHP AND MYSQL in and
 around Delhi or Noida (INDIA). preferably Noida.

I don't know what the availability of training is like in your area, but if
you find training difficult to find, there are several good textbooks that
take you from beginner to intermediate level in PHP / MySQL programming.

In particular, I thought PHP and MySQL Development
(http://www.amazon.com/exec/obidos/tg/detail/-/0672326728/qid=1099987465/sr=
1-3/ref=sr_1_3/102-3608246-4128963?v=glances=books) was particularly good,
but others on the list may be able to recommend more appropriate textbooks.

Book like this, coupled with the ability to ask questions in this and MySQL
lists, make a great way to learn the language / environment.

Much warmth,

Murray
http://www.planetthoughtful.org

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



[PHP-DB] Executing SQL query with ODBC

2004-11-09 Thread Petrus Ali Saputra
Here is my code:
$conn = odbc_connect(Ta Fara,,);
$query = SELECT * FROM Config;
$result = odbc_exec($conn, $query);
echo odbc_num_rows($result);
This code never give me a 0 result even there is some data. How can I 
solve it? Thank you.
--
Petrus Ali Saputra
==
Addr. : Karang Empat Besar 76
Surabaya 60133
East Java, Indonesia
Phone : 62-31-381-7866
62-31-6010-2653
62-81-23000-254
--
A professional web hosting for your business and corporate
URL   : http://attractive.as/hostmania
--
Mau kredit mobil baru/bekas dengan bunga rendah?
URL   : http://fantastic.as/kreditmobil

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


Re: [PHP-DB] Executing SQL query with ODBC

2004-11-09 Thread Simon Rees
Hi

Most databases don't return the number of rows in the results of a select 
statement to odbc_num_rows. See:

http://www.php.net/manual/en/function.odbc-num-rows.php

Usually the way to determine the number of rows a select returns is to 
either fetch them all and count them or do an additional aggregate query. 
It depends on your requirements.
I presume that this behaviour is because in most cases the database engine 
does not make the number of rows in a result set available to the driver. 
The only way the php interface could calculate the number of rows would be 
to fetch them all which may be inefficient - say if you were only 
interested in the first row out of a possible 100. [anybody else care to 
comment?]

Note, after an insert, update and delete statements odbc_num_rows does 
return the number of rows affected.

cheers Simon

On Tuesday 09 November 2004 08:09, Petrus Ali Saputra wrote:
 Here is my code:
 $conn = odbc_connect(Ta Fara,,);
 $query = SELECT * FROM Config;
 $result = odbc_exec($conn, $query);
 echo odbc_num_rows($result);

 This code never give me a 0 result even there is some data. How can I
 solve it? Thank you.
 --
 Petrus Ali Saputra
 ==
 Addr. : Karang Empat Besar 76
  Surabaya 60133
  East Java, Indonesia
 Phone : 62-31-381-7866
  62-31-6010-2653
  62-81-23000-254
 --
 A professional web hosting for your business and corporate
 URL   : http://attractive.as/hostmania
 --
 Mau kredit mobil baru/bekas dengan bunga rendah?
 URL   : http://fantastic.as/kreditmobil

-- 
~~
Simon Rees  |  [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



RE: [PHP-DB] session_destroy();

2004-11-09 Thread Norland, Martin
session_regenerate_id is what you're looking for

http://us2.php.net/manual/en/function.session-regenerate-id.php

Note that it keeps the session data, so you still need to
session_destroy if you want to purge the data.


- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Chris Payne [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 09, 2004 12:00 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] session_destroy(); 


Hi there everyone,

 

I need to destroy a session in the browser so when they log out it
clears all the session data from the browser, I have tried:

 

session_destroy();

 

But it doesn't seem to do it as the browser keeps the same PHPSessionID.

 

What is the best way to destroy a session and generate a new sessionid
without having to close the browser and go back again?

 

Chris


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.791 / Virus Database: 535 - Release Date: 11/8/2004
 

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



RE: [PHP-DB] Question

2004-11-09 Thread Norland, Martin
Does your form tag have enctype=multipart/form-data ?

e.g.
form action=?php echo($_SERVER['REQUEST_URI']) ? method=post
enctype=multipart/form-data

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Jacob Hackamack [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 08, 2004 11:54 PM
To: PHP Databases
Subject: [PHP-DB] Question


Hello,

I am using PostNuke and have decided to create a page for a local
basketball team.  I have this as the create team function:


//
/// Create a new Team for the given Tournament
///
/// Parameters:
/// 'cid' = Tournament ID
///'team' = Team name
/// 'contact' = name of the team representative
///   'email' = representative's email
///'homepage' = team's Homepage
//
function standings_admin_createteam($args)
{
// Get parameters from whatever input we need.
list($lid,$cid,$team,$city,$shorts,$tshirt,$shortsa,$tshirta,
 $contact,$phone,$paddress,$email,$homepage,$penpts,$picturet)
 = 
pnVarCleanFromInput('lid','cid','team','city','shorts','tshirt','shortsa
','t
shirta',
   
'contact','phone','paddress','email','homepage','penpts','picturet');

// Admin functions of this type can be called by other modules.
extract($args);

// Confirm authorisation code.
if (!pnSecConfirmAuthKey()) {
pnSessionSetVar('errormsg', _BADAUTHKEY);
pnRedirect(pnModURL('Standings', 'admin', 'viewteams',
array('lid' = $lid)));
return true;
}

$modid  = pnModGetIDFromName('Standings');
$modinfo= pnModGetInfo($modid);
$picenable  = pnModGetVar('Standings', 'picenable');

// Notable by its absence there is no security check here.  This is
because
// the security check is carried out within the API function and as
such we
// do not duplicate the work here

// Load API.
if (!pnModAPILoad('Standings', 'admin')) {
pnSessionSetVar('errormsg', _LOADFAILED);
return $output-GetOutput();
}

// The API function is called.
$tid = pnModAPIFunc('Standings','admin','createteam',
array('lid' = $lid,
  'team'= $team,
  'city'= $city,
  'shorts'  = $shorts,
  'tshirt'  = $tshirt,
  'shortsa' = $shortsa,
  'tshirta' = $tshirta,
  'contact' = $contact,
  'phone'   = $phone,
  'paddress'= $paddress,
  'email'   = $email,
  'homepage'= $homepage,
  'penpts'  = $penpts));

// The return value of the function is checked here
if ($tid != false) {
// Success
pnSessionSetVar('statusmsg', _STANDINGSTEAMCREATED);
}


/*
if ($picenable == 1) {
// manage picture Upload if there is a picture sent - Portrait if
($picture!=) { $picname = $_FILES['picture']['name'];

with:

if ($picenable == 1) {
// manage picture Upload if there is a picture sent
// make Portrait photo first
$picname = $_FILES['picturep']['name'];
if ($picname != ) {

*/
if ($picenable == 1) {
// manage picture Upload if there is a picture sent
// make Portrait photo first
   $picname = $_FILES['picturet']['name'];
   if ($picname != ) {
$pictype = $_FILES['picturet']['type'];
$picsize = $_FILES['picturet']['size'];
   $pictemp = $_FILES['picturet']['tmp_name'];
$picdest =
modules/.$modinfo['directory']./pnimages/photos/teams/team.$tid..jp
g;
   $picmax = pnModGetVar('Standings', 'picmaxt');
   $picwidth = pnModGetVar('Standings', 'xsizet');
   $picheight = pnModGetVar('Standings', 'ysizet');
   $picqual = pnModGetVar('Standings', 'picqualt');

   $picerror = ;
   // check if file is of the right type (jpg - gif - png) - Set in
config???
   if ($pictype != image/pjpeg) {
  $picerror = _STANDINGSPLAYERPICTERR1;
   }
   if ($picsize  $picmax) {
  $picerror = _STANDINGSPLAYERPICTERR2;
   }
   if ($picerror == ) {
  $g_is=getimagesize($pictemp);
  if(($g_is[0]-$picwidth)=($g_is[1]-$picheight)) {
  $g_iw=$picwidth;
  $g_ih=($picwidth/$g_is[0])*$g_is[1];
  } else {


  $g_ih=$picheight;
  $g_iw=($g_ih/$g_is[1])*$g_is[0];
  }

  $img_src = imageCreateFromJpeg($pictemp);
  $img_dst = imageCreateTrueColor($g_iw,$g_ih);
  imageCopyResampled($img_dst, $img_src, 0, 0, 

[PHP-DB] Re: session_destroy();

2004-11-09 Thread Sebastian Mendel
Chris Payne wrote:
I need to destroy a session in the browser so when they log out it clears
all the session data from the browser, I have tried:
session_destroy();
But it doesnt seem to do it as the browser keeps the same PHPSessionID.
What is the best way to destroy a session and generate a new sessionid
without having to close the browser and go back again?
the session_id and the session-data is not the same, the session-data is 
destroyed with session_destroy() but the session_id is kept within a 
cookie (or as an url-parameter)

you can php tell to user another session_id, but this changes nothing 
than the id, it makes no sense for you, except you saved the session_id 
in any logging-facility and thats the reason why you always need a new 
session_id.

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


[PHP-DB] mysqldump

2004-11-09 Thread Aaron Todd
I have created a PHP script that looks like:

?php
  $filename = /var/www/html/db_backup_ . date(n-j-y)..sql;
  exec('mysqldump -u * -p* database  $filename');
?

For some reason this doesnt work and I cant figure out why.  There is no 
error that comes back.  When I run the mysqldump command from the server 
console it produces the file fine.  I have read a few other posts out there 
about this same thing which resulted in the location the file was being 
saved.  But I have gone through my server and found nothing.  Does anyone 
have any suggestions for regarding this.

Thanks,

Aaron 

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



Re: [PHP-DB] mysqldump

2004-11-09 Thread David Orlovich
I wonder if you need to specify the full pathname for mysqldump - when 
it's being executed by a script it may not know where mysqldump is, 
whereas if you execute it yourself your PATH tells it where to go, 
which might be why it works under that circumstance.  HTH, David.

On 10/11/2004, at 6:59 AM, Aaron Todd wrote:
I have created a PHP script that looks like:
?php
  $filename = /var/www/html/db_backup_ . date(n-j-y)..sql;
  exec('mysqldump -u * -p* database  $filename');
?
For some reason this doesnt work and I cant figure out why.  There is 
no
error that comes back.  When I run the mysqldump command from the 
server
console it produces the file fine.  I have read a few other posts out 
there
about this same thing which resulted in the location the file was being
saved.  But I have gone through my server and found nothing.  Does 
anyone
have any suggestions for regarding this.

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


Re: [PHP-DB] mysqldump

2004-11-09 Thread David Orlovich
also ... I notice you have a space after the -u - should that be 
there?  David.

On 10/11/2004, at 6:59 AM, Aaron Todd wrote:
I have created a PHP script that looks like:
?php
  $filename = /var/www/html/db_backup_ . date(n-j-y)..sql;
  exec('mysqldump -u * -p* database  $filename');
?
For some reason this doesnt work and I cant figure out why.  There is 
no
error that comes back.  When I run the mysqldump command from the 
server
console it produces the file fine.  I have read a few other posts out 
there
about this same thing which resulted in the location the file was being
saved.  But I have gone through my server and found nothing.  Does 
anyone
have any suggestions for regarding this.

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


Re: [PHP-DB] mysqldump

2004-11-09 Thread Aaron Todd
As far as I know...yes.  Thats what I have seen on every post I have looked 
at and also, thats the way it worked from the console.  It wouldnt work with 
no space.

Thanks for your reply,

Aaron


David Orlovich [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 also ... I notice you have a space after the -u - should that be there? 
 David.

 On 10/11/2004, at 6:59 AM, Aaron Todd wrote:

 I have created a PHP script that looks like:

 ?php
   $filename = /var/www/html/db_backup_ . date(n-j-y)..sql;
   exec('mysqldump -u * -p* database  $filename');
 ?

 For some reason this doesnt work and I cant figure out why.  There is no
 error that comes back.  When I run the mysqldump command from the server
 console it produces the file fine.  I have read a few other posts out 
 there
 about this same thing which resulted in the location the file was being
 saved.  But I have gone through my server and found nothing.  Does anyone
 have any suggestions for regarding this.

 Thanks,

 Aaron

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

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



RE: [PHP-DB] mysqldump

2004-11-09 Thread Bastien Koert
Does that user have permissions to run the mysql dump ?
Bastien
From: Aaron Todd [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysqldump
Date: Tue, 9 Nov 2004 12:59:31 -0500
I have created a PHP script that looks like:
?php
  $filename = /var/www/html/db_backup_ . date(n-j-y)..sql;
  exec('mysqldump -u * -p* database  $filename');
?
For some reason this doesnt work and I cant figure out why.  There is no
error that comes back.  When I run the mysqldump command from the server
console it produces the file fine.  I have read a few other posts out there
about this same thing which resulted in the location the file was being
saved.  But I have gone through my server and found nothing.  Does anyone
have any suggestions for regarding this.
Thanks,
Aaron
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] mysqldump

2004-11-09 Thread Jason Wong
On Tuesday 09 November 2004 17:59, Aaron Todd wrote:
 I have created a PHP script that looks like:

 ?php
   $filename = /var/www/html/db_backup_ . date(n-j-y)..sql;
   exec('mysqldump -u * -p* database  $filename');
 ?

 For some reason this doesnt work and I cant figure out why.  There is no
 error that comes back.  When I run the mysqldump command from the server
 console it produces the file fine.  I have read a few other posts out there
 about this same thing which resulted in the location the file was being
 saved.  But I have gone through my server and found nothing.  Does anyone
 have any suggestions for regarding this.

Try using double quotes.

Also just like performing SQL queries, it's a very good idea to build up the 
command you want executed, store it in a string ($cmd), then echo it to see 
whether it looks good, then exec($cmd).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Save the bales!
*/

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



Re: [PHP-DB] mysqldump

2004-11-09 Thread Aaron Todd
Jason,

I tried the double quotes but that didn't seem to matter.  I also put the 
command string in a variable and then am running the variable with exec. 
Still it doesnt work.

$filename = /home/virtual/site341/fst/var/www/html/db_backup_ . 
date(n-j-y)..sql;
$command = /home/virtual/site341/fst/usr/bin/mysqldump -u * -p* 
database  $filename;
echo $command;
exec($command);

Thanks for your post,

Aaron


Jason Wong [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Tuesday 09 November 2004 17:59, Aaron Todd wrote:
 I have created a PHP script that looks like:

 ?php
   $filename = /var/www/html/db_backup_ . date(n-j-y)..sql;
   exec('mysqldump -u * -p* database  $filename');
 ?

 For some reason this doesnt work and I cant figure out why.  There is no
 error that comes back.  When I run the mysqldump command from the server
 console it produces the file fine.  I have read a few other posts out 
 there
 about this same thing which resulted in the location the file was being
 saved.  But I have gone through my server and found nothing.  Does anyone
 have any suggestions for regarding this.

 Try using double quotes.

 Also just like performing SQL queries, it's a very good idea to build up 
 the
 command you want executed, store it in a string ($cmd), then echo it to 
 see
 whether it looks good, then exec($cmd).

 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-db
 --
 /*
 Save the bales!
 */ 

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



Re: [PHP-DB] mysqldump

2004-11-09 Thread Jason Wong
On Tuesday 09 November 2004 19:12, Aaron Todd wrote:

Please do not top post (google  top post).

 I tried the double quotes but that didn't seem to matter. 

It does matter. 

 I also put the 
 command string in a variable and then am running the variable with exec.
 Still it doesnt work.

Splitting it up into 2 steps is to aid in debugging.

 $filename = /home/virtual/site341/fst/var/www/html/db_backup_ .
 date(n-j-y)..sql;
 $command = /home/virtual/site341/fst/usr/bin/mysqldump -u * -p*
 database  $filename;
 echo $command;

If what is being echoed looks OK then

 exec($command);

make use of the extra arguments to exec() (see manual) so that you can see 
what's being output.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
If you can survive death, you can probably survive anything.
*/

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



[PHP-DB] Do You Need addslashes() When Using Bind Variables

2004-11-09 Thread Francis Chang
Hi,

I'm using the Oracle database though I think this question is generic to all 
databases.

If you're using bind variables and preparing the SQL statements ahead of 
time, do you still need to call addslashes() before binding the strings to 
the bind variables?

Thanks in advance.

Francis

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