Re: [PHP-DB] URGET HELP : Logic Help - for first record do_this for each record after do_that

2002-10-26 Thread Jason Wong
On Saturday 26 October 2002 02:53, Aaron Wolski wrote:

First, don't be so * lazy! You hijack an existing thread by replying to an 
existing post instead of starting a new one. AND you leave the original post 
hanging off the end of your message.

 Basically I need to pull some records out of a database and for the
 first record do_this logic and for each record after in the array
 do_something_else logic.

 How would I approach this?

Using mysql as an example:

if ($row = mysql_fetch_row($result)) {
  // do stuff for first row
}

while ($row = mysql_fetch_row($result)) {
  // do stuff for remaining rows
}

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
When you get your PH.D. will you get able to work at BURGER KING?
*/


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




[PHP-DB] Dealing with Unchecked Checkboxes

2002-10-26 Thread Graeme McLaren
Hey all, I'm trying to get my head around checkboxes.  I can insert checked 
checkboxes into a DB no problem but I get an error when the checkboxes are unchecked.  
I've used the following to try and handle unchecked checkboxes but I still get the 
error query was empty can anyone point me in the right direction?


$number=count($GiftWrapping); 
 for($a=0;$a$number;$a++)
{ 
 echo $GiftWrapping[$a];
 if ( empty( $GiftWrapping ) ) 
 {
 $GW = 'N';
 }

INSERT INTO DB CODE HERE

GiftWrapping = '$GW';

}


Cheers in advance,

Graeme :)


Public Sub House()

On Error Resume drink

 If Pint.empty = True Then
 Pint.refill
   Else
 Pint.drink
 End if

stomach.add Pint

MsgBox  I've had    stomach.count   Pints
MsgBox VERY DRUNK

End Sub




Re: [PHP-DB] Dealing with Unchecked Checkboxes

2002-10-26 Thread Micah Stevens
Unchecked checkboxed do not return a value. They don't return a NULL or 
empty string or anything. So what you have to do is check to see if the 
variable is set. If it is set, then it's checked, if it's not set, then 
it's unchecked.

Kinda sucks if your variable names are dynamic, I just erase the whole 
record and re-insert in that case.

-Micah


At 09:02 PM 10/26/2002 +0100, Graeme McLaren wrote:
Hey all, I'm trying to get my head around checkboxes.  I can insert 
checked checkboxes into a DB no problem but I get an error when the 
checkboxes are unchecked.  I've used the following to try and handle 
unchecked checkboxes but I still get the error query was empty can 
anyone point me in the right direction?


$number=count($GiftWrapping);
 for($a=0;$a$number;$a++)
{
 echo $GiftWrapping[$a];
 if ( empty( $GiftWrapping ) )
 {
 $GW = 'N';
 }

INSERT INTO DB CODE HERE

GiftWrapping = '$GW';

}


Cheers in advance,

Graeme :)


Public Sub House()

On Error Resume drink

 If Pint.empty = True Then
 Pint.refill
   Else
 Pint.drink
 End if

stomach.add Pint

MsgBox  I've had    stomach.count   Pints
MsgBox VERY DRUNK

End Sub


[PHP-DB] File Download - Complete Newbie

2002-10-26 Thread Alex Francis
I am trying to download file stored in a directory on my server. The
information and the path to the file are stored in a MySQL database. This
information is then displayed in a table. I now need to link to the correct
file to download it and hav'nt a clue how to do it. Can someone help or
point me to a tutorial which shows how to do this.



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




Re: [PHP-DB] Dealing with Unchecked Checkboxes

2002-10-26 Thread Mihail Bota
Try to assign a value for each of these variables, or elements of array.
If it is checked let's say is =1,otherwise=0. Then grab the whole set of
variables with GET_VARS or something like this. Create the new array in
the page where you insert data, and then use if's to insert data in your
tables.
I am pretty sure is not the cleanest way, but I hope it makes sense.

Mihai

On Sat, 26 Oct 2002, Micah Stevens wrote:

 Unchecked checkboxed do not return a value. They don't return a NULL or
 empty string or anything. So what you have to do is check to see if the
 variable is set. If it is set, then it's checked, if it's not set, then
 it's unchecked.

 Kinda sucks if your variable names are dynamic, I just erase the whole
 record and re-insert in that case.

 -Micah


 At 09:02 PM 10/26/2002 +0100, Graeme McLaren wrote:
 Hey all, I'm trying to get my head around checkboxes.  I can insert
 checked checkboxes into a DB no problem but I get an error when the
 checkboxes are unchecked.  I've used the following to try and handle
 unchecked checkboxes but I still get the error query was empty can
 anyone point me in the right direction?
 
 
 $number=count($GiftWrapping);
   for($a=0;$a$number;$a++)
 {
   echo $GiftWrapping[$a];
   if ( empty( $GiftWrapping ) )
   {
   $GW = 'N';
   }
 
 INSERT INTO DB CODE HERE
 
 GiftWrapping = '$GW';
 
 }
 
 
 Cheers in advance,
 
 Graeme :)
 
 
 Public Sub House()
 
 On Error Resume drink
 
   If Pint.empty = True Then
   Pint.refill
 Else
   Pint.drink
   End if
 
 stomach.add Pint
 
 MsgBox  I've had    stomach.count   Pints
 MsgBox VERY DRUNK
 
 End Sub



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




Re: [PHP-DB] File Download - Complete Newbie

2002-10-26 Thread Micah Stevens
if you have the following variables:

$path = your download directory path, relative to the webserver address. 
Like http://www.yoursite.com/downloads/;.
$file = filename
$name = Name or description of file.

Just create your table, and in the proper cell, put:

echo a href=\$path$file\$name/a;

The webserver and browser should take care of the rest.

-Micah



At 09:51 PM 10/26/2002 +0100, Alex Francis wrote:
I am trying to download file stored in a directory on my server. The
information and the path to the file are stored in a MySQL database. This
information is then displayed in a table. I now need to link to the correct
file to download it and hav'nt a clue how to do it. Can someone help or
point me to a tutorial which shows how to do this.



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



Re: [PHP-DB] PHP-ODBC

2002-10-26 Thread Andrew Hill
Nithin,

This issue is due to the ODBCINI environment variable not being set by 
in your PHP script, or the odbc.ini file that variable points to not 
being readable by the user that Apache runs as.  Check out the 
PHP-ODBC-HOWTO at www.iodbc.org for examples of what environment 
variables need to be set to connect properly.

Best regards,
Andrew Hill
Director of Technology Evangelism - OpenLink Software
Universal Data Access and the Virtuoso Universal Server
http://www.openlinksw.com/virtuoso/whatis.htm

On Thursday, October 24, 2002, at 10:24 AM, Poduval, Nithin wrote:

Hi All,
We are also facing a problem in connecting PHP with database,
We are trying to access the MS SQL Server 2000 which runs on Windows 
2000
from the php in the Linux 7.2.
During access the php, it gives the followin message.
Warning: SQL error: [iODBC][Driver Manager]Data source name not found 
and no
default driver specified. Driver could not be loaded, SQL state IM002 
in
We do followed all the step done by you.
We would like to know how did you solve the issue. We have been using 
the
Openlink database driver.Please help in this issue.
Thanks In Advance.
With Regards,
Nithin



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




Re: [PHP-DB] Dealing with Unchecked Checkboxes

2002-10-26 Thread Graeme McLaren
Mihail, do u mean something like this?

?
if (!isset($pick)) {
echo Fill out and submit the form below.; }
else {
$j = count($pick);
for($i=0; $i$j; $i++) {
echo Pick b$pick[$i]/b is Checkedbr /; }
}
?

form action=? echo $PHP_SELF; ?
ol
liPaintinginput name=pick[] type=checkbox value=Painting //li
liPlumbinginput name=pick[] type=checkbox value=Plumbing //li
liElectricinput name=pick[] type=checkbox value=Electric //li
/ol

input type=submit value=Submit! /
input type=reset value=Reset /
/form


Cheers,

Graeme :)

- Original Message - 
From: Mihail Bota [EMAIL PROTECTED]
To: Micah Stevens [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, October 26, 2002 10:01 PM
Subject: Re: [PHP-DB] Dealing with Unchecked Checkboxes


 Try to assign a value for each of these variables, or elements of array.
 If it is checked let's say is =1,otherwise=0. Then grab the whole set of
 variables with GET_VARS or something like this. Create the new array in
 the page where you insert data, and then use if's to insert data in your
 tables.
 I am pretty sure is not the cleanest way, but I hope it makes sense.
 
 Mihai
 
 On Sat, 26 Oct 2002, Micah Stevens wrote:
 
  Unchecked checkboxed do not return a value. They don't return a NULL or
  empty string or anything. So what you have to do is check to see if the
  variable is set. If it is set, then it's checked, if it's not set, then
  it's unchecked.
 
  Kinda sucks if your variable names are dynamic, I just erase the whole
  record and re-insert in that case.
 
  -Micah
 
 
  At 09:02 PM 10/26/2002 +0100, Graeme McLaren wrote:
  Hey all, I'm trying to get my head around checkboxes.  I can insert
  checked checkboxes into a DB no problem but I get an error when the
  checkboxes are unchecked.  I've used the following to try and handle
  unchecked checkboxes but I still get the error query was empty can
  anyone point me in the right direction?
  
  
  $number=count($GiftWrapping);
for($a=0;$a$number;$a++)
  {
echo $GiftWrapping[$a];
if ( empty( $GiftWrapping ) )
{
$GW = 'N';
}
  
  INSERT INTO DB CODE HERE
  
  GiftWrapping = '$GW';
  
  }
  
  
  Cheers in advance,
  
  Graeme :)
  
  
  Public Sub House()
  
  On Error Resume drink
  
If Pint.empty = True Then
Pint.refill
  Else
Pint.drink
End if
  
  stomach.add Pint
  
  MsgBox  I've had    stomach.count   Pints
  MsgBox VERY DRUNK
  
  End Sub
 
 
 
 -- 
 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] Dealing with Unchecked Checkboxes

2002-10-26 Thread Mihail Bota
I think you should a loop under the form.
my 2 cents...

Mihai

On Sat, 26 Oct 2002, Graeme McLaren wrote:

 Mihail, do u mean something like this?

 ?
 if (!isset($pick)) {
 echo Fill out and submit the form below.; }
 else {
 $j = count($pick);
 for($i=0; $i$j; $i++) {
 echo Pick b$pick[$i]/b is Checkedbr /; }
 }
 ?

 form action=? echo $PHP_SELF; ?
 ol
 liPaintinginput name=pick[] type=checkbox value=Painting //li
 liPlumbinginput name=pick[] type=checkbox value=Plumbing //li
 liElectricinput name=pick[] type=checkbox value=Electric //li
 /ol

 input type=submit value=Submit! /
 input type=reset value=Reset /
 /form


 Cheers,

 Graeme :)

 - Original Message -
 From: Mihail Bota [EMAIL PROTECTED]
 To: Micah Stevens [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Saturday, October 26, 2002 10:01 PM
 Subject: Re: [PHP-DB] Dealing with Unchecked Checkboxes


  Try to assign a value for each of these variables, or elements of array.
  If it is checked let's say is =1,otherwise=0. Then grab the whole set of
  variables with GET_VARS or something like this. Create the new array in
  the page where you insert data, and then use if's to insert data in your
  tables.
  I am pretty sure is not the cleanest way, but I hope it makes sense.
 
  Mihai
 
  On Sat, 26 Oct 2002, Micah Stevens wrote:
 
   Unchecked checkboxed do not return a value. They don't return a NULL or
   empty string or anything. So what you have to do is check to see if the
   variable is set. If it is set, then it's checked, if it's not set, then
   it's unchecked.
  
   Kinda sucks if your variable names are dynamic, I just erase the whole
   record and re-insert in that case.
  
   -Micah
  
  
   At 09:02 PM 10/26/2002 +0100, Graeme McLaren wrote:
   Hey all, I'm trying to get my head around checkboxes.  I can insert
   checked checkboxes into a DB no problem but I get an error when the
   checkboxes are unchecked.  I've used the following to try and handle
   unchecked checkboxes but I still get the error query was empty can
   anyone point me in the right direction?
   
   
   $number=count($GiftWrapping);
 for($a=0;$a$number;$a++)
   {
 echo $GiftWrapping[$a];
 if ( empty( $GiftWrapping ) )
 {
 $GW = 'N';
 }
   
   INSERT INTO DB CODE HERE
   
   GiftWrapping = '$GW';
   
   }
   
   
   Cheers in advance,
   
   Graeme :)
   
   
   Public Sub House()
   
   On Error Resume drink
   
 If Pint.empty = True Then
 Pint.refill
   Else
 Pint.drink
 End if
   
   stomach.add Pint
   
   MsgBox  I've had    stomach.count   Pints
   MsgBox VERY DRUNK
   
   End Sub
  
 
 
  --
  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




RE: [PHP-DB] PHP and MS-SQL

2002-10-26 Thread Frank M. Kromann
Hi,

It is true that FreeTDS works with MS SQL Server, but I think you need a bit more info:

Sybase and MS SQL Server used to be the same product back when 4.x was released. Then 
Microsoft released 6.0 including a set of C libraries and everything was fine. 
Microsoft has not released new versions of the C libraries but they have added a lot 
of new features to the server with version 6.5, 7.0 and 2000. These features are not 
available from the C libraries so no matter if you are using the native MSSQL 
extension for Win32 or you use the Sybase extension with FreeTDS you are limited to 
the features available in version 6.0 of MS SQL Server.

These limitations include char and varchar columns with maximum 255 bytes. No support 
for nchar, nvarchar or ntext and other types as well. If you can design your tables 
without using the new features you should be able to make it work.

One of the big differences in the SQL is support for views and subselects in MS SQL 
Server but stuff like LIMIT is not supported (though you can do a select top * ...).

- Frank

 Thanks John!
 Say, are there any arguments not to use MS-SQL?
 Did you run into any problems?
 
 Thanks,
 Axel
 
 -Original Message-
 From: Negretti, John (CCI-San Diego) [mailto:John.Negretti;cox.com]
 Sent: Friday, October 25, 2002 3:14 PM
 To: Axel; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] PHP and MS-SQL
 
 Axel,
 
 Well, I'm not sure what everyone will tell you, but this is what I did.  I 
used MyODBC (on windows) to connect to SQL Server using the built-in odbc_***() 
PHP functions.  There is also the matter of changing your SQL Statements to be 
compatible with SQL Server.  MySQL and SQL Server have quite a few differences with 
SQL Statements.  As far as the rest of your code, it should not matter if it's on 
UNIX or Windows.
 
 John Negretti
 Web Applications Developer
 Cox Communications www.cox.com
 
 
  -Original Message-
  From: Axel [mailto:bergmann;hi.net]
  Sent: Friday, October 25, 2002 6:57 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] PHP and MS-SQL
 
 
  I want to apologize for my ignorance in advance...
  I'm developing PHP code with MySQL on Unix platforms for
  quite a while. Now
  I'm asked to use my unix based PHP code with a MS-SQL database on a
  Microsoft platform. So while having the php code on a unix
  platform the
  MS-SQL database is obviously sitting on a Microsoft platform.
  Can this work
  and if so how can I do this?
 
  Thanks,
  Axel
  __
   Axel
  Bergmann ICQ#: 114599496 Current ICQ status: + More ways to contact me
  __
 
 
 
  --
  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




Re: [PHP-DB] Function that outputs at line xxx

2002-10-26 Thread Frank M. Kromann
Hi,

A new function 'debug_backtrace()' will be available in PHP 4.3.0. This function will 
print a list of all the functions called.

- Frank

 Yeah, I understand what your asking. I don't know of any method to get the
 line number a function was called on, from within the function.
 
 You may have to pass __LINE__ and __FILE__ in your db_query() function, or
 whatever it is.
 
 ---John Holmes...
 
 - Original Message -
 From: Peter Beckman [EMAIL PROTECTED]
 To: 1LT John W. Holmes [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Wednesday, October 23, 2002 3:26 PM
 Subject: Re: [PHP-DB] Function that outputs at line xxx
 
 
  John, that does work!  Thanks.
 
  The problem is this:
 
  Database calls are in db.inc.  The script problem occurs in wine.inc.
  True, the SQL is called and executed from db.inc, so __LINE__ and __FILE__
  are correct in a way.  But how do I find out where in the execution of my
  script the other files are in their execution?
 
  index.php -- calls function in
  wine.inc -- calls function in
  db.inc -- throws SQL error, calls function in
  wine.inc -- which prints error to user nicely and exits
 
  What I want is when db.inc throws the error and passes the error text to
  the db_error function in wine.inc to look pretty for the user, I want to
  know where the function db_query was called in wine.inc (one level up, the
  script which called the function now running).
 
  Is this possible?  Does it exist?
 
  Peter
 
  On Wed, 23 Oct 2002, 1LT John W. Holmes wrote:
 
   __LINE__ and __FILE__ should work.
  
   ---John Holmes...
   - Original Message -
   From: Peter Beckman [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Wednesday, October 23, 2002 3:00 PM
   Subject: [PHP-DB] Function that outputs at line xxx
  
  
Hey --
   
I'm writing a database error handler function in PHP, and I want it to
   tell
me at what line in what script the error occurred.  Is this possible?
 I
know it happens when PHP hits a warning or a fatal error, but is it
possible to do in a live script?  Or is there a global variable which
   keeps
track of what line in which scripts each execution is at?
   
Thanks,
Peter
  
  --
   -
Peter BeckmanSystems Engineer, Fairfax Cable Access
   Corporation
[EMAIL PROTECTED]
   http://www.purplecow.com/
  
  --
   -
   
   
--
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
  
 
  --
 -
  Peter BeckmanSystems Engineer, Fairfax Cable Access
 Corporation
  [EMAIL PROTECTED]
 http://www.purplecow.com/
  --
 -
 
 
 
 -- 
 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] sybase jaguar CTS -- PHP

2002-10-26 Thread Buics
hi,
I would like to ask if PHP is capable of accessing a jaguar component
server,
My web server and jaguar cts is in separate box.
jaguar cts can serve CORBA, is PHP capable of using CORBA objects?
any suggestions are highly appreciated.

-- buics

--
  We are what we repeatedly do. Excellence,
 then, is not an act, but a habit.
-Aristotle(BC 384-322 Greek Philosopher)



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