[PHP-DB] "mysql_select_db() or die()" fails when db exists

2002-01-17 Thread Malcolm White

Hi,

I am experiencing a problem with this function;

funcion do_connect($server, $db, $user, $pass){
   $link = @mysql_pconnect($server, $user, "$pass")
   or die("error: mysql_pconnect()");
   mysql_select_db($db) or die("error: mysql_select_db()");
}

when supplied with variables that are correct (server, db, etc) it fails at
mysql_select_db(), however if I remove "or die("error: mysql_select_db()")"
it works. Can anyone explain why.

My config is apache 1.3.14, php 4.1, mysql 3.23.41

Thanks,

Malcolm




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] mail() - Return-Path

2002-01-12 Thread Malcolm White

1. Message sends.
2/3. The code used is as per the annotated on line PHP manual

[EMAIL PROTECTED]
11-Jan-2002 02:10 
 
There used to be a note with a complete set of headers to use with the mail
function but somehow now its gone so here they are again hope it helps :)

$headers .= "From: Name<[EMAIL PROTECTED]>\n";
$headers .= "X-Sender: <[EMAIL PROTECTED]>\n";
$headers .= "X-Mailer: PHP\n"; //mailer
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <[EMAIL PROTECTED]>\n";
//Uncomment this to send html format
//$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
//$headers .= "cc: [EMAIL PROTECTED]\n"; // CC to
//$headers .= "bcc: [EMAIL PROTECTED]"; // BCCs to, separete
multiple with commas [EMAIL PROTECTED], [EMAIL PROTECTED]

Regards
P.A. Luis Tena O.
Mexico city.
 
4. No error messages. An email constructed as above sends perfectly - but
the return path defaults to the apache user (in my case www) not the
supplied return path. I tested the header construction by changing
Return-Path: to X-Path: and the X-Path: header appears correctly. I am not
sure but it seams that the real Return-Path is not overidable.

I hope this is clearer.

Malcolm



At 12:06 12/01/2002 -, you wrote:
>Malcolm,
>
>> I Have been trying to change the Return-Path: when using mail() but to no
>> success. I have followed the examples in the documentation. Is there any
>> hidden trick - Iam using apache 1.3.14, php 4.1.1 and sendmail 8.9.3.
>
>
>=There's been some grouching on the lists about spam and vague questions -
How much detail have you given about
>this problem? Would it be acceptable to answer saying "Iam using apache
1.3.14, php 4.1.1 and sendmail 8.9.3.
>and it works fine"?
>
>=Fortunately I don't (use sendmail) so after grumbling away, let me say
that I do have systems that email
>(successfully) from PHP code and am interested in the topic (and did like
your precise subject line).
>
>1 if a msg is constructed (without Return-Path) does it send/receive to spec?
>2 which example/documentation?
>3 what is the pertinent PHP code?
>4 what is the errmsg-received/other symptoms?
>
>=dn
>
>
>
>-- 
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] mail() - Return-Path

2002-01-12 Thread Malcolm White

I Have been trying to change the Return-Path: when using mail() but to no
success. I have followed the examples in the documentation. Is there any
hidden trick - Iam using apache 1.3.14, php 4.1.1 and sendmail 8.9.3.

Thanks,

Malcolm



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Image Sizes

2001-12-09 Thread Malcolm White

Sorry, I know this is for the wrong group - I just started here as the major
part of this app is related to a data base - this is just the fancy stuff at
the front. I have been able to get the screen to redraw by putting a
variable in the url that when set causes a  tag to be sent with a
refresh option - it is ugly as it causes the screen to draw then immediatly
redraw. I have tried all combinations of header()'s but I am missing something.

Thanks,

Malcolm


view.php

";

   //file containing various global variables
   include('./pview.inc');

   //build the complete path to the picture file
   $pic_file = $base_dir . $pic_dir_name . "/" . $pic;

   //rotate function - calls jpegtran to do the work
   function rotate($pic, $thu, $ro, $name){
  $temp_file = "/tmp/temp_pic";

  if($ro == "CCW")
 $rot = 270;
  else
 $rot = 90;

  exec("./jpegtran -rot $rot $pic> $temp_file");
  unlink($pic);
  copy($temp_file, $pic);
  unlink($temp_file);
  exec("./jpegtran -rot $rot $thu > $temp_file");
  unlink($thu);
  copy($temp_file, $thu);
  unlink($temp_file);
   }

   //if rotate variable is set then call rotate()
   if(isset($ro)){
  $thu_file = $base_dir . $thumb_dir_name . "/" 
  . $thumbnail_prefix . strtolower($pic);
  rotate($pic_file, $thu_file, $ro, $pic);

  //another attempted screen refresh. forces the meta tag
  header("Location: ./view.phtml?pic=$pic&reload=true");
   }

   //Script to set the image size according to browser size
   echo "
 function draw_image(width, height){
if(navigator.appName == 'Netscape' && document.layers != null){
   wid = window.innerWidth;
   hit = window.innerHeight;
}
if(document.all != null){
   wid = document.body.clientWidth;
   hit = document.body.clientHeight;
}
  
wFactor = wid / width;
hFactor = hit / height;
  
if(wFactor < hFactor)
   fact = wFactor;
else
   fact = hFactor;
   
fact = fact * 0.75;

nwid = width * fact;
nhit = height * fact;

document.images[0].height = Math.round(nhit);
document.images[0].width = Math.round(nwid);
 } 
 ";
   

   //get info abou the file for display
   list($width, $height) = GetImageSize($pic_file);
   $size = floor(filesize($pic_file) / 1024);

   //build the screen
   echo "Image - " . $pic;
   echo "";
   echo "";
   echo "";
   echo "(Image Details: width - " . $width
 . ", height - " . $height
 . ", size - " . $size . "k) ";

   //user options to rotate or return to the index page
   echo "
 [Rotate CCW] 
 [HOME] 
 [Rotate CW]";
   echo "";
   echo "";

   //a bit of self promotion
   echo "Picture Viewer
 - Developed by Whitehouse Productions 2001";

?>
>X-POP3-Rcpt: mwhite@guru
>Return-Path: <[EMAIL PROTECTED]>
>From: "Jon Farmer" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>, "Malcolm White" <[EMAIL PROTECTED]>
>References: <[EMAIL PROTECTED]>
>Subject: Re: [PHP-DB] Image Sizes
>Date: Sun, 9 Dec 2001 08:43:39 -
>X-MSMail-Priority: Normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2479.0006
>
>> I slved it with a javascript function - now I can't get the page refresh
>to
>> work properly - I have implimented the ability to rotate the images but
>> although the image i rotated it's contents aren't. I have used all maner
>of
>> header()'s to try and solve it but it only works when I physically hit the
>> refresh button on the browser.
>
>OK well can you show us the code? As you dont give much to go on. BTW you
>are posting to the wrong list you should use the PHP-General list as this
>list is for database issues.
>
>--
>Jon Farmer
>Systems Programmer, Entanet www.enta.net
>Tel 01952 428969 Mob 07763 620378
>PGP Key available, send email with subject: Send PGP Key
>
>
>
>
---
|   WHITEHOUSE PRODUCTIONS|
|  Malcolm White  |
---
| ph:  +61 2 9798 4645|
| fax: +61 2 9716 6097|
| mob: +61 414 860 742| 
| mob fax: +61 414 860 745|
| email:   [EMAIL PROTECTED]  |
| web: www.whitehouseprod.com.au  |
---


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Image Sizes

2001-12-09 Thread Malcolm White

Thanks,

I slved it with a javascript function - now I can't get the page refresh to
work properly - I have implimented the ability to rotate the images but
although the image i rotated it's contents aren't. I have used all maner of
header()'s to try and solve it but it only works when I physically hit the
refresh button on the browser.

At 07:33 09/12/2001 -, you wrote:
>> I have a database that stores the location of image files - the images are
>> all of different sizes. How can I get the screen size in order to scale
>the
>> images according to the users screen. I can use GetImageSize() to
>determine
>> the image size but cannot find a means of determining the screen size.
>
>
>You cant do this with PHP. You need to use a client side script (javascript)
>to determine the screen res and then pass that pack to PHP either through
>the query string or a form post.
>
>Regards
>
>Jon
>
>--
>Jon Farmer
>Systems Programmer, Entanet www.enta.net
>Tel 01952 428969 Mob 07763 620378
>PGP Key available, send email with subject: Send PGP Key
>
>
>
>-- 
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
---
|   WHITEHOUSE PRODUCTIONS|
|  Malcolm White  |
---
| ph:  +61 2 9798 4645|
| fax: +61 2 9716 6097|
| mob: +61 414 860 742| 
| mob fax: +61 414 860 745|
| email:   [EMAIL PROTECTED]  |
| web: www.whitehouseprod.com.au  |
---


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Image Sizes

2001-12-08 Thread Malcolm White

Hi,

I have a database that stores the location of image files - the images are
all of different sizes. How can I get the screen size in order to scale the
images according to the users screen. I can use GetImageSize() to determine
the image size but cannot find a means of determining the screen size.

Thanks,

Malcolm



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] MySQL UPDATE problem

2001-08-30 Thread Malcolm White

I am having a problem with UPDATE queries with MySQL. Insert, Delete, etc
work fine. I have checked the query statement and it works fine directly
with MySQL just not in a PHP script. An example function is;

function update_gname($gid, $new_name){
  $query = "UPDATE Groups SET GName=$new_name WHERE GID=$gid";
  $result = mysql_query($query)
  or die("error: update_gname()");
  return $result;
}

I am using MySQL version 3.22.32 and PHP4.0.3pl1 as a module in Apache1.3.14
with Linux2..2.13.

Thanks,

Malcolm


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]