[PHP-DB] Images on-fly

2003-12-03 Thread Dejan Dujak
Hallo People,


I have one problem with creating images on-fly.

Therefore I created 2 files:

1. resize_image.php with the following

?php
if (!$max_width)
$max_width = 150;
if (!$max_height)
$max_height = 100;
$size = GetImageSize($image);
$width = $size[0];
$height = $size[1];
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if ( ($width = $max_width)  ($height = $max_height) ) {
$tn_width = $width;
$tn_height = $height;
}
else if (($x_ratio * $height)  $max_height) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
$src = ImageCreateFromJpeg($image);
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0,
$tn_width,$tn_height,$width,$height);
header(Content-type: image/jpeg);
ImageJpeg($dst, null, -1);
ImageDestroy($src);
ImageDestroy($dst);
?

AND

2. filex.php .In that file i read from database where the image is stored en
then i show small images(thumbnails).

thet part of the code is :

?php do { ?
tr
  td width=156 height=32 valign=top?php echo
$row_rsSubGroup['name']; ?/td
  td colspan=2 valign=top?php
$fotolink=../dbtest/.$row_rsSubGroup['image_1']);
  echo IMG
SRC=\resize_image.php?image=$fotolink\;
 ?
 /td
/tr
?php } while ($row_rsSubGroup = mysql_fetch_assoc($rsSubGroup)); ?



This doesn't WORK.  Please HELP.

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



[PHP-DB] I 'am not so goooood with php....

2003-12-03 Thread Dejan Dujak
What I'am doing wrong??? I just don't know. All I will like to do is for
every Odd record create a new row(TR) with new TD. If record is Even in
record set  start second td en close /td en close row(/tr).

  ?php  $tel = 1;
$dbrows = mysql_num_rows($rsSubGroup);
  ?
?php do { ?

  ?php
 if (($tel % 2) 0)
  {echo tr;
   echo td;
   echo $row_rsSubGroup['name'];
   echo /td;
   if $tel == $dbrows{
   echo /tr;
   }
  }
  else
   {
   echo td;
   echo $row_rsSubGroup['name'];
   echo /td;
   echo /tr;
   }
  $tel +=1;

   ?
?php } while ($row_rsSubGroup = mysql_fetch_assoc($rsSubGroup)); ?

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



[PHP-DB] character problem with mssql

2003-12-03 Thread Gamze Baaran
Hi;

I use php and mssql. I have got a character problem. I must use turkish
chracters. When I select datas from database it works true and I can see
turkish characters but when I want to insert new datas to database it set
wrong character.

For example  characetrs look like ? How can I solve this problem? My
data type is char 100.

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



[PHP-DB] selecting a constant or label in php

2003-12-03 Thread Jon Davis
Sorry for another newbie question, I'm learning.

In Sybase I can do:

select COMM_REGIONID , count(1) from COMM_REGIONID where PHYSICAL_ID is 
null
select COMM_TKGRP , count(1) from COMM_TKGRP where PHYSICAL_ID is null

I get parsing errors when putting it in this:

$result = sybase_query(select COMM_REGIONID , count(1) from COMM_REGIONID 
where PHYSICAL_ID is null
   select COMM_TKGRP , count(1) from 
COMM_TKGRP where PHYSICAL_ID is null , $server_sybase);

How can I hardcode COMM_REGIONID and COMM_TRKGRP?

_
Wonder if the latest virus has gotten to your computer? Find out. Run the 
FREE McAfee online computer scan! 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

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


RE: [PHP-DB] selecting a constant or label in php

2003-12-03 Thread Jon Davis
COMM_REGIONID and COMM_TRKGRP are not columns in the tables.  They are the 
actual table names.  I want the count of the PHYSICAL_ID where it is NULL.  
I need to do this for multiple table so I want to hardcode the tablename and 
then have the count:

 ---
COMM_TKGRP0
COMM_REGIONID 0
using COMM_REGIONID, 'COMM_REGIONID' and \COMM_REGIONID\ all fail with:

Warning: sybase_query() [http://www.php.net/function.sybase-query]: Sybase:  
Server message:  COMM_REGIONID not found. Specify owner.objectname or use 
sp_help to check whether the object exists (sp_help may produce lots of 
output).

It's not found because it's not a column.  I just want it in there so when I 
insert it into another table I will know which count applies to which table. 
 Everything I try, gets an error.

Sorry, I should have mentioned what COMM_REGIONID was first.


From: Jon Davis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] selecting a constant or label in php
Date: Wed, 03 Dec 2003 09:39:33 -0600
Sorry for another newbie question, I'm learning.

In Sybase I can do:

select COMM_REGIONID , count(1) from COMM_REGIONID where PHYSICAL_ID is 
null
select COMM_TKGRP , count(1) from COMM_TKGRP where PHYSICAL_ID is null

I get parsing errors when putting it in this:

$result = sybase_query(select COMM_REGIONID , count(1) from 
COMM_REGIONID where PHYSICAL_ID is null
   select COMM_TKGRP , count(1) from 
COMM_TKGRP where PHYSICAL_ID is null , $server_sybase);

How can I hardcode COMM_REGIONID and COMM_TRKGRP?

_
Wonder if the latest virus has gotten to your computer? Find out. Run the 
FREE McAfee online computer scan! 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
Get holiday tips for festive fun. 
http://special.msn.com/network/happyholidays.armx

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


[PHP-DB] Remote DB Connection

2003-12-03 Thread Omelin Morelos
Hi people,

I have 2 servers , i need to connect to 1 remote mysql server ,i am using
the normal :

@mysql_connect ('ipaddres-server2', 'DBName', 'DBPwd') ;

Is their anything else I need to consider to connect ? ,

Thank you

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



Re: [PHP-DB] Remote DB Connection

2003-12-03 Thread Richard Davey
Hello Omelin,

Wednesday, December 3, 2003, 6:05:52 PM, you wrote:

OM @mysql_connect ('ipaddres-server2', 'DBName', 'DBPwd') ;
OM Is their anything else I need to consider to connect ? ,

The server must allow it :) other than that, not really.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



[PHP-DB] calculations using variables in html table cell

2003-12-03 Thread Christopher Adams
I am generating html tables dynamically. Each table has multiple columns
and various calculations need to be done on each column and displayed
at the bottom of the column. I am including the code from one table below.
The $tablerow generates the table data and the $tablefooter generates the
rows at the bottom that will include the calculated values.

Preceding the $tablerow declaration, I have declared some variables and done
calculations. I then included these
in the $tablefooter to display the calculated values. This works fine.
However, I have many other calculations on other columns in other tables.
Using this method, I would have to declare many new variables just for
calculations.


I am wondering if there is a way to do these calculations directly in the
table cells. I am pretty new to PHP and have not used calculations much.

$sumpop += $POP;
$sumadultcirc += $ADULTCIRC;
$sumjuvcirc += $JUVCIRC;

$tablerow[1] = trtd . $row[name] . /td .
td$POPtd$ADULTCIRC/td
td$JUVCIRC/tdtd$TOTCIRC/tdtd$CIRCPERCAP/tdtd$TOTREF/tdtd$R
EFPERCAP/td/tr;


$tablefooter[1] = trtdbTable total/b/tdtdb$sumpop/b/td
tdb$sumadultcirc/b/tdtdb$sumjuvcirc/b/tdtdb$TOTCIRC/b
/td
tdb$CIRCPERCAP/b/tdtdb$TOTREF/b/tdtdb$refpercap/b/td
/tr
trtdbTable average or per capita/b/tdtdb$POPAV/b/td
tdb$ADCIRCAV/b/tdtdb$JUDCIRCAV/b/tdtdb$TOTCIRCAV/b/td

tdb$CIRCPERAV/btdb$TOTREFAV/btdb$REPERAV/b/td/tr;

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



Re: [PHP-DB] calculations using variables in html table cell

2003-12-03 Thread Ignatius Reilly
If you have to build complex, dynamic tables, do yourself a favour and use a
class that will allow you to feed directly arrays of numbers.
I use PEAR HTML_Table, which is great and easy to use.
You will have recouped the investment of learning the class after about one
hour.

HTH
Ignatius
_
- Original Message -
From: Christopher Adams [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 21:07
Subject: [PHP-DB] calculations using variables in html table cell


 I am generating html tables dynamically. Each table has multiple columns
 and various calculations need to be done on each column and displayed
 at the bottom of the column. I am including the code from one table below.
 The $tablerow generates the table data and the $tablefooter generates the
 rows at the bottom that will include the calculated values.

 Preceding the $tablerow declaration, I have declared some variables and
done
 calculations. I then included these
 in the $tablefooter to display the calculated values. This works fine.
 However, I have many other calculations on other columns in other tables.
 Using this method, I would have to declare many new variables just for
 calculations.


 I am wondering if there is a way to do these calculations directly in the
 table cells. I am pretty new to PHP and have not used calculations much.

 $sumpop += $POP;
 $sumadultcirc += $ADULTCIRC;
 $sumjuvcirc += $JUVCIRC;

 $tablerow[1] = trtd . $row[name] . /td .
 td$POPtd$ADULTCIRC/td

td$JUVCIRC/tdtd$TOTCIRC/tdtd$CIRCPERCAP/tdtd$TOTREF/tdtd$R
 EFPERCAP/td/tr;


 $tablefooter[1] = trtdbTable total/b/tdtdb$sumpop/b/td

tdb$sumadultcirc/b/tdtdb$sumjuvcirc/b/tdtdb$TOTCIRC/b
 /td

tdb$CIRCPERCAP/b/tdtdb$TOTREF/b/tdtdb$refpercap/b/td
 /tr
 trtdbTable average or per capita/b/tdtdb$POPAV/b/td

tdb$ADCIRCAV/b/tdtdb$JUDCIRCAV/b/tdtdb$TOTCIRCAV/b/td
 
 tdb$CIRCPERAV/btdb$TOTREFAV/btdb$REPERAV/b/td/tr;

 --
 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] I 'am not so goooood with php....

2003-12-03 Thread Matt Matijevich
** Low Priority **

snip
  ?php  $tel = 1;
$dbrows = mysql_num_rows($rsSubGroup);
  ?
?php do { ?

  ?php
 if (($tel % 2) 0)
  {echo tr;
   echo td;
   echo $row_rsSubGroup['name'];
   echo /td;
   if $tel == $dbrows{
   echo /tr;
   }
  }
  else
   {
   echo td;
   echo $row_rsSubGroup['name'];
   echo /td;
   echo /tr;
   }
  $tel +=1;

   ?
?php } while ($row_rsSubGroup =
mysql_fetch_assoc($rsSubGroup)); ?
/snip

I think you want to replace  if $tel == $dbrows with if ($tel ==
$dbrows).

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



[PHP-DB] Addslashes

2003-12-03 Thread Ng Hwee Hwee
hi all,

i'm really buffled by what i got and would appreciate any help possible! although i 
addslashes and stripslashes, i still get a backslash ( \ ) character infront of a 
single inverted comma ( ' ) and also whenever an amberscend (  ) appears... please 
help! thanx thanx..

for example:

in my form (form.php), i have something like that:

input type=text name=field1 value=? if ($form[field1]) echo 
stripslashes($form[field1]); ?

upon submitting the form, the verification file (verify.php) will be executed, and it 
has lines like that:

?
  session_register(form);

  foreach($_POST as $varname = $value)
   $form[$varname] = addslashes(trim(EscapeShellCmd($value)));
?

... and then i'll check for the validity of field1. if there is an error, the user 
will be redirected back to form.php with the value that the user entered echoed with a 
stripslash.

if there is no error, the whole script runs well, but if the user has to be brought 
back to form.php, it'll print backslashes infront of characters like (   )  '   
etc..

also, instead of having a blank text field, i have a text field with contents 
retrieved from the database.. the database data does not have the slashes and when the 
first time they appear on the screen, there is no slashes attached too.. the problem 
is always when the user has an error and needs to be brought back to form.php that the 
slashes appear and the number of slashes doubles everytime the user has to be brought 
back to form.php.

i have my magic_quotes_gpc set to ON in my phpinfo() and my version of php is 4.1.2.

thank you soo soo much!!

look forward to your replies.

hwee



[PHP-DB] Re: Addslashes

2003-12-03 Thread Justin Patrin
It's the magic quotes setting. Try setting magic_quote_gpc to off. Also, 
try turning magic_quotes_runtime off.

Ng Hwee Hwee wrote:

hi all,

i'm really buffled by what i got and would appreciate any help possible! although i addslashes and stripslashes, i still get a backslash ( \ ) character infront of a single inverted comma ( ' ) and also whenever an amberscend (  ) appears... please help! thanx thanx..

for example:

in my form (form.php), i have something like that:

input type=text name=field1 value=? if ($form[field1]) echo stripslashes($form[field1]); ?

upon submitting the form, the verification file (verify.php) will be executed, and it has lines like that:

?
  session_register(form);
  foreach($_POST as $varname = $value)
   $form[$varname] = addslashes(trim(EscapeShellCmd($value)));
?
... and then i'll check for the validity of field1. if there is an error, the user will be redirected back to form.php with the value that the user entered echoed with a stripslash.

if there is no error, the whole script runs well, but if the user has to be brought back to form.php, it'll print backslashes infront of characters like (   )  '   etc..

also, instead of having a blank text field, i have a text field with contents retrieved from the database.. the database data does not have the slashes and when the first time they appear on the screen, there is no slashes attached too.. the problem is always when the user has an error and needs to be brought back to form.php that the slashes appear and the number of slashes doubles everytime the user has to be brought back to form.php.

i have my magic_quotes_gpc set to ON in my phpinfo() and my version of php is 4.1.2.

thank you soo soo much!!

look forward to your replies.

hwee


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