RE: [PHP-DB] elseif with header

2003-01-21 Thread Bruno Pereira
I Larry is correct you havo to use (==) not (=).
The first one is comparing two variables and the second is that var is equal
to another var.

Cumprimentos

Bruno Pereira
[EMAIL PROTECTED]

-Original Message-
From: Larry E. Ullman [mailto:[EMAIL PROTECTED]]
Sent: terca-feira, 21 de Janeiro de 2003 0:29
To: Addison Ellis
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] elseif with header


 if ($category = 2 and $subcategory = 52)
 {
header(Location:
 http://www.vanderbilt.edu/register/ca/vacation_rentals.php;);
 }
 elseif ($category = 2 and $subcategory = 50)
 {
header(Location:
 http://www.vanderbilt.edu/register/ca/rentals.php;);
 }  , etc.

  for some reason all the elseifs are going to the if header.
 any input as to how i can correct this is greatly appreciated.

You are using the assignment operator (=) instead of the equals
comparison operator (==) which makes your if condition always true.

Larry


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

2003-01-21 Thread Baumgartner Jeffrey
A couple of questions of efficiency, please:

1. If I am creating a web page with numerous PHP calls to an MySQL database
is it more efficient to have lots of small blocks of php in an html page or
is it better to have just one or two big blocks of PHP with the html code
being delivered via echo statements?

2. If I want to know how many rows there are in a MySQL table, I can either
use the count function in MySQL (although I am having trouble figuring out
how to capture that value in a variable) or I can do a general select *
from from command in MySQL and then use the mysql_num_rows function in PHP
to get a row count (which is dead easy). It SEEMS to me the former would be
more efficient. Am I correct? 

Many thanks! 

Jeffrey Baumgartner

eBusiness Consultant - ITP Europe
http://www.itp-europe.com
[EMAIL PROTECTED]
+32 2 721 51 00


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




[PHP-DB] Re: Problem in the returnvalue of a function

2003-01-21 Thread Ruprecht Helms

Hi  Bayu Susiloadhy,

thanks for your answer.

   function select_price($product_id,$quantity) {
  --cut--
 return True;
}
  --cut--

in the meentime I change the code that not a boolevalue
was returned by the function.

$q is my querystring and $db is the selected database.

I insert the following:

   $db-query($q);
$result=mysql_db_query($db,$q);

while ($row = mysql_fetch_object($result))
{
$price = $row-product_price;
}
mysql_free_result($result);
echo \n;
echo $q;  // to show the sql-statement in runtime - diagnostics
echo \n;
return $price;


By executing it I get two warnings  both this is not a valid Mysql-result
resort. The disliked lines are the begin of the while-loop and an the
mysql_free_result($result)-command.

How have I to change up the script to get the product_price related to the
price_group.

Regards,
Ruprecht


--
Ruprecht Helms IT-Service und Softwareentwicklung

Tel/Fax.:  +49[0]7621 16 99 16
Homepage:  http://www.rheyn.de
email:  [EMAIL PROTECTED]
--

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




[PHP-DB] image in mysql?

2003-01-21 Thread Henry
is that possible in mysql that store image in mysql db , just like oracle's blob/bfile 
...
and how to extract these binary into real image if I use php?


Re: [PHP-DB] Efficiency

2003-01-21 Thread Paul Burney
on 1/21/03 6:16 AM, Baumgartner Jeffrey at [EMAIL PROTECTED]
appended the following bits to my mbox:

 1. If I am creating a web page with numerous PHP calls to an MySQL database
 is it more efficient to have lots of small blocks of php in an html page or
 is it better to have just one or two big blocks of PHP with the html code
 being delivered via echo statements?

This gets discussed very frequently here and in PHP-General.  Check the
archives for the discussions, but the general consensus is that it doesn't
matter much.

I tend more toward the echo statements (FYI: use commas rather than dots)
because for me, the code looks nicer with syntax highlighting.

If you don't hand code your HTML (i.e., use Dreamweaver, GoLive, etc), the
small php blocks might be easier to manage.

 2. If I want to know how many rows there are in a MySQL table, I can either
 use the count function in MySQL (although I am having trouble figuring out
 how to capture that value in a variable) or I can do a general select *
 from from command in MySQL and then use the mysql_num_rows function in PHP
 to get a row count (which is dead easy). It SEEMS to me the former would be
 more efficient. Am I correct?

If you are doing a select on the data anyway, it is better to call
MySQL_num_rows on the result you obtained.  If you just want the total
number and won't be fetching the rows, do the query.  Example:

$dbh is your database connection
$q = 'SELECT COUNT(*) FROM tablename';
list($my_count) = MySQL_fetch_row(MySQL_query($q,$dbh));

The $my_count variable now has your number of rows.

Hope that helps.

Sincerely,

Paul Burney
http://paulburney.com/

Q: Tired of creating admin interfaces to your MySQL web applications?

A: Use MySTRI instead. http://www.burney.ws/software/mystri/



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




Re: [PHP-DB] image in mysql?

2003-01-21 Thread Paul Burney
on 1/21/03 7:00 AM, Henry at [EMAIL PROTECTED] appended the following bits
to my mbox:

 is that possible in mysql that store image in mysql db , just like oracle's
 blob/bfile ...
 and how to extract these binary into real image if I use php?

This has been answered numerous times on the list.  Check the archives:

http://marc.theaimsgroup.com/?l=php-db

Also, a google search:

http://www.google.com/search?q=mysql+php+image+blob

Turns up a good tutorial as the first result:

http://www.phpbuilder.com/columns/florian19991014.php3

Hope that helps.

Sincerely,

Paul Burney
http://paulburney.com/

Q: Tired of creating admin interfaces to your MySQL web applications?

A: Use MySTRI instead. http://www.burney.ws/software/mystri/



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




Re: [PHP-DB] image in mysql?

2003-01-21 Thread Henry
thanks , that helps a lot to me!!
one more question, can I use HTML's img to show the image with other thing
instead of only image?


- Original Message -
From: Paul Burney [EMAIL PROTECTED]
To: Henry [EMAIL PROTECTED]; PHP Database List [EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 9:44 PM
Subject: Re: [PHP-DB] image in mysql?


 on 1/21/03 7:00 AM, Henry at [EMAIL PROTECTED] appended the following bits
 to my mbox:

  is that possible in mysql that store image in mysql db , just like
oracle's
  blob/bfile ...
  and how to extract these binary into real image if I use php?

 This has been answered numerous times on the list.  Check the archives:

 http://marc.theaimsgroup.com/?l=php-db

 Also, a google search:

 http://www.google.com/search?q=mysql+php+image+blob

 Turns up a good tutorial as the first result:

 http://www.phpbuilder.com/columns/florian19991014.php3

 Hope that helps.

 Sincerely,

 Paul Burney
 http://paulburney.com/

 Q: Tired of creating admin interfaces to your MySQL web applications?

 A: Use MySTRI instead. http://www.burney.ws/software/mystri/



 --
 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] image in mysql?

2003-01-21 Thread Henry
Oops...Sorry , I got the answer...thanks anyway ^_^

- Original Message -
From: Henry [EMAIL PROTECTED]
To: Paul Burney [EMAIL PROTECTED]; PHP Database List
[EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 10:24 PM
Subject: Re: [PHP-DB] image in mysql?


 thanks , that helps a lot to me!!
 one more question, can I use HTML's img to show the image with other
thing
 instead of only image?


 - Original Message -
 From: Paul Burney [EMAIL PROTECTED]
 To: Henry [EMAIL PROTECTED]; PHP Database List
[EMAIL PROTECTED]
 Sent: Tuesday, January 21, 2003 9:44 PM
 Subject: Re: [PHP-DB] image in mysql?


  on 1/21/03 7:00 AM, Henry at [EMAIL PROTECTED] appended the following
bits
  to my mbox:
 
   is that possible in mysql that store image in mysql db , just like
 oracle's
   blob/bfile ...
   and how to extract these binary into real image if I use php?
 
  This has been answered numerous times on the list.  Check the archives:
 
  http://marc.theaimsgroup.com/?l=php-db
 
  Also, a google search:
 
  http://www.google.com/search?q=mysql+php+image+blob
 
  Turns up a good tutorial as the first result:
 
  http://www.phpbuilder.com/columns/florian19991014.php3
 
  Hope that helps.
 
  Sincerely,
 
  Paul Burney
  http://paulburney.com/
 
  Q: Tired of creating admin interfaces to your MySQL web applications?
 
  A: Use MySTRI instead. http://www.burney.ws/software/mystri/
 
 
 
  --
  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] MySql DB, help, sql error and i don't know why

2003-01-21 Thread David Rice

SQL-query :

CREATE TABLE `staff` (

`StaffId` INT( 4 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`Name` VARCHAR( 30 ) NOT NULL ,
`Surname` VARCHAR( 30 ) NOT NULL ,
`Address` TEXT( 225 ) NOT NULL ,
`JobId` SMALLINT( 2 ) NOT NULL ,
`PermissionId` SMALLINT( 2 ) NOT NULL ,
`HomePhone` INT( 11 ) NOT NULL ,
`MobilePhone` INT( 11 ) NOT NULL ,
`TipsPoints` INT( 1 ) NOT NULL ,
`DOB` DATE NOT NULL ,
`Password` VARCHAR( 20 ) NOT NULL ,
`ResterauntId` INT( 1 ) NOT NULL ,
`DateStarted` DATE NOT NULL ,
`StaffStatusId` TINYINT( 1 ) NOT NULL
)

MySQL said:


You have an error in your SQL syntax near '(225) NOT NULL, `JobId` 
SMALLINT(2) NOT NULL, `PermissionId` SMALLINT(2) NOT NUL' at line 1






_
MSN 8: advanced junk mail protection and 2 months FREE*. 
http://join.msn.com/?page=features/junkmail


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



RE: [PHP-DB] MySql DB, help, sql error and i don't know why

2003-01-21 Thread Hutchins, Richard
I'm pretty sure that the error is because you're not able to set a length
for the TEXT column type. I checked the MySQL manual and it does not show a
prototype with that optional parameter. Besides, if you want a TEXT of
(255), why not just use a VARCHAR (255)? They're essentially the same thing
and you can GROUP BY or ORDER BY on the VARCHAR without any conversion.

 -Original Message-
 From: David Rice [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 21, 2003 10:11 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] MySql DB, help, sql error and i don't know why
 
 
 
 SQL-query :
 
 CREATE TABLE `staff` (
 
 `StaffId` INT( 4 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
 `Name` VARCHAR( 30 ) NOT NULL ,
 `Surname` VARCHAR( 30 ) NOT NULL ,
 `Address` TEXT( 225 ) NOT NULL ,
 `JobId` SMALLINT( 2 ) NOT NULL ,
 `PermissionId` SMALLINT( 2 ) NOT NULL ,
 `HomePhone` INT( 11 ) NOT NULL ,
 `MobilePhone` INT( 11 ) NOT NULL ,
 `TipsPoints` INT( 1 ) NOT NULL ,
 `DOB` DATE NOT NULL ,
 `Password` VARCHAR( 20 ) NOT NULL ,
 `ResterauntId` INT( 1 ) NOT NULL ,
 `DateStarted` DATE NOT NULL ,
 `StaffStatusId` TINYINT( 1 ) NOT NULL
 )
 
 MySQL said:
 
 
 You have an error in your SQL syntax near '(225) NOT NULL, `JobId` 
 SMALLINT(2) NOT NULL, `PermissionId` SMALLINT(2) NOT NUL' at line 1
 
 
 
 
 
 
 _
 MSN 8: advanced junk mail protection and 2 months FREE*. 
 http://join.msn.com/?page=features/junkmail
 
 
 -- 
 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: MySql DB, help, sql error and i don't know why

2003-01-21 Thread J.Veenhuijsen
use `Address` TEXT NOT NULL ,

Jochem

David Rice wrote:


SQL-query :

CREATE TABLE `staff` (

`StaffId` INT( 4 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`Name` VARCHAR( 30 ) NOT NULL ,
`Surname` VARCHAR( 30 ) NOT NULL ,
`Address` TEXT( 225 ) NOT NULL ,
`JobId` SMALLINT( 2 ) NOT NULL ,
`PermissionId` SMALLINT( 2 ) NOT NULL ,
`HomePhone` INT( 11 ) NOT NULL ,
`MobilePhone` INT( 11 ) NOT NULL ,
`TipsPoints` INT( 1 ) NOT NULL ,
`DOB` DATE NOT NULL ,
`Password` VARCHAR( 20 ) NOT NULL ,
`ResterauntId` INT( 1 ) NOT NULL ,
`DateStarted` DATE NOT NULL ,
`StaffStatusId` TINYINT( 1 ) NOT NULL
)

MySQL said:


You have an error in your SQL syntax near '(225) NOT NULL, `JobId` 
SMALLINT(2) NOT NULL, `PermissionId` SMALLINT(2) NOT NUL' at line 1






_
MSN 8: advanced junk mail protection and 2 months FREE*. 
http://join.msn.com/?page=features/junkmail



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




[PHP-DB] repost..odbc

2003-01-21 Thread Edward Peloke
I apologize if you subscribe to the php general list also as this is a
re-posting from there..


I know I can connect to another db through an odbc connection in php.  Can I
use php to create the connection initially?  I will be uploading an access
db from the users and then moving the data over into my mysql db.  Since
this will all be done automatically, I will need php to upload the
file,create the odbc connection, connect, pump over the data, then delete
the connection.

Thanks,
Eddie


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




Re: [PHP-DB] Sybase_Connect

2003-01-21 Thread Cameron
Now I get a pop up that says:
Unknown(): Unable to load dynamic library
'F:\PHP\extensions\php_sybase_ct.dll' = The specified module could not be
found.

I've looked for spelling errors multiple time and I am absolutly 100%
positive that the file is located with in that directory and is named
exactly as it is up above
AHH!!! WHAT DO I DO!?
- Original Message -
From: Buics [EMAIL PROTECTED]
To: Cameron Powell [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, January 20, 2003 5:52 PM
Subject: Re: [PHP-DB] Sybase_Connect


 try to look at your php.ini file, then uncomment this line

 extension=php_sybase_ct.dll

 and also make sure that you setup your extension directory.

 ; Directory in which the loadable extensions (modules) reside.
 extension_dir = c:\php\

 after that, restart your web server.

 best regards
 --buics



 Cameron Powell wrote:

  Im trying to figure out Sybase and I cant even seem to get past the
first
  step of connecting
  Heres my code:
  ?php
  $con = sybase_connect(localhost, EXP, SQL);
  sybase_select_db(EXPADMIN);
  $qry = sybase_query(select * from EXP.access, $con);
 
  echo sybase_result($qry, 1, 1);
 
  sybase_close($con);
  ?
  Heres the error:
  Fatal error: Call to undefined function: sybase_connect() in F:\Program
  Files\Apache Group\Apache\htdocs\index.php on line 8
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

 --
Life is half spent before we know what it is
-unknown




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




[PHP-DB] Problem loading images into MySQL

2003-01-21 Thread Chris Wright
I'm having big problems getting PHP to load images into a MySQL database. I
can and have loaded images perfectly via other routes but when I try to do
it via PHP the data always ends up corrupted. I don't get any errors but the
binary data is always knackered.

I'm using PHP 4.3.0/Apache 2.0.43 on Windows 2000 and MySQL 4.0.7-gamma
(also tested with MySQL 3.X) running on a linux box. The upload and post max
settings in PHP are both set at 20mb and the size limit to MySQL is also at
20mb. As I said I can load the same files into the database via other routes
without problems.

The code I'm using is as follows, any ideas what the problem is?

session_start();

MYSQL_CONNECT(192.168.1.10,loginname,password) or die('Unable to open
database');
 mysql_select_db(ImageDB) or die('Unable to select database');
$data = addslashes(fread(fopen($_FILES['UpImg']['tmp_name'], r),
filesize($_FILES['UpImg']['tmp_name'])));

 $Qry=INSERT INTO Images (ID,Image,mime,size,OrgName)
VALUES
(.$_SESSION['SessID'].,\$data\,\.$_FILES['UpImg']['type'].\,.$_FILE
S['UpImg']['size'].,\.$_FILES['UpImg']['name'].\);

$result=MYSQL_QUERY($Qry) or die(PDB Write ErrorP.mysql_error());


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




[PHP-DB] build menu with mysql data

2003-01-21 Thread Marc Bleuler
Hi,

I would like to bild a tree menu with mySQL data. where I have the collapsed
main menue and when I click the link the specific submenue expands (as
follow).

(collapsed Main Menu)
+ Home
+ Downloads
+ About me
+ Search

and for example if I click the Download section it will look as
follow

(expanded Main-Sub Menu)
+ Home
+ Downloads
- Music
- Programm
+ About me
+ Search

and the SQL Tables...

MAINMENUE_TABLE
IDNAME
-
|1|Home|
|2|Downloads|
|3|About me  |
|4|Search   |

and

SUBMENUE_TABLE
IDMAIN_ID  NAMEURL
---
|1|2|Music|
./somefile.php?action=music
|2|2|Programm |
./somefile.php?action=programm
|3|3|Pictures |
./somefile.php?action=pictures
|4|3|Address|
./somefile.php?action=address
|5|4|My Page   |
./somefile.php?action=mypage
|6|4|The Web   |
./somefile.php?action=theweb
|7|4|Google  |
./somefile.php?action=google


If I'm using a while loop it won't work, so I realy don't have and more
ideas...
Please consider in your explanations I'm a PHP beginner... :-)

thanks
Marc



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




[PHP-DB] RE: [PHP] build menu with mysql data

2003-01-21 Thread Edward Peloke
Marc,

I did something sort of along these lines with an 'auction' site I worked
on.  I displayed rows from a db.  If the row had bid information in the db
(or your case submenu info) then a + sign icon was displayed next to it.  IF
the plus sign was clicked, the page would reload and the bid or submenu info
would be displayed and the + sign would change to a - sign to give the
appearence of a tree menu.   Can you post some of your code?

Eddie

-Original Message-
From: Marc Bleuler [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 21, 2003 12:31 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] build menu with mysql data


Hi,

I would like to bild a tree menu with mySQL data. where I have the collapsed
main menue and when I click the link the specific submenue expands (as
follow).

(collapsed Main Menu)
+ Home
+ Downloads
+ About me
+ Search

and for example if I click the Download section it will look as
follow

(expanded Main-Sub Menu)
+ Home
+ Downloads
- Music
- Programm
+ About me
+ Search

and the SQL Tables...

MAINMENUE_TABLE
IDNAME
-
|1|Home|
|2|Downloads|
|3|About me  |
|4|Search   |

and

SUBMENUE_TABLE
IDMAIN_ID  NAMEURL
---
|1|2|Music|
./somefile.php?action=music
|2|2|Programm |
./somefile.php?action=programm
|3|3|Pictures |
./somefile.php?action=pictures
|4|3|Address|
./somefile.php?action=address
|5|4|My Page   |
./somefile.php?action=mypage
|6|4|The Web   |
./somefile.php?action=theweb
|7|4|Google  |
./somefile.php?action=google


If I'm using a while loop it won't work, so I realy don't have and more
ideas...
Please consider in your explanations I'm a PHP beginner... :-)

thanks
Marc



--
PHP General 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] using Flat File

2003-01-21 Thread web man

Hi Guys,

i wondered if there any assistance you could do for me on this code.

I have called on God many times to assist me but He did not respond.

I hope you would.

What I am trying to do is to allow certain users to view a certain page . I stored 
their names and passwords in a file.txt

But the is not working is there any help??

?php  

$auth = false;  
if (isset( $PHP_AUTH_USER ) amp;amp; isset($PHP_AUTH_PW)) {  


$filename = 'c:\\php_data\\file.txt'; 
$f = @fopen($filename, r);  
 if ($f != FALSE)  
 {$a = @fread($f, filesize($filename)); 
fclose($f);  
 }  
 else  
 {  
  echo Could not open file;  
 }  



$lines = explode ( \n, $file_contents );  



foreach ( $lines as $line ) {  

list( $username, $password ) = explode( ':', $line );  

if ( ( $username == $PHP_AUTH_USER ) amp;amp;  
 ( $password == $PHP_AUTH_PW ) ) {  

 
   

$auth = true;  
break;  

}  
}  

}  

if ( ! $auth ) {  

header( 'WWW-Authenticate: Basic realm=Private' );  
header( 'HTTP/1.0 401 Unauthorized' );  
echo 'Authorization Required.';  
exit;  

} else {  

echo 'PYou are authorized!/P';  
}  

?  





-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


[PHP-DB] tutorials

2003-01-21 Thread Jon Miller
Looking for a php/mysql tutorial on how to handle mathamatical
functions.
-- 
Jon Miller [EMAIL PROTECTED]
MMT Networks Pty Ltd



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




Re: [PHP-DB] tutorials

2003-01-21 Thread Jeffrey_N_Dyke

if you're looking to do math in sql, i'd look to the mysql manual.  lots of
great examples.  basically same answer for php.  i'd start there...if you
don't find what you're looking for .google.

www.php.net/math
www.mysql.com

hth
Jeff


   
  
Jon Miller 
  
jlmiller@mmtnetwor   To: PHP List [EMAIL PROTECTED]  
  
ks.com.aucc:  
  
  Subject: [PHP-DB] tutorials  
  
01/21/2003 05:52 PM
  
   
  
   
  




Looking for a php/mysql tutorial on how to handle mathamatical
functions.
--
Jon Miller [EMAIL PROTECTED]
MMT Networks Pty Ltd



--
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] preview form field entries before db submission?

2003-01-21 Thread Addison Ellis
hello,
	do you know of a way to preview form field entries in a new 
page, the way they will appear in a query result, so that the user 
has a chance to edit their entries prior to their actual submission 
to the db?
	thank you and best, addison
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



[PHP-DB] session_destroy(); on submit?

2003-01-21 Thread Addison Ellis
hello,
	will the following work or should i be attempting something else?

/form
input type=submit name=submit value=Submit 
onClick=?session_unset();,session_destroy();?
input type=hidden name=url  value=http://www.etc.com;
	thank you and best, addison
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



Re: [PHP-DB] session_destroy(); on submit?

2003-01-21 Thread Paul Burney
on 1/21/03 9:19 PM, Addison Ellis at [EMAIL PROTECTED] appended the
following bits to my mbox:

 hello,
 will the following work or should i be attempting something else?
 
 /form
 input type=submit name=submit value=Submit
 onClick=?session_unset();,session_destroy();?
 input type=hidden name=url  value=http://www.etc.com;
 thank you and best, addison

No, it will not work.  PHP is  server side, JavaScript (onClick, etc.) is
client side.  Have the form submit to a PHP page that has the session
functions at the top.

HTH.

Sincerely,

Paul Burney
http://paulburney.com/

Q: Tired of creating admin interfaces to your MySQL web applications?

A: Use MySTRI instead. http://www.burney.ws/software/mystri/


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




RE: [PHP-DB] preview form field entries before db submission?

2003-01-21 Thread John W. Holmes
   do you know of a way to preview form field entries in a new
 page, the way they will appear in a query result, so that the user
 has a chance to edit their entries prior to their actual submission
 to the db?

Just store the values in a session or hidden fields and show the display
to the user. If the user accepts it, use the session/fields to insert
the data

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




[PHP-DB] Cookies problems

2003-01-21 Thread Sabina Alejandr Schneider
Hello people!!! This time I have a problem with cookies. I 
tried to send a cookie from one page with the function 
sendcookie(chat,$mail) to a page in another directory, 
but when I tried to prine echo($chat) or 
echo($_COOKIE[chat]) I got notheing. So I put the second 
page where it was the page that sent the cookie and tried 
again. This last time I got the cookie in the echo($chat) 
but not in the echo($_COOKIE[chat]) I need to send a 
cookie to a page in another path and I need that the 
cookie stays in the client browser so I can see if I can 
recognize him/ her next time he/she enters the chat. Was I 
clear? Thank you very much for all of your help and 
time!!! I really appreciate your help in times I'm 
desesperated like this time :-)






_

Tutopia - Acceso a Internet rápido, fácil y a los mejores precios.
http://www.tutopia.com

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



[PHP-DB] datetime

2003-01-21 Thread Addison Ellis
hello and thank you... probably again.
using datetime, /or something else if applicable, is it possible to 
have entries to a page and entries to a db automatically delete? i 
have looked through many docs at php.net and mysql and can't find 
anything. perhaps i'm using the wrong search key words.? thanks 
again, addison
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



[PHP-DB] Array problems

2003-01-21 Thread Michael Conway
  I find myself stuck in coming up with a way to cycle through this
array of db results for porting to a graphing script that I did not
write.  My latest attempt to get around this problem is below.  Outside
of the $graph-SetDataValues(array( ));, echoing $array[$i] produces the
desired results for three sets of two bar graphs with the corresponding
title.  However, inside the $graph function, I get only the last
expected set of bar graphs and title.  I originally iterated through
each anticipated result from mysql_fetch_array($result) and plugged each
of these values into an array calling the columns individually. I got
the desired graph, but, of course this is bad programming and not useful
for queries producing a greater number of rows (I simply needed to know
it worked).  Any help would be appreciated.

 

__

 

$query = 1st SELECT code;

   // Run the query created above on the database through the connection
  if (!($result1 = @ mysql_query ($query, $connection)))
 showerror();
  

  
  $query = 2nd SELECT code;

   // Run the query created above on the database through the connection
  if (!($result2 = @ mysql_query ($query, $connection)))
 showerror();
while ($row_1st= @ mysql_fetch_array($result1))  ($row_2nd = @
mysql_fetch_array($result2)))
  { 
   
  $field1[$i]=$row_1st[column1];
  $field2[$i]=$row_1st[column2];
  $field3[$i]=$row_2nd[column1];
  $array[$i]=array($field1[$i], $field2[$i], $field3[$i]); 



  
  $graph-SetDataValues(array(
$array[$i]
   
  ));
}
$graph-DrawGraph(); 
?
 

 

Michael Conway

[EMAIL PROTECTED]

(703) 968-8875

 




[PHP-DB] Using Objects with Databases

2003-01-21 Thread Philip Zee
Hello all,

I am trying to create a class, say User.  Each user has an entry in the database
table called user.  Each function, including the constructor, will be calling
the database to do something.  Is it better to initialize the database
connection inside each function or is it better to initialize the connection at
the beginning of the class?  What's the best practice on this?

Any help or example is appreciated.

Thanks,

Philip


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




RE: [PHP-DB] Using Objects with Databases

2003-01-21 Thread Luke Woollard
Initialise the database connection and perform actions on the database using
a seperate class.
You can pass your functions (methods) values returned from your database
calls to manipulate.

This is commonly called a 'database abstaction layer'

Theres a good database abstraction class in this magazine by a guy called
marco talbini http://www.phparch.com/

Else lookup PEAR:MB or adodb library on teoma.com or similar.





-Original Message-
From: Philip Zee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 22 January 2003 4:27 PM
To:
Subject: [PHP-DB] Using Objects with Databases


Hello all,

I am trying to create a class, say User.  Each user has an entry in the
database
table called user.  Each function, including the constructor, will be
calling
the database to do something.  Is it better to initialize the database
connection inside each function or is it better to initialize the connection
at
the beginning of the class?  What's the best practice on this?

Any help or example is appreciated.

Thanks,

Philip


--
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] Using Objects with Databases

2003-01-21 Thread Philip Zee
Luke,

Thanks for the help.  This only answers half of my question.  I understand that
you need to build a class to handle your database needs.  However, once the
database returns a row in the table user, there will be functions performed
for that user.  I was thinking about creating a class User to handle the
initialization and other functions for the user.  What's the best way of doing
that?

Thanks,

Philip

-Original Message-
From: Luke Woollard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 21, 2003 9:38 PM
To: PHP-db
Subject: RE: [PHP-DB] Using Objects with Databases


Initialise the database connection and perform actions on the database using
a seperate class.
You can pass your functions (methods) values returned from your database
calls to manipulate.

This is commonly called a 'database abstaction layer'

Theres a good database abstraction class in this magazine by a guy called
marco talbini http://www.phparch.com/

Else lookup PEAR:MB or adodb library on teoma.com or similar.





-Original Message-
From: Philip Zee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 22 January 2003 4:27 PM
To:
Subject: [PHP-DB] Using Objects with Databases


Hello all,

I am trying to create a class, say User.  Each user has an entry in the
database
table called user.  Each function, including the constructor, will be
calling
the database to do something.  Is it better to initialize the database
connection inside each function or is it better to initialize the connection
at
the beginning of the class?  What's the best practice on this?

Any help or example is appreciated.

Thanks,

Philip


--
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] Using Objects with Databases

2003-01-21 Thread Luke Woollard
I store all my sql queries in an include file.
These queries could store the actions you want to perform for each user..

I then use scripts to execute queries (with an alias name for each) based on
decisions (such as whether certain $_POST variables are present etc..)

If I were building a 'user' class - I would store the actions that would
'call' the appropriate query by it's alias. This allows other objects to
perform the same queries without re-writing them inside a different class.

Also - I'm using a database abstraction layer so I don't have database
specific calls inside my classes. This helps maintain portability of my
applications.

Hope that helps.

LW






-Original Message-
From: Philip Zee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 22 January 2003 5:16 PM
To: Luke Woollard; PHP-db
Subject: RE: [PHP-DB] Using Objects with Databases


Luke,

Thanks for the help.  This only answers half of my question.  I understand
that
you need to build a class to handle your database needs.  However, once the
database returns a row in the table user, there will be functions
performed
for that user.  I was thinking about creating a class User to handle the
initialization and other functions for the user.  What's the best way of
doing
that?

Thanks,

Philip

-Original Message-
From: Luke Woollard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 21, 2003 9:38 PM
To: PHP-db
Subject: RE: [PHP-DB] Using Objects with Databases


Initialise the database connection and perform actions on the database using
a seperate class.
You can pass your functions (methods) values returned from your database
calls to manipulate.

This is commonly called a 'database abstaction layer'

Theres a good database abstraction class in this magazine by a guy called
marco talbini http://www.phparch.com/

Else lookup PEAR:MB or adodb library on teoma.com or similar.





-Original Message-
From: Philip Zee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 22 January 2003 4:27 PM
To:
Subject: [PHP-DB] Using Objects with Databases


Hello all,

I am trying to create a class, say User.  Each user has an entry in the
database
table called user.  Each function, including the constructor, will be
calling
the database to do something.  Is it better to initialize the database
connection inside each function or is it better to initialize the connection
at
the beginning of the class?  What's the best practice on this?

Any help or example is appreciated.

Thanks,

Philip


--
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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] foreach($HTTP_POST_VARS as $key = $value)

2003-01-21 Thread Addison Ellis
hello,
	i do appreciate your time...
	below the code following i don't know where to go. do i need 
to list each value individually or can i do something with 
$HTTP_POST_VARS  or am i even headed in the right direction? i am 
trying to point all my forms to this .php file to check for errors, 
and if they are ok, insert the submitted form values into a table in 
a database. thank you. addison ellis
foreach($HTTP_POST_VARS as $key = $value)   
  {
if ($key != )
{
  if ($value == )
  {
$message_new = font face=verdana size=1 
color=redRequired information missing.\n
Please try again./font;
  }
} 
if (ereg({name),$key))   
{
 if (!ereg(^[A-Za-z' -]{1,50}$,$key))
 {
   $message_new = font face=verdana size=1 color=redSome 
information not processing.\n
Please try again./font;
 } 
}
$$key = strip_tags(trim($value));  
  }
  if (!ereg(^[0-9)(xX -]{7,20}$,$phone)) 
  {
$message_new = font face=verdana size=1 color=redNot a 
valid phone number.\n
Please try again./font; 
  }
  if (!ereg(^.+@.+\\..+$,$email)) 
  {
$message_new = font face=verdana size=1 color=redNot a 
valid email address.\n
 Please try again./font;
}
  else
if ($message == )
	{
	$query = insert into ad_columns  set
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]

[PHP-DB] Re: [PHP] build menu with mysql data

2003-01-21 Thread Marc Bleuler
Hi Eddie,

This is exactly what I'm looking for. I don't have some code today that's
why I'm posting to the newsgroup. The only working thing I have today is the
listing of the main db
It looks a bit whired since I copy past it from the file.
Could you post some of your code?


-
print $html_body_in;
   print bSystems/bbrbr;
   print table border=\0\ width=\900\ cellspacing=\0\
cellpadding=\0\ style=\font-size: 10pt\;
  print tr;
 print td width=\20\b/b/td;
print td width=\130\bName/b/a/td;
print td width=\130\bVendor/b/td;
   print td width=\620\bDescription/bb/td;
 print \t/tr\n;
   print /table\n;

   $query=SELECT system.*, vendor.* FROM system, vendor where system.VENDOR
= vendor.ID order by system.NAME ASC;
   $result=mysql_query($query);
   $num=mysql_numrows($result);

   $i=0;

   while ($i  $num) {
   $system_id=mysql_result($result,$i,system.ID);
   $system_name=mysql_result($result,$i,system.NAME);
   $vendor_name=mysql_result($result,$i,vendor.NAME);
   $vendor_id=mysql_result($result,$i,vendor.ID);
   $system_description=mysql_result($result,$i,system.DESCRIPTION);


   print table border=\0\ width=\900\ cellspacing=\0\
cellpadding=\0\ style=\font-size: 10pt\;
print tr;
  print td width=\20\a
href=\index.php?$LINKACTION=systemSUB=systemdetailsysid=$system_id\im
g border=\0\ src=\$plus_gif\ alt=\extract $system_name\/a/td;
   print td width=\130\a
href=\index.php?$LINKACTION=systemSUB=systemdetailsysid=$system_id\$sy
stem_name/a/td;
print td width=\130\a
href=\index.php?$LINKACTION=systemSUB=vendordetailvendorid=$vendor_id\
$vendor_name/a/td;
   print td width=\520\$system_description/td;
print td width=\25\a
href=\index.php?$LINKACTION=systemSUB=systemdetailsysid=$system_id\im
g border=\0\ src=\$edit_gif\ alt=\edit $system_name\ width=\12\
height=\12\/a/td;
   print td width=\25\a
href=\index.php?$LINKACTION=adminSUB=useradd\img border=\0\
src=\$new_gif\ alt=\add Useraccount\ width=\12\
height=\12\/a/td;
print td width=\50\a
href=\index.php?$LINKACTION=systemSUB=systemdetailsysid=$system_id\im
g border=\0\ src=\$delete_gif\ alt=\delete $system_name\ width=\12\
height=\12\/a/td;

   print /tr;
  print /table;

   ++$i;
   }


-

br Marc


   print $html_body_out;
Edward Peloke [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Marc,

 I did something sort of along these lines with an 'auction' site I worked
 on.  I displayed rows from a db.  If the row had bid information in the db
 (or your case submenu info) then a + sign icon was displayed next to it.
IF
 the plus sign was clicked, the page would reload and the bid or submenu
info
 would be displayed and the + sign would change to a - sign to give the
 appearence of a tree menu.   Can you post some of your code?

 Eddie

 -Original Message-
 From: Marc Bleuler [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 21, 2003 12:31 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PHP] build menu with mysql data


 Hi,

 I would like to bild a tree menu with mySQL data. where I have the
collapsed
 main menue and when I click the link the specific submenue expands (as
 follow).

 (collapsed Main Menu)
 + Home
 + Downloads
 + About me
 + Search

 and for example if I click the Download section it will look as
 follow

 (expanded Main-Sub Menu)
 + Home
 + Downloads
 - Music
 - Programm
 + About me
 + Search

 and the SQL Tables...

 MAINMENUE_TABLE
 IDNAME
 -
 |1|Home|
 |2|Downloads|
 |3|About me  |
 |4|Search   |

 and

 SUBMENUE_TABLE
 IDMAIN_ID  NAMEURL
 ---
 |1|2|Music|
 ./somefile.php?action=music
 |2|2|Programm |
 ./somefile.php?action=programm
 |3|3|Pictures |
 ./somefile.php?action=pictures
 |4|3|Address|
 ./somefile.php?action=address
 |5|4|My Page   |
 ./somefile.php?action=mypage
 |6|4|The Web   |
 ./somefile.php?action=theweb
 |7|4|Google  |
 ./somefile.php?action=google


 If I'm using a while loop it won't work, so I realy don't have and more
 ideas...
 Please consider in your explanations I'm a PHP beginner... :-)

 thanks
 Marc



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

RE: [PHP-DB] Re: [PHP] build menu with mysql data

2003-01-21 Thread Edward Peloke
Marc,

Here is the entire script...

It is doing a lot of things you don't need so you will have to sift through
it to see what you want.  If you have any questions, just ask.

Eddie

?

  require(connection.php);

if ($addbid) {
# setup SQL statement
$SQL =  INSERT INTO bids;
$SQL = $SQL .  (clientreqid,amount,operatorid,accepted) Values;
$SQL = $SQL .  ('$clientreqid','$amount','$operatorid',0) ;

   #execute SQL statement
$result = mysql_db_query($db,$SQL,$connection);
 }



 # setup SQL statement
$SQL = select id,clientid,DATE_FORMAT(departdate, '%m/%d/%y') as
departdate,DATE_FORMAT(returndate, '%m/%d/%y') as
returndate,departloc,numpass,craftpref,returnloc  from clientreq;
 #execute SQL statement
$result = mysql_db_query($db,$SQL,$connection);
$bgcolor=#fffafo;
 ##get the lengths
$sqllength=select max(length(departloc)) as departloclen,
max(length(departdest)) as departdestlen from clientreq





 ?
br br
table width=95% border=0
tr bgcolor=#2c1d65 border=1
tdnbsp;nbsp;nbsp;nbsp;nbsp;/td
tdfont face=arial size=4 color=#fffaf0bDepart/td
tdfont face=arial size=4 color=#fffaf0bLocation/td
tdfont face=arial size=4 color=#fffaf0b# Pass/td
tdfont face=arial size=4 color=#fffaf0bReturn/td
tdfont face=arial size=4 color=#fffaf0bReturn/td
tdfont face=arial size=4 color=#fffaf0bLocation/td
tdfont face=arial size=4 color=#fffaf0bCraft Preference/td
tdfont face=arial size=4 color=#fffaf0bLowest Bid/td
tdfont face=arial size=3 color=#fffaf0bAdd Bid/td
/tr





? $trcolor=#F0F8FF;
   while ($myrow = mysql_fetch_array($result)){
$return='No';
$colorset=0;
if ($myrow[return]==1){
  $return='Yes';}
$open='No';
if ($myrow[open]==1){
  $open='Yes';}

if ($trcolor=='#F0F8FF'){
  $trcolor='#B0C4DE';
  $colorset=1;
 }
if ($colorset==0){
  if ($trcolor=='#B0C4DE'){
   $trcolor='#F0F8FF';}
  }

if ($bidhist1){
# setup SQL statement
$SQL3 = select min(amount), count(*) as count1 from bids where
clientreqid=.$myrow[id].;
#execute SQL statement
$result3= mysql_db_query($db,$SQL3,$connection);
$myrow3=mysql_fetch_array($result3);
$count1=$myrow3[count1];
print tr bgcolor='$trcolor';
if ($count10){
  printtda
href='auction3.php?clientreqid=.$myrow[id].bidhist=1'img
name='bidhist' src='plus.gif' border='0'/a/td;
  $minbid=$myrow3[min(amount)];
}
if ($count1==0){
  printtd/td;
  $minbid=No Bids;
   }
 printtd.$myrow[departdate]./td;
printtd.$myrow[departloc]./td;
printtd.$myrow[numpass]./td;
printtd$return/td;
printtd.$myrow[returndate]./td;
printtd/td;
printtd.$myrow[craftpref]./td;
printtd$minbid/td;
print tdnobra href='addbid.php?reqid=.$myrow[id].
operatorid=$operatorid'Add Bid/a/nobr/td/tr;
   }

   if ($bidhist==1){
   # setup SQL statement
$SQL3 = select min(amount), count(*) as count1 from bids where
clientreqid=.$myrow[id].;
#execute SQL statement
$result3= mysql_db_query($db,$SQL3,$connection);
# setup SQL statement
$SQL4 = select b.amount, DATE_FORMAT(b.timestamp, '%m/%d/%y')
as timestamp, o.corpname from bids b ,operators o where b.operatorid=o.id
and clientreqid='$clientreqid' order by b.amount,b.timestamp asc;
#execute SQL statement
$result4= mysql_db_query($db,$SQL4,$connection);
$myrow3=mysql_fetch_array($result3);
$count1=$myrow3[count1];


if($clientreqid==$myrow[id]){
 print tr bgcolor='$trcolor';
if ($count10){
  printtda
href='auction3.php?clientreqid=.$myrow[id].bidhist=0'img
name='bidhist' src='minus.gif' border='0'/a/td;
 $minbid=$myrow3[min(amount)];
}
if ($count1==0){
  printtd/td;
  $minbid=No Bids;
   }
 printtd.$myrow[departdate]./td;
printtd.$myrow[departloc]./td;
printtd.$myrow[numpass]./td;
printtd$return/td;
printtd.$myrow[returndate]./td;
printtd/td;
printtd.$myrow[craftpref]./td;
printtd$minbid/td;
print tdnobra href='addbid.php?reqid=.$myrow[id].
operatorid=$operatorid'Add Bid/a/nobr/td/tr;
  print tr bgcolor='#2c1d65' border='1';
  printtd bgcolor=$bgcolor/td;