[PHP-DB] MSSQL: PHP fails to connect

2002-03-01 Thread Rodya Jörn Koester [B2A]


Hello community!

After reinstalling our Active Directory domain from scratch, PHP 4.0.6 does
no longer connect to MS SQL Server 2000 by mssql_connect().

PHP itself resides on our master DC (W2K Small Business Server,
192.168.1.1), while the SQL Server is installed on the 2nd DC (W2K Server,
192.168.1.2) -- which is the same constellation as 7 days ago, when PHP an
MSSQL happily worked together.

Does anybody have an idea what might have been going wrong during
installation of either part of them? Or thereafter?

I've already checked the following: extension directory entry in php.ini,
read/execution grants for `IUSR_xyz´ on php's exes and dlls, mssql_connect()
with: FQDN *or* host name *or* IP address, several different database users
including `sa´, MSSQL Server *in* the Active Directory as well as *not in*,
MSSQL's network configuration w/ Named Pipes as well as w/o, DNS entries and
several successful access tests with: Enterprise Manager, Query Analyzer and
ColdFusion 5 (ODBC).

BTW: both, php as well as MSSQL, have been installed using the `default´
settings of both installers (except for the installation dirs).

The baddest thing at last: mssql_connect() to the *same* Server from a
different, arbitrarily chosen workstation (W2K Pro) with PHP 4.0.6 *does*
work!

Any hints? *Please*!

TIA!

  Rodya


 Rodya Jörn Koester  B2A MEDIA GRAFIC DESIGN
 mailto:[EMAIL PROTECTED]   Kassel,Germany,Europe,Earth



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




[PHP-DB] Postgress+ODBC+BLOB

2002-03-01 Thread Ling

Hello
Sorry for previous empty message
As I understand there is no BLOB type in Postgress for storing large binary
data ( in my case image files)
I can't use Large Object cause I connecting to Postgres via ODBC
( there is no support for large objects )
Have anybody solved this problem? is there any alternative datatypes or ways
of solution?

best regards
Ling




-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Re: Postgress+ODBC+BLOB

2002-03-01 Thread Yasuo Ohgaki

Ling wrote:
 Hello
 Sorry for previous empty message
 As I understand there is no BLOB type in Postgress for storing large binary
 data ( in my case image files)

What do you mean no BLOB suuport for PostgreSQL? You can use
lo (Large Object) interface

Read manual pages for that

 I can't use Large Object cause I connecting to Postgres via ODBC
 ( there is no support for large objects )
 Have anybody solved this problem? is there any alternative datatypes or ways
 of solution?

If you are using PostgreSQL and PHP, just use pgsql extension

-- 
Yasuo Ohgaki
Please CC me when you reply to news/list messages
Do not reply only to me :)


-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Re: Postgress+ODBC+BLOB

2002-03-01 Thread Yasuo Ohgaki

Ling wrote:
 Hello
 Sorry for previous empty message
 As I understand there is no BLOB type in Postgress for storing large binary
 data ( in my case image files)

What do you mean no BLOB suuport for PostgreSQL? You can use
lo (Large Object) interface

Read manual pages for that

 I can't use Large Object cause I connecting to Postgres via ODBC
 ( there is no support for large objects )
 Have anybody solved this problem? is there any alternative datatypes or ways
 of solution?

If you are using PostgreSQL and PHP, just use pgsql extension

-- 
Yasuo Ohgaki
Please CC me when you reply to news/list messages
Do not reply only to me :)


-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Re: pg_pconnect Causing SegFaults?!?!

2002-03-01 Thread Yasuo Ohgaki

Could you post backtrace and CC the meesage to me?

I'm almost sure pgsql module will never cause segfault
like this, I can tell more if you send backtrace

PS: If you don't know how to get backtrace, visit
http://bugsphpnet/


--
Yasuo Ohgaki

Kevin Traas wrote:
 Greetings everyone,
 
 I've been having a very frustrating problem over the past few months that
 I've ***finally*** tracked down the cause of
 
 Any questions/comments/thoughts/ideas you can provide would be *greatly*
 appreciated
 
 Symptoms:
 - IE, Opera, Lynx all report page cannot be displayed and/or server
 error about half the time
 - NS has no problems at all
 - Apache errorlog shows child (PID) seg faulted
 
 Problem post analysis:
 - The Apache processes can accept and successfully serve one connection from
 a client  The next connection results in the Apache child process seg
 faulting, the error getting logged in errorlog, nothing gets reported in
 accesslog, and the Apache parent process respawns a new child
 - The newly spawned child will accept and serve one connection from a client
 before also segfaulting
 
 I've eliminated every possibility I could think of while troubleshooting
 this  ie it's not SSL, it's not PHP itself, it's not Apache itself  It's
 the pg_pconnect() function
 
 Throughout my troubleshooting, I came upon it by accident, really, that I
 discovered all my problems went away when I replaced the pg_pconnect()
 function with the (almost deprecated according to the docs) pg_connect()
 function
 
 In troubleshooting this, I created a shell script that continuously loads
 various pages from the site (using Lynx -dump -mime_header url), counts
 the iterations, and bails as soon as a page fails to load  Running this
 against plain HTML files, PHP scripts (ie that simply echo something or
 provide phpinfo(), etc), over SSL or not all work just fine  (15,000
 loads in each case without fault)
 
 As soon as I try accessing a PHP script that includes the pg_pconnect()
 function, it dies almost immediately  If I stop/start Apache right before
 trying this, I'll get X successful loads (where X = Apache's 'StartServers'
 property)   After that, I'll get a continuous mixture of successful and
 failed loads from then on
 
 So, let me repeat here As soon as I switched from pg_pconnect() to
 pg_connect(), everything worked perfectly after that  (ie 15000 loads
 without an error)
 
 More info:
 - My platform is up-to-date Debian GNU/Linux (sid) (Apache 1323, PHP
 411, PostgreSQL 713, etc)
 - As above, this is *not* browser specific  (Found a *lot* of google hits
 with people having problems with IE and SSL and seg faults, etc  Completely
 unrelated)
 - Note from above, though, that NS is unaffected by this problem  It
 *never* has a problem  My assumption is that NS will simply silently retry
 (several times) if the connection fails for some reason, until it does get a
 valid response from the server   (Kudos!!!  ;-)
 
 So, any thoughts?  Comments?  Suggestions?
 
 Have I found a bug in pg_pconnect()?   How can I provide more info to track
 this down further?
 
 Best regards,
 Kevin Traas
 Chief Information Officer, Co-founder
 Merilus, Inc ---=== wwwmeriluscom  ===---
 
 


-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Re: Postgress+ODBC+BLOB

2002-03-01 Thread Ling

Hello

as I wrote before I use Unified ODBC in order to make scripts database
independent,
but  Unified ODBC does not support LO

 If you are using PostgreSQL and PHP, just use pgsql extension

sorry but I do not understand : (

I didn't find any information in user guide about data type 'BYTEA'
does anybody know what is it? its limit? ability to store binary data?




-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Building secure authentification with sessions

2002-03-01 Thread Andy

Hi there,

I did recently read an article about security Now I absolutly see the need
of recoding my authentification procedure on a community site

There are questions I hoped some of you guys can answer


1 Is storing sensitive data like permission level secure in session
variables?

2 What could be a good way to session register a user and know which users
are online, know their permission level in congungtion with a MySQL db?

3 Is it better to store the needed info about the user in a db table
holding all current sessions, or to store it in more than 1 session
variable

4 Maybe someone can relate to a good site dealing with security issuses on
this topic I would really like to avoid that some hacker gets admin access
on my website :-)

Thanx for any hints,

Cheers Andy



-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] FW: PHP Question on MySQL grouping

2002-03-01 Thread Keiran Wynyard

I need to loop through a grouped recordset adding a hr at the 
end of each group, how can groups in recordsets be identified in
PHP for specific formatting.
 
 SELECT name AS name, dishtype AS dishtype, price AS price
 FROM dishes
 WHERE used = 1
 GROUP BY dishtype, name
 ORDER BY dishtype, price DESC
 
The use is in the display of a menu for a restaurant, where there 
is a table containing all the dishes on the menu in any given 
instance, but they musst be displayed in a specific order, 
grouped by type. In other words, all Starters come first, 
followed by Main courses, followed by Desserts. Between each type 
there needs to be a seperator, the horizontal line.
 
 Thanks for you help
 
Keiran

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




[PHP-DB] Re: I'm really stuck!

2002-03-01 Thread Aron Pilhofer

First, could you be more specific? What isn't working? What error messages
are you getting? (I assume you are echoing them, because if not, you should
be... mysql_query($query) or die (mysql_error());

Second, this could be a problem. I think you need single quotes around the
variable here:

$query = select bin_data, filetype from image_data where
id=---'$id'; -

Beyond that, I can't really help much. Never stored image data in a db
before, so I can't tell you if anything else might be amiss. Good luck.


Jennifer Downey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED];
Hi all,

I'm really stuck and I'm not asking anyone to re-write this just show me
what is wrong, or explain why it wont work. It just seems logical that this
should work.

The first query will print the pet id in the browser.

$query=SELECT  id FROM wt_users WHERE uid={$session[uid]};
$ret = mysql_query($query);
while(list($pet)=
mysql_fetch_row($ret))
print(BRyour pet id is $pet);

So if $pet will print the id from the wt_users (has a value of 3) and I
assign $id = $pet (id also has a value of 3 in image_data)  why doesn't it
show the image?

if($id) {


$id = $pet;
$query = select bin_data,filetype from image_data where id=$id;

  $result = mysql_query($query);

$data = mysql_query($result,0,bin_data);
$type = mysql_query($result,0,filetype);

Header( Content-type: $type);
echo $data;

};
echo img src=\petdata.php?id=$id\;

Thanks
Jennifer Downey




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




[PHP-DB] Re: PHP Question on MySQL grouping

2002-03-01 Thread Aron Pilhofer

depending on how you print the result set to the browser, you just need to
add an echo hr at the end of each line. So, if you've fed your result
set into an array called $row, then something like:

print $row[0] . $row[1] . $row[2] . hr;

That should print out each result followed by a horizontal rule. Something
like that anyway. Hope that helps.



Keiran Wynyard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED];
 I need to loop through a grouped recordset adding a hr at the
 end of each group, how can groups in recordsets be identified in
 PHP for specific formatting.

  SELECT name AS name, dishtype AS dishtype, price AS price
  FROM dishes
  WHERE used = 1
  GROUP BY dishtype, name
  ORDER BY dishtype, price DESC

 The use is in the display of a menu for a restaurant, where there
 is a table containing all the dishes on the menu in any given
 instance, but they musst be displayed in a specific order,
 grouped by type. In other words, all Starters come first,
 followed by Main courses, followed by Desserts. Between each type
 there needs to be a seperator, the horizontal line.

  Thanks for you help

 Keiran



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




RE: [PHP-DB] I'm really stuck!

2002-03-01 Thread JD Daniels


Try doing echo stripslashes($data);

Or try setting the content type to text/plain - This should echo back
gobblygook (Just so you know that there IS image data there.

Also.. you have img src=\petdata.php?id=$id\ in another file right? If
you call petdata.php by itself, you should see just the image.

JD

-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 4:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] I'm really stuck!


Hi all,

I'm really stuck and I'm not asking anyone to re-write this just show me
what is wrong, or explain why it wont work. It just seems logical that this
should work.

The first query will print the pet id in the browser.

$query=SELECT  id FROM wt_users WHERE uid={$session[uid]};
$ret = mysql_query($query);
while(list($pet)=
mysql_fetch_row($ret))
print(BRyour pet id is $pet);

So if $pet will print the id from the wt_users (has a value of 3) and I
assign $id = $pet (id also has a value of 3 in image_data)  why doesn't it
show the image?

if($id) {


$id = $pet;
$query = select bin_data,filetype from image_data where id=$id;

  $result = mysql_query($query);

$data = mysql_query($result,0,bin_data);
$type = mysql_query($result,0,filetype);

Header( Content-type: $type);
echo $data;

};
echo img src=\petdata.php?id=$id\;

Thanks
Jennifer Downey


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




[PHP-DB] PHP + Oracle + Redhat Linux Stupid Question Maybe? Sorry

2002-03-01 Thread Jason Lehman

This may be a stupid question but I am stuck  Do I have to have the Oracle
Linux Client to connet to a remote Oracle Database or can I just have the
php --with-oci8 turned on and that be it?  And I can't seem to find any
how-tos on just installing the client and I am not sure what prerequisites I
need on my computer to install just the client  Any help would be
appreciated  Thanks



-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] similar_text() equivalents

2002-03-01 Thread Aron Pilhofer

I do a lot of data cleaning, and I have really grown enamored of the
similar_text() function Just curious, is there anything directly equivalent
in perl and/or python? Thanks in advance

aron



-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Display in drop-down box

2002-03-01 Thread Alvin Ang

Hi there,

I was wondering if anyone would be kind enough to show me how to select a
field from a table in mysql and display it in a drop-down combo box?

I am trying to show my users a list of all the parts from a table so that
they can edit or delete it.

Thanks!

Alvin


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




RE: [PHP-DB] Display in drop-down box

2002-03-01 Thread Leotta, Natalie (NCI/IMS)

Try doing a select distinct on that field and then loop through the results,
adding each one to your drop-down box as you go.

I don't have the exact code anymore because we stopped doing it that way,
but that's the basic idea of how to go about it.

I hope it helps!

-Natalie

 -Original Message-
 From: Alvin Ang [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, March 01, 2002 2:07 PM
 To:   PHP
 Subject:  [PHP-DB] Display in drop-down box
 
 Hi there,
 
 I was wondering if anyone would be kind enough to show me how to select a
 field from a table in mysql and display it in a drop-down combo box?
 
 I am trying to show my users a list of all the parts from a table so that
 they can edit or delete it.
 
 Thanks!
 
 Alvin
 
 
 -- 
 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] Display in drop-down box

2002-03-01 Thread Ryan Marrs

Let me give this a shot :P

?
Mysql_connect(sqlserver,user,pass);
Mysql_select_db(db);
$resultset = mysql_query(select DISTINCT identifier, displayname from
table);
for($i=1;$i=mysql_num_rows($resultset);$i++)
{
$object = mysql_fetch_object($resultset);
$identifier = $object - identifier;
$displayname= $object - displayname;

print option value=\$identifier\$displayname/option;
}
?

I do believe that should do it.  Correct me if I missed anything.

Ryan

-Original Message-
From: Leotta, Natalie (NCI/IMS) [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 01, 2002 2:10 PM
To: PHP
Subject: RE: [PHP-DB] Display in drop-down box

Try doing a select distinct on that field and then loop through the results,
adding each one to your drop-down box as you go.

I don't have the exact code anymore because we stopped doing it that way,
but that's the basic idea of how to go about it.

I hope it helps!

-Natalie

 -Original Message-
 From: Alvin Ang [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, March 01, 2002 2:07 PM
 To:   PHP
 Subject:  [PHP-DB] Display in drop-down box
 
 Hi there,
 
 I was wondering if anyone would be kind enough to show me how to select a
 field from a table in mysql and display it in a drop-down combo box?
 
 I am trying to show my users a list of all the parts from a table so that
 they can edit or delete it.
 
 Thanks!
 
 Alvin
 
 
 -- 
 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

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




[PHP-DB] easy date format question

2002-03-01 Thread Matthew Crouch

should be simple as pie, of course, but i can't find a straightforward
syntax example in the documentation i'm trying to change the PHP date
format to mysql's

my code:
$today = date(MMDD);
$sql = INSERT into table (date) values ('$today');
and so on

is filling the date field with zeros, instead of 2002-02-28


-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Re: FW: PHP Question on MySQL grouping

2002-03-01 Thread Matthew Crouch

Another way is to set a testing variable and then print an hr if it
changes
(this off the top of my head, probably bugs in it but you get the idea)

while $myrow=mysql_fetch_row($result) {
if $myrow[dishtype]$test {
echo hr;
//here you would print the rest of the info about the dish from the row
}
$test=$myrow[dishtype];
}

Keiran Wynyard wrote:

 I need to loop through a grouped recordset adding a hr at the
 end of each group, how can groups in recordsets be identified in
 PHP for specific formatting

  SELECT name AS name, dishtype AS dishtype, price AS price
  FROM dishes
  WHERE used = 1
  GROUP BY dishtype, name
  ORDER BY dishtype, price DESC

 The use is in the display of a menu for a restaurant, where there
 is a table containing all the dishes on the menu in any given
 instance, but they musst be displayed in a specific order,
 grouped by type In other words, all Starters come first,
 followed by Main courses, followed by Desserts Between each type
 there needs to be a seperator, the horizontal line

  Thanks for you help

 Keiran


-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Retreiving data from a table

2002-03-01 Thread Morten Nielsen

Hi,
I got the following insert statement in my PHP code:

 $qid = db_query(
 INSERT INTO table1 (
  Name
 ) VALUES (
   '$frm[Name]'
 ));

This is working like I want it to But in the table there is a column, which
is AUTO_INCREMENT I would like to retreive this number right after I added
the data
Can anybody help me?

Thanks,
Morten



-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Rounding numbers

2002-03-01 Thread Jennifer Downey

Hi again,

Would someone show me how to round numbers:


$bank_points= $ret;
$interest = 095;
$months = 12;
$weeks = 52;
$days=365;

$query=SELECT  bank_points FROM wt_users WHERE uid={$session[uid]};
$ret = mysql_query($query);
while(list($bank_points)=
mysql_fetch_row($ret))

$yearly_interest=$bank_points * $interest;
print(BRYour yearly interest is : $yearly_interest);

$daily_interest=$yearly_interest / $days;
$round_daily_interest = round($daily_interest);
print(BRYour daily interest is : $daily_interest);

Thanks
Jennifer Downey



-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] answered my own question

2002-03-01 Thread Matthew Crouch

for anyone else who needs it:

http://wwwphpbuildercom/snippet/downloadphp?type=snippetid=356

Matthew Crouch wrote:

 should be simple as pie, of course, but i can't find a straightforward
 syntax example in the documentation i'm trying to change the PHP date
 format to mysql's

 my code:
 $today = date(MMDD);
 $sql = INSERT into table (date) values ('$today');
 and so on

 is filling the date field with zeros, instead of 2002-02-28


-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Re: Retreiving data from a table

2002-03-01 Thread Matthew Crouch

i'm guessing you use mysql, so
you can use the mysql_insert_id to retrieve the most recent addition, then
select on it

$newid=mysql_insert_id();
$sql=select [the auto_increment field] from table1 where id='$newid';

Does that help?

Morten Nielsen wrote:

 Hi,
 I got the following insert statement in my PHP code:

  $qid = db_query(
  INSERT INTO table1 (
   Name
  ) VALUES (
'$frm[Name]'
  ));

 This is working like I want it to But in the table there is a column, which
 is AUTO_INCREMENT I would like to retreive this number right after I added
 the data
 Can anybody help me?

 Thanks,
 Morten


-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




Re: [PHP-DB] easy date format question

2002-03-01 Thread Jim Lucas [php]

$today = date(Ymd);
$sql = INSERT into table (date) values ('$today');

when the $today variable is inserted into a mysql date column it will fit
just right.
but, if you want to insert it into a timestamp column, you will have to padd
it with 6 zero's

Jim Lucas
www.bend.com

- Original Message -
From: Matthew Crouch [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 01, 2002 2:50 PM
Subject: [PHP-DB] easy date format question


 should be simple as pie, of course, but i can't find a straightforward
 syntax example in the documentation. i'm trying to change the PHP date
 format to mysql's.

 my code:
 $today = date(MMDD);
 $sql = INSERT into table (date) values ('$today');
 and so on...

 is filling the date field with zeros, instead of 2002-02-28


 --
 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




[PHP-DB] Re: Add and Subtract

2002-03-01 Thread Matthew Crouch

my guess is you've got a double-quote problem like that other guy
? $query=SELECT  bank_points FROM wt_users WHERE uid={$session[uid]};
ends after the [ because of the  double quote

Jennifer Downey wrote:

 Hi All,

 Would someone please help me with the following code?

 I am trying to make this work like if I have 15 gold pieces and I deposit 5
 it will subtract 5 from the gold pieces I have and deposit the 5 into my
 account
 showing that I now have 10 gold pieces I can deposit and 5 in the bank

 I would really appreciate any help
 Thanks in advance

 Jen Downey

 BRBRBR

 FORM ACTION=bankphp METHOD=POST TITLE=bank
 TABLE BORDER=0 WIDTH=25% CELLPADDING=0 CELLSPACING=0
 TR
  TDfont size=2Deposit/font/TD
  TD INPUT TYPE=text VALUE= NAME=user_deposit/TD
 /TR
 TR
  TD/TD
  TDINPUT TYPE=submit VALUE=Make My Deposit NAME=deposit/TD
 /TR
 /TABLE
 BRBRBRBRBRBR
 ? $query=SELECT  bank_points FROM wt_users WHERE uid={$session[uid]};

 $ret = mysql_query($query);
 while(list($points)=
 mysql_fetch_row($ret))

 print(BRBRBRYou have $points Gold Pieces you may withdraw!); ?
 BRBRBR
 TABLE BORDER=0 WIDTH=25% CELLPADDING=0 CELLSPACING=0
 TR
  TDfont size=2Withdraw/font/TD
  TD INPUT TYPE=text VALUE= NAME=user_withdraw/TD
 /TR
 TR
  TD/TD
  TDINPUT TYPE=submit VALUE=Make My Withdraw NAME=withdraw/TD
 /TR
 /TABLE
 /FORM
 ?
 $db[bank_points]=(UPDATE wt_users set bank_points = bank_points +
 $user_deposit);
 $result=mysql_query($db[bank_points]);

 $db[bank_points]=(UPDATE wt_users set bank_points = bank_points -
 $user_withdraw);
 $result=mysql_query($db[bank_points]);


-- 
PHP Database Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DB] Security concern with web forms (update of MySQL data base)

2002-03-01 Thread Ronald Wiplinger


A php page, which includes an update statement for a MySQL data base:

I am trying to figure out, how I can make sure that an update form on the 
web cannot include codes, that would update other parts of the database (or 
worse destroy a database).

bye

Ronald




Ronald Wiplinger (ÃQ¤¯¯Ç), CEO, ELMIT - The Solution Provider
Tel. +886 2 8809-7680, Fax. +886 2 2809-0183, Mobile: +886 915 653-452
Net2Phone:8869550066, ICQ: 111651169
http://www.elmit.comhttp://www.wiplinger.org


[PHP-DB] Rounding numbers again.

2002-03-01 Thread Jennifer Downey

Thanks for answering my question I understand rounding now.

My next question is why the script will work like this:

$bank_points= $ret;
$interest = .095;
$months = 12;
$weeks = 52;
$days=365;


$query=SELECT  bank_points FROM wt_users WHERE uid={$session[uid]};
$ret = mysql_query($query);
while(list($bank_points)=
mysql_fetch_row($ret))
 
$yearly_interest=$bank_points * $interest;
$round_yearly= round($yearly_interest);
print(BRYour yearly interest is : $round_yearly Gold Pieces);

$daily_interest=$round_yearly / $days;
$round_daily = round($daily_interest);
print(BRYour daily interest is : $round_daily Gold Pieces);

$query = UPDATE wt_users set bank_points = bank_points + $round_daily WHERE 
uid={$session[uid]};
$result = mysql_query($query);

and not like this.

$bank_points = $ret;
$interest = .095;
$months = 12;
$weeks = 52;
$days=365;

$yearly_interest=$bank_points * $interest;
$round_yearly= round($yearly_interest);


$daily_interest=$round_yearly / $days;
$round_daily = round($daily_interest);

$query = UPDATE wt_users set bank_points = bank_points + $round_daily;
$ret = mysql_query($query);

or this.

$query = UPDATE wt_users set bank_points = bank_points + $round_daily;
$ret = mysql_query($query);

$bank_points = $ret;
$interest = .095;
$months = 12;
$weeks = 52;
$days=365;

$yearly_interest=$bank_points * $interest;
$round_yearly= round($yearly_interest);


$daily_interest=$round_yearly / $days;
$round_daily = round($daily_interest);

$query = UPDATE wt_users set bank_points = bank_points + $round_daily;
$ret = mysql_query($query);

If I use the users session id then it works fine. With the query all I'm doing is 
updating ALL users bank_points right? I want to use cron to update all users at 
midnight.



Thanks again
Jennifer Downey




[PHP-DB] Retrieving a date.

2002-03-01 Thread Ken Thompson

I have a test table with the ususal  customer information in it along with a 
field for the date of birth. I'm trying to return records of any customers 
whose birthdates are the same day and month as the current date.
Here's the query  result:
mysql SELECT * FROM Cinfo WHERE BirthDate  = date('m d');
Empty set (0.00 sec)
Here's what is returned with a global query:
mysql  select * from Cinfo;
+---+--+---+-+---++--+--+--+++
| FirstName | LastName | Address   | City| State | Zip| 
HomePhone| WorkPhone| CellPhone| BirthDate  | id |
+---+--+---+-+---++--+--+--+++
| Joe   | Blow | 1200 High St. #12 | St.Looy | UT| 844110 | 
801-111-2299 | 801-111-3456 | 801-213-8956 | 1959-03-01 |  1 |
|   |  |   | |   ||   
   |  |  ||  2 |
|   |  |   | |   ||   
   |  |  ||  3 |
|   |  |   | |   ||   
   |  |  ||  4 |
+---+--+---+-+---++--+--+--+++
4 rows in set (0.00 sec)

I have a feeling it's the date format in the table. I tried making it a date 
field but just got the current date. What am I doing wrong? 
Off Topic,  I saw something about resetting the auto-increment counter, but 
now I can't find reference to it. Can some kind soul enlighten me???
-- 


Ken Thompson, North West Antique Autos
Payette, Idaho
Email: [EMAIL PROTECTED]
http://www.nwaa.com
Sales and brokering of antique autos and parts.

Linux- Coming Soon To A Desktop Near You
Registered Linux User #183936

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




RE: [PHP-DB] Security concern with web forms (update of MySQL data base)

2002-03-01 Thread Shrock, Court

A quick suggestion would be to build your query normally and then don't run
the query if it has a semicolon that isn't inside quotes.  Also, use single
quotes in the update to make your checks easier:

UPDATE table_name SET field1='value1'

-Original Message-
From: Ronald Wiplinger
To: [EMAIL PROTECTED]
Sent: 3/1/02 6:00 PM
Subject: [PHP-DB] Security concern with web forms (update of MySQL data
base)


A php page, which includes an update statement for a MySQL data base:

I am trying to figure out, how I can make sure that an update form on
the 
web cannot include codes, that would update other parts of the database
(or 
worse destroy a database).

bye

Ronald




Ronald Wiplinger (ÃQ¤¯¯Ç), CEO, ELMIT - The Solution Provider
Tel. +886 2 8809-7680, Fax. +886 2 2809-0183, Mobile: +886 915 653-452
Net2Phone:8869550066, ICQ: 111651169
http://www.elmit.comhttp://www.wiplinger.org

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