[PHP-DB] php problem passing variables

2002-07-10 Thread richard . mail

hi, 

i've tryed to install php 4.2.1 with apache 1.3.24
php works, but i can't pass any variables. 

is it in php.ini that i have to change something ?
or is the installation of php not correct ??.. 

thanks in advance, 

Richard Pijnenburg
The netherlands

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




[PHP-DB] Apache DBM/htaccess Management with PHP

2002-07-10 Thread Beau Lebens

I *think* this is kind of database-related... forgive me if it's not.

I am hopefully going to be managing the authentication on an Apache
webserver using the Apache DBM module which is like a database-based version
of .htaccess. I want to manage this with PHP, but don't know how to handle
the DBM files.

So here's my questions;

1. Can this be done using the integrated dbm*() functions in PHP? or the
dba_*() ones?
2. Has anyone out there done or seen this done?
3. Anyone know of any examples/existing classes for dealing specifically
with Apache?
4. Am I crazy?

Unfortunately I don't know of any better way of doing this at the moment. If
it will work, I think Apache's DBM is a much better solution than standard
.htaccess files, since I am dealing with a couple hundred users at least.

Thanks in advance for your help guys (and gals, not that I use "guys" in a
sexist manner :P).

Beau

-- 
Beau Lebens, Technical Officer
Science and Mathematics Education Centre
Curtin University of Technology,
GPO Box U1987 Perth, Western Australia 6845
CRICOS provider code 00301J

t: +61 8 9266-7297 (has voice-mail)
f: +61 8 9266-2503 (ATT: Beau Lebens)
e: [EMAIL PROTECTED]
w: http://learnt.smec.curtin.edu.au/

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




RE: [PHP-DB] Re: Getting Percentage of coloumn value

2002-07-10 Thread joakim . andersson

" .
mysql_error());
$row = mysql_fetch_array($result);

$query = "select referer,(count(referer) / {$row['num_rows']} * 100) as
total_in_percentage from tececo_stats group
by referer";
$result = mysql_query($query) or die("Query failed: $query" .
mysql_error());
?>



{$row['referer']}{$row['total_in_percentage']}";
}
?>





Regards
Joakim Andersson

> -Original Message-
> From: JJ Harrison [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 8:30 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: Getting Percentage of coloumn value
> 
> 
> Here is my script:
> 
>  include "includes/required.php";
> do_html_header('Name Here');
> 
> $query = "select @total_items=count(id) from tececo_stats";
> $query1= "select referer,count(referer)/@total_items from 
> tececo_stats group
> by referer";
> $result = mysql_query($query) or die("Query failed: $query" .
> mysql_error());
> $result1 = mysql_query($query1) or die("Query failed: $query1" .
> mysql_error());
> $num_results = mysql_num_rows($result);
> ?>
> 
>  for ($i=0; $i < $num_results; $i++)
>   {
>  $row = mysql_fetch_array($result1);
>  echo
> ''.$row['referer'].''.$row['count(referer)'].
> '';
>  }
>  ?>
>  
>   
> 
> do_html_footer();
> ?>
> 
> How can I echo count(referer) ?
> 
> I currently get this error
> 
> Warning: Undefined index: count(referer) in
> C:\Inetpub\TecEco_PHP\stats_interface\referer_base.php on line 16
> 
> 
> --
> JJ Harrison
> [EMAIL PROTECTED]
> www.tececo.com
> 
> "Jj Harrison" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Could some one give me an idea as to what I SQL query could 
> use to get the
> > percentages of each differant colomn value.
> >
> > ie if this was my table:
> > +---+---+
> > | name   | id |
> > +---+---+
> > | foobar  | 1 |
> > | foobar  | 2 |
> > | foobar  | 3 |
> > | barfoo  | 4 |
> > +---+---+
> >
> > I would get this result(Then later do stuff with it in PHP):
> >
> > +---++
> > | name  | percent |
> > +---++
> > | foobar | 75|
> > | barfoo | 25|
> > +---++
> >
> > Thanks in advance,
> >
> >
> > --
> > JJ Harrison
> > [EMAIL PROTECTED]
> > www.tececo.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




RE: [PHP-DB] php problem passing variables

2002-07-10 Thread joakim . andersson

This doesn't look like a database question to me...

Anyway, try $_POST['variable_name'] if the variable comes from a form with
the POST-method
$_GET['variable_name'] - Form using GET-method or passing variables in the
URI (mypage.php?variable_name=42)

Regards
Joakim Andersson


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 9:32 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] php problem passing variables
> 
> 
> hi, 
> 
> i've tryed to install php 4.2.1 with apache 1.3.24
> php works, but i can't pass any variables. 
> 
> is it in php.ini that i have to change something ?
> or is the installation of php not correct ??.. 
> 
> thanks in advance, 
> 
> Richard Pijnenburg
> The netherlands
> 
> -- 
> 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] Problem whith mysql_connect()

2002-07-10 Thread Marcel Schindler


"Fernando Gonzalez" <[EMAIL PROTECTED]> wrote
> Php Was installed when installing the Red Hat 7.0 .
> Mysql Was installed later from rpm.
>
> Any ideas of what can I do???
>
write this script


save and start it through your browser.

Check the following parts:

CONFIGURE COMMAND: Is "--with-mysql=/path/to/mysql" standing there? (right
on top of the phpinfo)



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




[PHP-DB] catch warnings?

2002-07-10 Thread Gabor Niederlaender

Hi all!

This is not a typical DB-Question, but I hope you give me some hints
either...

If I insert a String instead of a date(f.Ex) into the DB, I get a
Warning:

MS SQL message: Syntax error converting datetime from character
string. (severity 16) 

How can I catch these warnings in PHP?

Best regards,
Gabor 

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




RE: [PHP-DB] catch warnings?

2002-07-10 Thread Peter Lovatt


look at

http://www.php.net/manual/en/function.mssql-get-last-message.php


Peter
---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
--- 

> -Original Message-
> From: Gabor Niederlaender [mailto:[EMAIL PROTECTED]]
> Sent: 10 July 2002 12:37
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] catch warnings?
> 
> 
> Hi all!
> 
> This is not a typical DB-Question, but I hope you give me some hints
> either...
> 
> If I insert a String instead of a date(f.Ex) into the DB, I get a
> Warning:
> 
> MS SQL message: Syntax error converting datetime from character
> string. (severity 16) 
> 
> How can I catch these warnings in PHP?
> 
> Best regards,
> Gabor 
> 
> -- 
> 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] catch warnings?

2002-07-10 Thread Adam Alkins

> Hi all!
> 
> This is not a typical DB-Question, but I hope you give me some hints
> either...
> 
> If I insert a String instead of a date(f.Ex) into the DB, I get a
> Warning:
> 
> MS SQL message: Syntax error converting datetime from character
> string. (severity 16) 
> 
> How can I catch these warnings in PHP?

I believe mssql_get_last_message() is what you want.

--
Adam Alkins
http://www.rasadam.com
--




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




Re: [PHP-DB] catch warnings?

2002-07-10 Thread Michael Bretterklieber

Hi,

try

SELECT @@ERROR as errorcode

bye,

Adam Alkins schrieb:
>>Hi all!
>>
>>This is not a typical DB-Question, but I hope you give me some hints
>>either...
>>
>>If I insert a String instead of a date(f.Ex) into the DB, I get a
>>Warning:
>>
>>MS SQL message: Syntax error converting datetime from character
>>string. (severity 16) 
>>
>>How can I catch these warnings in PHP?
> 
> 
> I believe mssql_get_last_message() is what you want.
> 
> --
> Adam Alkins
> http://www.rasadam.com
> --
> 
> 
> 
> 


-- 
--
Michael Bretterklieber
LCP
JAWA Management Software GmbH
Liebenauer Hauptstr. 200
A-8041 GRAZ
Tel: ++43-(0)316-403274-12
Fax: ++43-(0)316-403274-10
GSM: ++43-(0)676-93 96 698
[EMAIL PROTECTED]
homepage: http://www.jawa.at
- privat ---
E-mail:   [EMAIL PROTECTED]
homepage: http://www.inode.at/mbretter
--
"...the number of UNIX installations has grown to 10, with more expected..."
   - Dennis Ritchie and Ken Thompson, June 1972


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




[PHP-DB] Re: Great tool

2002-07-10 Thread Marcel Schindler

"César aracena" <[EMAIL PROTECTED]> wrote:
> Hi all. I found in one of these DB lists a word about a tool called
> MySQL - Front so I went there, downloaded it and ran it today for the
> first time and well...
> ¡¡TWO THUMBS UP!!!
> It really seems like a great GUI app. I installed it over Win XP Pro and
> had no troubles with it so far. It's amazing how much graphical
> possibilities it has. Really recommend it for *EVERY* newbie like me and
> for all Masters who doesn't know it.

Yeah, I downloaded it, but I could not get access to my mysql-server... I
dunno why, any ideas?
Client is windows XP and Server is RH 7.2



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




[PHP-DB] Load data

2002-07-10 Thread Natividad Castro

Hi to all,
I changed Linux from version 7.2 to 7.3 and now when I try to load data
using LOAD DATA LOCAL INFILE I got the following error:
The used command is not allowed with this MySQL version. I
enable --local-infile=1 But I'm still getting the same error.

Any help, is greatly appreciate it

Thanks in advanced
Nato


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




RE: [PHP-DB] A Simple Question

2002-07-10 Thread Adam Royle

Just a correction you can use arrays with querystrings

page.php?var1[]=first&var1[]=second&var1[]=third

$var1
Array
(
 [0] => first
 [1] => second
 [2] => third
)


OR

page.php?var1[]=first&var2[2]=second&var2[]=third

$var 1
Array
(
 [0] => first
)

$var2
Array
(
 [2] => second
 [3] => third
)

You can also have multidimensional arrays, but not associative arrays.

But you do have the 255 character limitation (can be a bummer).

Adam


> Also, as far as limitations go, the following are considerations;
>
> 1. You can't pass an array using the querystring
> 2. Multiline variables (ie.  contents) are bad
> 3. There is a limit of 255 or something characters to a URI (someone?)
> 4. Be careful with the $_GET[] array that Tony mentions, it is only
> available on more recent versions of PHP, before that it was 
> $HTTP_GET_VARS
> and a lot of people had been using just plain $var1 or whatever, 
> assuming
> that "register_globals" would always be ON in the php.ini file (which 
> also
> changed in recent versions).
>
> HTH
>
> Beau



[PHP-DB] Great tool

2002-07-10 Thread César Aracena

Hi all. I found in one of these DB lists a word about a tool called
MySQL - Front so I went there, downloaded it and ran it today for the
first time and well...

¡¡TWO THUMBS UP!!!

It really seems like a great GUI app. I installed it over Win XP Pro and
had no troubles with it so far. It's amazing how much graphical
possibilities it has. Really recommend it for *EVERY* newbie like me and
for all Masters who doesn't know it.

C.

Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621

sql


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




Re: [PHP-DB] Great tool

2002-07-10 Thread Manuel


You may also want to try: EMS MySQL Manager. I've been using both of them and I like 
the EMS GUI better. It seems to work better and has more features.
 César_Aracena wrote:Hi all. I found in one of these DB lists a word about a tool 
called
MySQL - Front so I went there, downloaded it and ran it today for the
first time and well...

¡¡TWO THUMBS UP!!!

It really seems like a great GUI app. I installed it over Win XP Pro and
had no troubles with it so far. It's amazing how much graphical
possibilities it has. Really recommend it for *EVERY* newbie like me and
for all Masters who doesn't know it.

C.

Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621

sql


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



-
Do You Yahoo!?
New! SBC Yahoo! Dial - 1st Month Free & unlimited access


[PHP-DB] Date comparison problem

2002-07-10 Thread Gabor Niederlaender

Hi all!

I have got a "datetime" field in a MS-SQL DB, and I have a "date
field" in my html-form with the format: DD/MM/.

I would like to compare the two, but I think the two formats are a bit
different and they do not really want to be compared:)

If I write a query to write out the "datetime" field from the DB, I
get the form :

02 05 2002 12:25 

In the HTML-form it looks a bit different: 12/10/2000

I do not really want to explode the form-data and than build a new
timestamp, it has to be a more simple way.

Thanks, best regards

Gabor

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




[PHP-DB] behavior of mysql_pconnect()

2002-07-10 Thread levik

I'm wondering how the mysql_pconnect() function is SUPPOSED to behave.

I have a script that gets hit fairly heavily (about 150K times a day), that uses 
mysql. In order to save some time in execution, I have made it use mysql_pconnect() 
rather than mysql_connect(). Persistent connections are enabled in php.ini, and
are not limited by number. (This is reflected when I go to look at php_info() output)

However, even at the highest load times, I never see php_info() show more than one
active mysql link.

Is this correct? Will all instances of all the scripts that use mysql_pconnect() to the
same DB be forced to wait on one connection? Or does the function implement some sort
of connection pooling which for some reason fails to work? 

This is kind of critical, as my script is causing some seriously high load averages on
my poor old 650Mhz server. (One thing i should mention is that my php instance is using
builtin mysql support rather than the compiled mysql libraries. Can this affect 
anything?)



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




RE: [PHP-DB] Date comparison problem

2002-07-10 Thread Ryan Jameson (USA)

This is how I do it:

date("m/d/Y",strtotime(odbc_result($rs,"ts")))

where $rs is the result set and "ts" is the name of the field containing the datetime.

<>< Ryan

-Original Message-
From: Gabor Niederlaender [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 8:21 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Date comparison problem


Hi all!

I have got a "datetime" field in a MS-SQL DB, and I have a "date
field" in my html-form with the format: DD/MM/.

I would like to compare the two, but I think the two formats are a bit
different and they do not really want to be compared:)

If I write a query to write out the "datetime" field from the DB, I
get the form :

02 05 2002 12:25 

In the HTML-form it looks a bit different: 12/10/2000

I do not really want to explode the form-data and than build a new
timestamp, it has to be a more simple way.

Thanks, best regards

Gabor

-- 
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] Graphing data

2002-07-10 Thread chip . wiegand

Is there any application available that can take data from my mysql
database and draw graphs?
I am using mysql/php on FreeBSD.

--
Chip



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




[PHP-DB] Problems getting data from database

2002-07-10 Thread Chip Atkinson

Greetings,

I built php 4.2.1 and am having database access troubles.  The problem
shows up with either the php module for apache/stronghold or the
command line/standalone version of php, so I've been using the stand alone
version.

I believe that my syntax and test program is correct, because a slightly
different sql statement works while others fail.

Here is the version information:
php: 4.2.1
 gcc -v
Reading specs from
/opt/tools/gcc-2.95.1/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/specs
gcc version 2.95.1 19990816 (release)
Oracle 7.0.15 statically linked in

Below is my test program.  The output is within the test program itself.

Thanks in advance for any help.

Chip

\n";
   exit;
 }

 $cursor = Ora_Open ($connection);
 if ($cursor == false){
   echo Ora_ErrorCode($connection).":2 ".Ora_Error($connection)."\n";
   exit;
 }

 /* WORKS and gives
 $query = "SELECT * FROM ALL_TABLES";

Numcols: 20
Column:   Type:Size: Result:

0VARCHAR2   30SYS
1VARCHAR2   30CDEF$
2VARCHAR2   30SYSTEM
3VARCHAR2   30C_COBJ#
4NUMBER   220


 */

 /* HOSED and gives
 $query = 'SELECT TABLE_NAME, OWNER FROM ALL_TABLES';
 PHP Warning:  Ora_GetColumn found invalid type (0) in 
/export/home/sun/chip/build/php-4.2.1/index4.php on line 75
 /export/home/sun/chip/build/php-4.2.1/index4.php(75) : Warning - Ora_GetColumn 
found invalid type (0)
 Numcols: 2
 Column:   Type:Size: Result:
 
 0VARCHAR2   30
 1UNKNOWN(0)   0
 2
 3
 4
 */
 $query = 'SELECT TABLE_NAME, OWNER FROM ALL_TABLES'; /* HOSED */
 $result = Ora_Parse ($cursor, $query);

 $result = Ora_Exec ($cursor);
 if ($result == false){
   echo Ora_ErrorCode($cursor).":4 ".Ora_Error($cursor)."\n";
   exit;
 }

 $numcols = ora_numcols ($cursor);
 echo "Numcols: $numcols\n";
 echo "Column:   Type:Size: Result:\n";
 echo "\n";
 /* Just look at 5 for debugging purposes.
  */
 if ($numcols > 5)
 {
   $cols_to_print = 5;
 }
 else
 {
   $cols_to_print = $numcols;
 }
 for ($i = 0; $i < $cols_to_print; $i++)
 {
   $t = ora_columntype ($cursor, $i);
   $s = ora_columnsize ($cursor, $i);
   $result = ora_getcolumn ($cursor, $i);
   echo "$i$t   $s$result\n";
 }

 Ora_Close ($cursor);
 Ora_Logoff ($connection);

?>


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




Re: [PHP-DB] Graphing data

2002-07-10 Thread Ray Hunter

I have used jpGraphs with tons of success.  These are functions or classes
that you can call in your php code...

http://www.aditus.nu/jpgraph/


--
RAY HUNTER



- Original Message -
From: <[EMAIL PROTECTED]>
To: "PHP_DB" <[EMAIL PROTECTED]>
Sent: Wednesday, July 10, 2002 9:41 AM
Subject: [PHP-DB] Graphing data


> Is there any application available that can take data from my mysql
> database and draw graphs?
> I am using mysql/php on FreeBSD.
>
> --
> Chip
>
>
>
> --
> 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] Calculating inside query?

2002-07-10 Thread andy

Hi there,

I would like to find out the top 10 of some ratings. There are 2 columns.
One for the rating and one for the amount of ratings.
To find out the top 10 I would have to divide those 2 values and sort it.

Somehow this does not work. I do not have a clue why. Maybe someone of you
guys do see the error:

Mysql:

SELECT
  ID,
  rating_total / ratings_amount AS top10
FROM rating
ORDER BY top10 desc
LIMIT 10

Thanx for any help,

Andy
query




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




RE: [PHP-DB] Calculating inside query?

2002-07-10 Thread Ryan Jameson (USA)

i assume you're using MySQL because of the Limit clause, but what error are you 
receiving?

-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Calculating inside query?


Hi there,

I would like to find out the top 10 of some ratings. There are 2 columns.
One for the rating and one for the amount of ratings.
To find out the top 10 I would have to divide those 2 values and sort it.

Somehow this does not work. I do not have a clue why. Maybe someone of you
guys do see the error:

Mysql:

SELECT
  ID,
  rating_total / ratings_amount AS top10
FROM rating
ORDER BY top10 desc
LIMIT 10

Thanx for any help,

Andy
query




-- 
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] Calculating inside query?

2002-07-10 Thread andy

there is no error, it just does not pull out the right values. Just puts out
10 listings and the top10 column (as I named it by alias) contains no value.
I am using mysql.

maybe this has to do somehting with the alias?


"Ryan Jameson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
i assume you're using MySQL because of the Limit clause, but what error are
you receiving?

-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Calculating inside query?


Hi there,

I would like to find out the top 10 of some ratings. There are 2 columns.
One for the rating and one for the amount of ratings.
To find out the top 10 I would have to divide those 2 values and sort it.

Somehow this does not work. I do not have a clue why. Maybe someone of you
guys do see the error:

Mysql:

SELECT
  ID,
  rating_total / ratings_amount AS top10
FROM rating
ORDER BY top10 desc
LIMIT 10

Thanx for any help,

Andy
query




--
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] Calculating inside query?

2002-07-10 Thread Ryan Jameson (USA)

do both of the fields contain values and are they both numeric? It sure seems strange 
to me. I actually created a test and it worked fine, just copied your query.
<>< Ryan

-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Calculating inside query?


there is no error, it just does not pull out the right values. Just puts out
10 listings and the top10 column (as I named it by alias) contains no value.
I am using mysql.

maybe this has to do somehting with the alias?


"Ryan Jameson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
i assume you're using MySQL because of the Limit clause, but what error are
you receiving?

-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Calculating inside query?


Hi there,

I would like to find out the top 10 of some ratings. There are 2 columns.
One for the rating and one for the amount of ratings.
To find out the top 10 I would have to divide those 2 values and sort it.

Somehow this does not work. I do not have a clue why. Maybe someone of you
guys do see the error:

Mysql:

SELECT
  ID,
  rating_total / ratings_amount AS top10
FROM rating
ORDER BY top10 desc
LIMIT 10

Thanx for any help,

Andy
query




--
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 syntax error - phpMyAdmin ??

2002-07-10 Thread Michael Zornek

I was using phpMyAdmin to do an export from one machine to another and on
import I got an error:

> Error
> 
> SQL-query :  
> 
> CREATE TABLE hospital (
> id smallint(5) unsigned NOT NULL auto_increment,
> heath_system_id smallint(5) unsigned default NULL,
> name_long tinytext NOT NULL,
> name_short tinytext,
> logo_file_loc text,
> desc text,
> photo text,
> address1 tinytext,
> address2 tinytext,
> city tinytext,
> state tinytext,
> zip smallint(5) unsigned zerofill default NULL,
> phone tinytext,
> repay_percent tinyint(3) unsigned default NULL,
> url text,
> job_page_url text,
> num_nurses smallint(5) unsigned default NULL,
> active enum('yes','no') NOT NULL default 'yes',
> number_of_beds smallint(5) unsigned NOT NULL default '0',
> type tinytext NOT NULL,
> PRIMARY KEY  (id),
> KEY zip (zip)
> ) TYPE=MyISAM
> 
> MySQL said: 
> 
> You have an error in your SQL syntax near 'desc text,
> photo text,
> address1 tinytext,
> address2 tinytext,
> city ti' at line 7

What's the problem??? My db seems to find on the other machine?

~ Mike
-- 
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org

Personal Site: 
http://www.mikezornek.com


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




RE: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Ryan Jameson (USA)

desc is a key word. :-\

-Original Message-
From: Michael Zornek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Mysql syntax error - phpMyAdmin ??


I was using phpMyAdmin to do an export from one machine to another and on
import I got an error:

> Error
> 
> SQL-query :  
> 
> CREATE TABLE hospital (
> id smallint(5) unsigned NOT NULL auto_increment,
> heath_system_id smallint(5) unsigned default NULL,
> name_long tinytext NOT NULL,
> name_short tinytext,
> logo_file_loc text,
> desc text,
> photo text,
> address1 tinytext,
> address2 tinytext,
> city tinytext,
> state tinytext,
> zip smallint(5) unsigned zerofill default NULL,
> phone tinytext,
> repay_percent tinyint(3) unsigned default NULL,
> url text,
> job_page_url text,
> num_nurses smallint(5) unsigned default NULL,
> active enum('yes','no') NOT NULL default 'yes',
> number_of_beds smallint(5) unsigned NOT NULL default '0',
> type tinytext NOT NULL,
> PRIMARY KEY  (id),
> KEY zip (zip)
> ) TYPE=MyISAM
> 
> MySQL said: 
> 
> You have an error in your SQL syntax near 'desc text,
> photo text,
> address1 tinytext,
> address2 tinytext,
> city ti' at line 7

What's the problem??? My db seems to find on the other machine?

~ Mike
-- 
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org

Personal Site: 
http://www.mikezornek.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




RE: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Ryan Jameson (USA)

Try [desc]

-Original Message-
From: Ryan Jameson (USA) 
Sent: Wednesday, July 10, 2002 10:51 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Mysql syntax error - phpMyAdmin ??


desc is a key word. :-\

-Original Message-
From: Michael Zornek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Mysql syntax error - phpMyAdmin ??


I was using phpMyAdmin to do an export from one machine to another and on
import I got an error:

> Error
> 
> SQL-query :  
> 
> CREATE TABLE hospital (
> id smallint(5) unsigned NOT NULL auto_increment,
> heath_system_id smallint(5) unsigned default NULL,
> name_long tinytext NOT NULL,
> name_short tinytext,
> logo_file_loc text,
> desc text,
> photo text,
> address1 tinytext,
> address2 tinytext,
> city tinytext,
> state tinytext,
> zip smallint(5) unsigned zerofill default NULL,
> phone tinytext,
> repay_percent tinyint(3) unsigned default NULL,
> url text,
> job_page_url text,
> num_nurses smallint(5) unsigned default NULL,
> active enum('yes','no') NOT NULL default 'yes',
> number_of_beds smallint(5) unsigned NOT NULL default '0',
> type tinytext NOT NULL,
> PRIMARY KEY  (id),
> KEY zip (zip)
> ) TYPE=MyISAM
> 
> MySQL said: 
> 
> You have an error in your SQL syntax near 'desc text,
> photo text,
> address1 tinytext,
> address2 tinytext,
> city ti' at line 7

What's the problem??? My db seems to find on the other machine?

~ Mike
-- 
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org

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




Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Chip Atkinson

I can't say for sure, but perhaps "desc" is a reserved word, short for
describe.  What happens if you say something like "description"?

Chip
On Wed, 10 Jul 2002, Michael Zornek wrote:

> I was using phpMyAdmin to do an export from one machine to another and on
> import I got an error:
>
> > Error
> >
> > SQL-query :
> >
> > CREATE TABLE hospital (
> > id smallint(5) unsigned NOT NULL auto_increment,
> > heath_system_id smallint(5) unsigned default NULL,
> > name_long tinytext NOT NULL,
> > name_short tinytext,
> > logo_file_loc text,
> > desc text,
> > photo text,
> > address1 tinytext,
> > address2 tinytext,
> > city tinytext,
> > state tinytext,
> > zip smallint(5) unsigned zerofill default NULL,
> > phone tinytext,
> > repay_percent tinyint(3) unsigned default NULL,
> > url text,
> > job_page_url text,
> > num_nurses smallint(5) unsigned default NULL,
> > active enum('yes','no') NOT NULL default 'yes',
> > number_of_beds smallint(5) unsigned NOT NULL default '0',
> > type tinytext NOT NULL,
> > PRIMARY KEY  (id),
> > KEY zip (zip)
> > ) TYPE=MyISAM
> >
> > MySQL said:
> >
> > You have an error in your SQL syntax near 'desc text,
> > photo text,
> > address1 tinytext,
> > address2 tinytext,
> > city ti' at line 7
>
> What's the problem??? My db seems to find on the other machine?
>
> ~ Mike
> --
> Mike Zornek | Project Leader
> Apple Student Developers
> The Insanely Great Site with the Insanely Long URL
> http://www.applestudentdevelopers.org
>
> Personal Site:
> http://www.mikezornek.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




Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Martin Clifford

DESC is a reserved word in SQL, standing for Descending Order.  That is why you can't 
use it as a table column name.

HTH

Martin

>>> Michael Zornek <[EMAIL PROTECTED]> 07/10/02 12:49PM >>>
I was using phpMyAdmin to do an export from one machine to another and on
import I got an error:

> Error
> 
> SQL-query :  
> 
> CREATE TABLE hospital (
> id smallint(5) unsigned NOT NULL auto_increment,
> heath_system_id smallint(5) unsigned default NULL,
> name_long tinytext NOT NULL,
> name_short tinytext,
> logo_file_loc text,
> desc text,
> photo text,
> address1 tinytext,
> address2 tinytext,
> city tinytext,
> state tinytext,
> zip smallint(5) unsigned zerofill default NULL,
> phone tinytext,
> repay_percent tinyint(3) unsigned default NULL,
> url text,
> job_page_url text,
> num_nurses smallint(5) unsigned default NULL,
> active enum('yes','no') NOT NULL default 'yes',
> number_of_beds smallint(5) unsigned NOT NULL default '0',
> type tinytext NOT NULL,
> PRIMARY KEY  (id),
> KEY zip (zip)
> ) TYPE=MyISAM
> 
> MySQL said: 
> 
> You have an error in your SQL syntax near 'desc text,
> photo text,
> address1 tinytext,
> address2 tinytext,
> city ti' at line 7

What's the problem??? My db seems to find on the other machine?

~ Mike
-- 
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org 

Personal Site: 
http://www.mikezornek.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




RE: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Ryan Jameson (USA)

Sorry, [desc] won't work either. :-(





-Original Message-
From: Chip Atkinson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:54 AM
To: Michael Zornek
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??


I can't say for sure, but perhaps "desc" is a reserved word, short for
describe.  What happens if you say something like "description"?

Chip
On Wed, 10 Jul 2002, Michael Zornek wrote:

> I was using phpMyAdmin to do an export from one machine to another and on
> import I got an error:
>
> > Error
> >
> > SQL-query :
> >
> > CREATE TABLE hospital (
> > id smallint(5) unsigned NOT NULL auto_increment,
> > heath_system_id smallint(5) unsigned default NULL,
> > name_long tinytext NOT NULL,
> > name_short tinytext,
> > logo_file_loc text,
> > desc text,
> > photo text,
> > address1 tinytext,
> > address2 tinytext,
> > city tinytext,
> > state tinytext,
> > zip smallint(5) unsigned zerofill default NULL,
> > phone tinytext,
> > repay_percent tinyint(3) unsigned default NULL,
> > url text,
> > job_page_url text,
> > num_nurses smallint(5) unsigned default NULL,
> > active enum('yes','no') NOT NULL default 'yes',
> > number_of_beds smallint(5) unsigned NOT NULL default '0',
> > type tinytext NOT NULL,
> > PRIMARY KEY  (id),
> > KEY zip (zip)
> > ) TYPE=MyISAM
> >
> > MySQL said:
> >
> > You have an error in your SQL syntax near 'desc text,
> > photo text,
> > address1 tinytext,
> > address2 tinytext,
> > city ti' at line 7
>
> What's the problem??? My db seems to find on the other machine?
>
> ~ Mike
> --
> Mike Zornek | Project Leader
> Apple Student Developers
> The Insanely Great Site with the Insanely Long URL
> http://www.applestudentdevelopers.org
>
> Personal Site:
> http://www.mikezornek.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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Calculating inside query?

2002-07-10 Thread andy

oh I see! There have been '' values in some columns.

Thanx

Andy


"Ryan Jameson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
do both of the fields contain values and are they both numeric? It sure
seems strange to me. I actually created a test and it worked fine, just
copied your query.
<>< Ryan

-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Calculating inside query?


there is no error, it just does not pull out the right values. Just puts out
10 listings and the top10 column (as I named it by alias) contains no value.
I am using mysql.

maybe this has to do somehting with the alias?


"Ryan Jameson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
i assume you're using MySQL because of the Limit clause, but what error are
you receiving?

-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Calculating inside query?


Hi there,

I would like to find out the top 10 of some ratings. There are 2 columns.
One for the rating and one for the amount of ratings.
To find out the top 10 I would have to divide those 2 values and sort it.

Somehow this does not work. I do not have a clue why. Maybe someone of you
guys do see the error:

Mysql:

SELECT
  ID,
  rating_total / ratings_amount AS top10
FROM rating
ORDER BY top10 desc
LIMIT 10

Thanx for any help,

Andy
query




--
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] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Jason Wong

On Thursday 11 July 2002 01:00, Ryan Jameson (USA) wrote:
> Sorry, [desc] won't work either. :-(

Try `desc`.

But it's best not to use 'desc' at all, it will save you confusion in the long 
run.

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


/*
People humiliating a salami!
*/


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




[PHP-DB] How to get data from mysql to .csv?

2002-07-10 Thread matthew de Jongh

hello.

  we are still having no luck figuring out how to do this.

  we downloaded the code for the calendar off of www.php.net and everything 
works great except we can't get the newly approved items to go from mysql 
into the backend.csv

  we would be very appreciative if someone could help us with this.

  matthew


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




Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Michael Zornek

Twas 7/10/02 12:55 PM, when "Martin Clifford" <[EMAIL PROTECTED]> said:

> DESC is a reserved word in SQL, standing for Descending Order.  That is why
> you can't use it as a table column name.

Ok, that makes sence - thanks!

Although I find it a bit curious that building the DB in phpMyAdmin let me
do it, yet base MySQL will not.

Should I report it to the phpMyAdmin team?

~ Mike
-- 
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org

Personal Site: 
http://www.mikezornek.com


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




Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Gurhan Ozen

Hi,
No you should not report it to anyone. Reserved words can be used as column
names in MySQL (although you shouldn't) provided that they are surrounded by
backticks. When you do it in phpMyAdmin, phpMYAdmin is putting everything
inside backticks , so that this problem won't be encountered.
See:
http://www.mysql.com/doc/L/e/Legal_names.html

Gurhan

- Original Message -
From: "Michael Zornek" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 10, 2002 1:30 PM
Subject: Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??


> Twas 7/10/02 12:55 PM, when "Martin Clifford" <[EMAIL PROTECTED]> said:
>
> > DESC is a reserved word in SQL, standing for Descending Order.  That is
why
> > you can't use it as a table column name.
>
> Ok, that makes sence - thanks!
>
> Although I find it a bit curious that building the DB in phpMyAdmin let me
> do it, yet base MySQL will not.
>
> Should I report it to the phpMyAdmin team?
>
> ~ Mike
> --
> Mike Zornek | Project Leader
> Apple Student Developers
> The Insanely Great Site with the Insanely Long URL
> http://www.applestudentdevelopers.org
>
> Personal Site:
> http://www.mikezornek.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] bouncing an idea...

2002-07-10 Thread Kirk Babb

I'm a grad student with a university medical research lab, and they have
thousands of samples coming through.  They want to integrate a web-based
tracking system using barcodes and scanners to trace the samples through the
different processing points in the lab.  And they don't want to pay for a
commercial system - they want something "homegrown" to be cooked up.

I "think" I can handle this, but I haven't found any info about sending data
into a php/mysql system from a scanner.  I've come across some scanners
which handle DDE (dynamic data exchange - sends data directly to a windows
program) Does anybody out there do anything like this using php and mysql?
If so, please send some suggestions my way.  Thanks!!!

-Kirk



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




[PHP-DB] Re: bouncing an idea...

2002-07-10 Thread Kirk Babb

My apologies for these posts, I'm just not sure where to start

I'm asking for info more from the standpoint of finding someone who is using
php & mysql to accept the info from a scanner rather than wanting info about
scanners.


Thanks!

Kirk




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




[PHP-DB] Re: bouncing an idea...

2002-07-10 Thread Martin Clifford

I would think the better way to set the entire system up is to have the barcodes 
scanned directly into a database (your choice), then just have PHP read the database 
and display editing, deleting, etc.

I don't see any reason why the barcode has to go through PHP at all to make this a 
viable application.  Sounds neat though :o)

Martin

>>> "Kirk Babb" <[EMAIL PROTECTED]> 07/10/02 03:36PM >>>
My apologies for these posts, I'm just not sure where to start

I'm asking for info more from the standpoint of finding someone who is using
php & mysql to accept the info from a scanner rather than wanting info about
scanners.


Thanks!

Kirk




-- 
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] PHP Security and Code Design

2002-07-10 Thread Hutchins, Richard

OK, so I was really bored today and started reading through some PHP
security stuff starting with the php.ini-recommended and found the register
globals off stuff. So you don't have to find it yourself, here's a direct
lift from the file:

; This is the recommended, PHP 4-style version of the php.ini-dist file.  It
; sets some non standard settings, that make PHP more efficient, more
secure,
; and encourage cleaner coding.
; The price is that with these settings, PHP may be incompatible with some
; applications, and sometimes, more difficult to develop with.  Using this
; file is warmly recommended for production sites.  As all of the changes
from
; the standard settings are thoroughly documented, you can go over each one,
; and decide whether you want to use it or not.
;
; For general information about the php.ini file, please consult the
php.ini-dist
; file, included in your PHP distribution.
;
; This file is different from the php.ini-dist file in the fact that it
features
; different values for several directives, in order to improve performance,
while
; possibly breaking compatibility with the standard out-of-the-box behavior
of
; PHP 3.  Please make sure you read what's different, and modify your
scripts
; accordingly, if you decide to use this file instead.
;
; - register_globals = Off [Security, Performance]
; Global variables are no longer registered for input data (POST, GET,
cookies,
; environment and other server variables).  Instead of using $foo, you
must use
; you can use $_REQUEST["foo"] (includes any variable that arrives
through the
; request, namely, POST, GET and cookie variables), or use one of the
specific
; $_GET["foo"], $_POST["foo"], $_COOKIE["foo"] or $_FILES["foo"],
depending
; on where the input originates.  Also, you can look at the
; import_request_variables() function.
; Note that register_globals is going to be depracated (i.e., turned off
by
; default) in the next version of PHP, because it often leads to
security bugs.
; Read http://php.net/manual/en/security.registerglobals.php for further
; information.

I understand that this applies to data put into a form to be submitted to a
database (or another page, I guess), but does it also apply to
variable/value pairs passed along the URL from a hyperlink (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] PHP Security and Code Design

2002-07-10 Thread Adam Alkins

> I understand that this applies to data put into a form to be submitted to
a
> database (or another page, I guess), but does it also apply to
> variable/value pairs passed along the URL from a hyperlink ( href="foo/bar.php?thisVar=thisVal>Click here.)? I couldn't quite get
it
> from the explanation above. Would I need to reference the passed variable
> with $_GET["thisVal"] on the receiving page (bar.php)? I'm sure I would
have
> to if $thisVar was passed from a form with the GET method, but wasn't sure
> about the hyperlink stuff.
>
> Anybody working with register globals off already that can clear this up?

Yes. URL passed variables are access via the GET method. So page.php?foo=bar
is accessed by $_GET['foo']

--
Adam Alkins
http://www.rasadam.com
--


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




[PHP-DB] odbc and primary key

2002-07-10 Thread j.a.z.

How can i get the information if a field on a database (in my case
Access2000) is primary key via a php-odbc-function?
or does i have to use sql for that?
thanx j.a.z.



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




RE: [PHP-DB] PHP Security and Code Design

2002-07-10 Thread Hutchins, Richard

Thanks, Adam. All clear now.

Rich

-Original Message-
From: Adam Alkins [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 4:28 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] PHP Security and Code Design


> I understand that this applies to data put into a form to be submitted to
a
> database (or another page, I guess), but does it also apply to
> variable/value pairs passed along the URL from a hyperlink ( href="foo/bar.php?thisVar=thisVal>Click here.)? I couldn't quite get
it
> from the explanation above. Would I need to reference the passed variable
> with $_GET["thisVal"] on the receiving page (bar.php)? I'm sure I would
have
> to if $thisVar was passed from a form with the GET method, but wasn't sure
> about the hyperlink stuff.
>
> Anybody working with register globals off already that can clear this up?

Yes. URL passed variables are access via the GET method. So page.php?foo=bar
is accessed by $_GET['foo']

--
Adam Alkins
http://www.rasadam.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] Re: how do i establish odbc connection?

2002-07-10 Thread j.a.z.

hey gabor

you have to define a DNS on your system. i assume that you know what DNS is
and how to create on windows. if not, say it!
afterwards check, if the odbc has been activated in your php.ini on
windows-directory!

the rest is easy:
the code looks like that:

 if( !$con=odbc_connect($dns,$user,$pwd) ) exit;// establish
connection, if faild exit
 $qry = "SELECT * FROM $table";// generate
the query
 $res=odbc_exec($con,$qry); //
execute query and get result
$fieldscnt = odbc_num_fields($res);// count
fields
 while( $n = odbc_fetch_into($res,&$arr) ) // loop as
long as it has records and fetch data into array
 {
   for( $i=0; $i<$fieldscnt; $i++) //
loop all fields
echo $arr[$i]";
// display value in array on current field-element $i
 }
 if($res) odbc_free_result($res);// free
memory of result if there's a result
 if($con) odbc_close($con); // free
connection if there's an established connection

as you can see, only a few lines...
cheers, j.a.z.



"Gabor Niederlaender" <[EMAIL PROTECTED]> schrieb im
Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all!
>
> I realized, that it is impossible to retrieve "ntext" from an MSSQL DB
> with php normally. (Is this correct?)
>
> But I think it should be possible to make it through ODBC.
> Can someone explain me how this goes? (I think I have set up one ODBC
> Data Source, but I am not sure) But I cannot even imagine how I use
> this stuff for establishing a connection...
>
> Does it really only go this way?
>
> Best regards,
> Gabor



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




[PHP-DB] Re: bouncing an idea...

2002-07-10 Thread Dan Koken

Kirk,
I do lab samples. Currently I have a winery management system. Each time 
they move wine they have to sample it. Larger wineries will have about 
35 processes going at any time. We print sample masters that are affixed 
to sample bottles. Depending on how they set up the Sample Masters. they 
can have on average about 6 to 10 lab analysis that must be done for 
each type sample. They usually take samples about every 1/2 to 1 hour 
apart. Depending on the wine process, it could run anywhere up to 3 
days, some run a week. So for example, if they run a process that 
requires samples 1 hour apart with 6 analysis per sample, and it runs 2 
days, that's about 288 lab analysis that need to be run. And if they are 
running 35 jobs, you get a lot of  samples sent to the lab, and a lot 
more analysis from the lab.  I print the samples with a unique Bar-Code 
beside each analysis. In the lab they have many tools available for 
management such as daily, weekly, monthly, yearly analysis for 
statistical purposes. But for entering data, I have a screen the 
requests sample number (bar-coded) and next to it  a place for result. 
All they do is swipe the Bar-code (analysis number) on the sample and 
enter the result. These are sent to the system and update the 
appropriate data. Much of the lab is dry lab. Some are automated, and 
the bottles are set in a conveyor, a stationary bar-code reader scans 
the bar-code and the result is automatically sent from the lab 
equipment. Most of the automated equipment are GC's and Mass 
Spectrometers, with some miscellaneous specialty equipment.

I use bar-code 3 of 9. But the problem is, not everyone has the 3 of 9 
font. And some are on linux, Mac's, and even M$ systems. Plus there 
isn't any good bar code fonts. To get around it,  I wrote my own, and it 
does not require any site to have the font on their system in order to work.

Hope this helps some.
Have a great day... Dan.
=


Kirk Babb wrote:

> I'm a grad student with a university medical research lab, and they have
> thousands of samples coming through.  They want to integrate a web-based
> tracking system using barcodes and scanners to trace the samples through the
> different processing points in the lab.  And they don't want to pay for a
> commercial system - they want something "homegrown" to be cooked up.
> 
> I "think" I can handle this, but I haven't found any info about sending data
> into a php/mysql system from a scanner.  I've come across some scanners
> which handle DDE (dynamic data exchange - sends data directly to a windows
> program) Does anybody out there do anything like this using php and mysql?
> If so, please send some suggestions my way.  Thanks!!!
> 
> -Kirk
> 
> 
> 


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




[PHP-DB] sort problem

2002-07-10 Thread andy

Hi guys,

I have a problem sorting values comming out of a db. It is not as easy.

Here is the prob:
One table containing user points.
Other table containing reports with rankings
For each top 10 report (the 10 reports with the most ranking) there are 20
extra points granted

Now I would like to get the top 5 members out of the db. If I only pull out
the user table ordered by points desc limit 5 I might miss a user with a top
10 report and 20 extra points.

So I thought about sorting the array afterwards with asort, but then I loose
the asoziation with the user_id.

Maybe there is a way to sort the other arrays with the same sorting algo? Or
a way to include a iff clause in the query?

currently I am doing:
SELECT
u_name,
id,
points
FROM user
WHERE
points > 0
ORDER by points desc
LIMIT 5

and the top10 reports extra.

Has anybody a good idea on that?

Andy



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




[PHP-DB] Select string.

2002-07-10 Thread Shiloh Madsen

Yet another thing i need some quick help with. What is the proper way to 
generate a select string in php. I know if youre trying to select a 
value from a column you need to enclose it in double quotes if youre 
doing it directly in sql. in this case the value in question is being 
passed as a variable from a previous page. i have the current line for 
selection in my page, but i dont think it is correct. any help?

$login = mysql_query("SELECT * FROM Users WHERE Username =". $User_Name)


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




RE: [PHP-DB] Select string.

2002-07-10 Thread Shrock, Court

$login = mysql_query("SELECT * FROM Users WHERE Username ='$User_Name'");

> -Original Message-
> From: Shiloh Madsen [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, July 10, 2002 4:48 PM
> To: php-db
> Subject: [PHP-DB] Select string. 
> 
> 
> Yet another thing i need some quick help with. What is the 
> proper way to 
> generate a select string in php. I know if youre trying to select a 
> value from a column you need to enclose it in double quotes if youre 
> doing it directly in sql. in this case the value in question is being 
> passed as a variable from a previous page. i have the current 
> line for 
> selection in my page, but i dont think it is correct. any help?
> 
> $login = mysql_query("SELECT * FROM Users WHERE Username =". 
> $User_Name)
> 
> 
> -- 
> 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] A Simple Question

2002-07-10 Thread Beau Lebens

Ahhh - good correction Adam, I forgot about that method :)
 
So I suppose if you already have an array and wanted to pass it in a
link/URL then you could do something like
 
foreach($array as $value) {
$qstring .= 'array[]=' . $value . '&';
}
 
echo 'link';
 
then on link.php you'd have the array $array[] (with globals) or
$_GET['array'][]
 
cool
 
Beau

-Original Message-
From: Adam Royle [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 10 July 2002 9:05 PM
To: Beau Lebens; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] A Simple Question



Just a correction you can use arrays with querystrings 


page.php?var1[]=first&var1[]=second&var1[]=third 


$var1 

Array 

( 

[0] => first 

[1] => second 

[2] => third 

) 



OR 


page.php?var1[]=first&var2[2]=second&var2[]=third 


$var 1 

Array 

( 

[0] => first 

) 


$var2 

Array 

( 

[2] => second 

[3] => third 

) 


You can also have multidimensional arrays, but not associative arrays. 


But you do have the 255 character limitation (can be a bummer). 


Adam 



Also, as far as limitations go, the following are considerations; 


1. You can't pass an array using the querystring 

2. Multiline variables (ie.  contents) are bad 

3. There is a limit of 255 or something characters to a URI (someone?) 

4. Be careful with the $_GET[] array that Tony mentions, it is only 

available on more recent versions of PHP, before that it was $HTTP_GET_VARS 

and a lot of people had been using just plain $var1 or whatever, assuming 

that "register_globals" would always be ON in the php.ini file (which also 

changed in recent versions). 


HTH 


Beau 




[PHP-DB] Re: Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> I was using phpMyAdmin to do an export from one machine to another and on
> import I got an error:
> 
> > Error
> >=20
> > SQL-query=A0:=A0=20
> >=20
> > CREATE TABLE hospital (
> > id smallint(5) unsigned NOT NULL auto_increment,
> > heath_system_id smallint(5) unsigned default NULL,
> > name_long tinytext NOT NULL,
> > name_short tinytext,
> > logo_file_loc text,
> > desc text,
> > photo text,
> > address1 tinytext,
> > address2 tinytext,
> > city tinytext,
> > state tinytext,
> > zip smallint(5) unsigned zerofill default NULL,
> > phone tinytext,
> > repay_percent tinyint(3) unsigned default NULL,
> > url text,
> > job_page_url text,
> > num_nurses smallint(5) unsigned default NULL,
> > active enum('yes','no') NOT NULL default 'yes',
> > number_of_beds smallint(5) unsigned NOT NULL default '0',
> > type tinytext NOT NULL,
> > PRIMARY KEY  (id),
> > KEY zip (zip)
> > ) TYPE=3DMyISAM
> >=20
> > MySQL said:=20
> >=20
> > You have an error in your SQL syntax near 'desc text,
> > photo text,
> > address1 tinytext,
> > address2 tinytext,
> > city ti' at line 7
> 
> What's the problem??? My db seems to find on the other machine?

DESC is a reserverd word - used with ORDER BY to signify DESCending order.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP-DB] RH7.3+Oracle9i(9.2.0)Client+PHP4.2.1+Apache1.3.26

2002-07-10 Thread Gordon Yeung

I'm just upgrading Linux Server to RH7.3 and installed
Oracle9i(9.2.0) Client+PHP4.2.1+Apache1.3.26

Everything goes smoothly. However, when I access the
Oracle server by means of PHP, it gives the following error:

Warning: OCIStmtExecute: ORA-00909: invalid number of arguments

The line that cause the error is:

$result = ociexecute($cursor);

The same PHP is running well in my old server
(RH6.2+Oracle8i(8.0.x)+PHP4.0.3+Apache1.3.12).

Can anyone here give me advice ?

Thanks
Gordon Yeung




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




RE: [PHP-DB] Date comparison problem

2002-07-10 Thread Gabor Niederlaender

But I would like to do it the other way round. I mean for the solution
you have mentioned, I have to make the query on the whole record, then
compare the two dates and filter the right ones. I'd like to make the
query look like:

SELECT something FROM table WHERE datetime < "$form_date"

So I think I have to adjust the form of my "$form_date".

Or am I making a mistake somewhere?

Thanx
Gabor

---
> This is how I do it:
> 
> date("m/d/Y",strtotime(odbc_result($rs,"ts")))
> 
> where $rs is the result set and "ts" is the name of the field
containing the datetime.
> 
> <>< Ryan
> 
> -Original Message-
> From: Gabor Niederlaender [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 8:21 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Date comparison problem
> 
> 
> Hi all!
> 
> I have got a "datetime" field in a MS-SQL DB, and I have a "date
> field" in my html-form with the format: DD/MM/.
> 
> I would like to compare the two, but I think the two formats are a
bit
> different and they do not really want to be compared:)
> 
> If I write a query to write out the "datetime" field from the DB, I
> get the form :
> 
> 02 05 2002 12:25 
> 
> In the HTML-form it looks a bit different: 12/10/2000
> 
> I do not really want to explode the form-data and than build a new
> timestamp, it has to be a more simple way.
> 
> Thanks, best regards
> 
> Gabor
> 
> -- 
> 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