[PHP-DB] mysql tables

2002-04-24 Thread Marius Ursache

hi

how many columns can have a mysql table?

tnx

--
  Marius Ursache (3563 || 3494)

   \|/  \|/
   '/ ,. \`
   /_| \__/ |_\
  \__U_/



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




Re: [PHP-DB] mysql tables

2002-04-24 Thread Miles Thompson

Read the MySQL docs and find out!
MT
At 10:27 AM 4/24/2002 +0300, Marius Ursache wrote:
hi

how many columns can have a mysql table?

tnx

--
   Marius Ursache (3563 || 3494)

\|/  \|/
'/ ,. \`
/_| \__/ |_\
   \__U_/



--
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] redirect a page

2002-04-24 Thread Natividad Castro

Hi to all,
I have a search form where users can search for a specific record; up to now
is working fine, but what I would like to do is: if the record is not found,
redirect them to another page that says that record was not found. Can
anybody tell me how to do this? I already tried using this statement
if ( !mysql_fetch_array($result) ) {
include file // this the page that I want to redirect them, but it doen't
work
}

I would like to execute the first statement it's false:
e.g if name doesn't match with anything in the table, redirect to another
page
else execute the whole query.

   $query = mysql_query(SELECT * from 150bk where trim(NAME) like '% .
$legal_name . %');

   while($query_data = mysql_fetch_array($query))
   {
  $id = trim($query_data[ID]);
  $name = trim($query_data[NAME]);
  $tracking_num = trim($query_data[TRACKING_NUMBER]);
  $census = trim($query_data[CENSUS_NUM]);
  $name_dba = trim($query_data[NAME_DBA]);
}

Any help, it's greatly appreciate
Thanks
Nato


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




Re: [PHP-DB] User getting superuser access. ack!

2002-04-24 Thread J. Wharton

here's the code for findLoginType($username):

function findLoginType($username)
{
 $dbusername=foo;
 $password=bar;
 DBConnect($dbusername, $password); //sets up a connection with the mysql
database

 $userquery=select * from users where username='$username';
 $theresultsplz=mysql_query($userquery) or die (mysql_error());
 $indinfo=mysql_fetch_object($theresultsplz);
 return $indinfo-usertype;
}


[EMAIL PROTECTED] wrote in message
01c701c1eb00$3fdf7120$[EMAIL PROTECTED]">news:01c701c1eb00$3fdf7120$[EMAIL PROTECTED]...
 Well, that looks like a problem within the findLoginType()
 call.  Since it's not been included, it's hard to help you. :)

 'Luck

 -Szii


 - Original Message -
 From: J. Wharton [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, April 23, 2002 11:09 AM
 Subject: [PHP-DB] User getting superuser access. ack!


  I am having a problem where from certain browsers, a user gets the
superuser
  access, but from mine, she gets normal access. Help!
 
  Here is a snippet of my code:
 
  //findLoginType returns a single character code stored in the user table
for
  each user.
  //variable $username=$REMOTE_USER as previously defined.
 
  $hm=findLoginType($username);
  if ($hm=='s')
  {echo meta http-equiv=\refresh\ content=\0; URL=supaIndex.php\;}
 
  else
  { //do normal user stuff}
 
 
 
 
 
  --
  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] redirect a page

2002-04-24 Thread John Hughes

If you really want to redirect and not just display a message that no
records were found, then this will work:

$num = mysql_numrows($result); 
if ($num == 0) 
{
 header(Location: sorry.php);
 exit;
} ELSE {
 while ...






--- Rankin, Randy [EMAIL PROTECTED] wrote:
 Nato,
 
 Try something like this:
 
 $num = mysql_numrows($result); 
 if ($num == 0) 
   
   {
   echo There were no records found.;
   }
 else
   while ...
 
 -Original Message-
 From: Natividad Castro [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 24, 2002 11:01 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] redirect a page
 
 
 Hi to all,
 I have a search form where users can search for a specific record;
 up to now
 is working fine, but what I would like to do is: if the record is
 not found,
 redirect them to another page that says that record was not found.
 Can
 anybody tell me how to do this? I already tried using this
 statement
 if ( !mysql_fetch_array($result) ) {
 include file // this the page that I want to redirect them, but it
 doen't
 work
 }
 
 I would like to execute the first statement it's false:
 e.g if name doesn't match with anything in the table, redirect to
 another
 page
 else execute the whole query.
 
$query = mysql_query(SELECT * from 150bk where trim(NAME) like
 '% .
 $legal_name . %');
 
while($query_data = mysql_fetch_array($query))
{
   $id = trim($query_data[ID]);
   $name = trim($query_data[NAME]);
   $tracking_num = trim($query_data[TRACKING_NUMBER]);
 $census = trim($query_data[CENSUS_NUM]);
 $name_dba = trim($query_data[NAME_DBA]);
 }
 
 Any help, it's greatly appreciate
 Thanks
 Nato
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

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




[PHP-DB] determine the primary key after adding a row to a table (mysql)

2002-04-24 Thread CJ

is there any way to determine the primary key of a row after it's added to a
table in mysql?

i need to do this because i have another table which requires the id from
one table as a foreign key.



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




Fw: [PHP-DB] determine the primary key after adding a row to a table (mysql)

2002-04-24 Thread Richard Emery

$lastid = mysql_last_id();

returns auto_increment from inserted record
- Original Message -
From: CJ [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 24, 2002 4:19 PM
Subject: [PHP-DB] determine the primary key after adding a row to a table
(mysql)


is there any way to determine the primary key of a row after it's added to a
table in mysql?

i need to do this because i have another table which requires the id from
one table as a foreign key.



--
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] Search tutroial

2002-04-24 Thread Jennifer Downey

Hi all,

Would someone kindly point me to a tutorial on designing a search script for
mysql db.
I have tried to build one but can't get anywhere with it.

Thanks
Jennifer

--
The sleeper has awaken


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP-DB] Search tutroial

2002-04-24 Thread Dan Swensen

Getting a search function running perplexed me, too, until I looked at the 
MySQL docs. With the Full-Text Search function I got a search function 
working in minutes. 

http://www.mysql.com/doc/F/u/Fulltext_Search.html

Watch out for the weird bug that ignores duplicate rows, though. It can make 
for zero returns in small databases for no logical reason. That drove me nuts 
until I figured out why it was happening. (It's mentioned at the bottom of 
the docs.) 


 Hi all,
 
 Would someone kindly point me to a tutorial on designing a search 
 script for mysql db. I have tried to build one but can't get 
 anywhere with it.
 
 Thanks
 Jennifer
 
 --
 The sleeper has awaken
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 
 -- 
 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] Search tutroial

2002-04-24 Thread Julie Meloni


JD Would someone kindly point me to a tutorial on designing a search script for
JD mysql db.
JD I have tried to build one but can't get anywhere with it.

Well, that would depend on what and how you are searching, your table
structure, etc.  Essentially, every SELECT query is a search.

If you post more information about your table(s) structure, your
search methods and the search parameters, people would probably be
able to help you.


- Julie

-- Julie Meloni
-- [EMAIL PROTECTED]
-- www.thickbook.com

Find Sams Teach Yourself MySQL in 24 Hours at
http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20


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




Re: [PHP-DB] Search tutroial

2002-04-24 Thread Jennifer Downey

This is basically what I am trying to do
if($search)
{
$query = SELECT uid, id, image, iname, quantity, type FROM
{$config[prefix]}_shop WHERE  iname = $shopsearch;
  $ret = mysql_query($query);
  while(list($quantity)=mysql_fetch_row($ret))

   $name = $row['user'];
   echo $name;

}else{

echo FORM METHOD=post ACTION='$PHP_SELF';
echo Search ShopsBRinput type=text name=\shopsearch\ value=\\;
echo BRINPUT TYPE='submit' NAME='search' VALUE='Search';

}

This is a dump of the table

uid int(10) NOT NULL default '0',
  id int(5) NOT NULL default '0',
  iname varchar(50) NOT NULL default '',
  image varchar(100) NOT NULL default '',
  quantity int(10) unsigned NOT NULL default '1',
  type varchar(20) NOT NULL default '',
  price int(6) NOT NULL default '0',
  user varchar(50) NOT NULL default '',
  KEY uid (uid)

Just a note this works throughout my site and I have no trouble with it:
{$config[prefix]}_shop
I'm not trying to be rude but I get sick of it when people tell me that this
is the problem when it has nothing to do with the question I am asking.

Thanks for your time and help
Jennifer

Julie Meloni [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 JD Would someone kindly point me to a tutorial on designing a search
script for
 JD mysql db.
 JD I have tried to build one but can't get anywhere with it.

 Well, that would depend on what and how you are searching, your table
 structure, etc.  Essentially, every SELECT query is a search.

 If you post more information about your table(s) structure, your
 search methods and the search parameters, people would probably be
 able to help you.


 - Julie

 -- Julie Meloni
 -- [EMAIL PROTECTED]
 -- www.thickbook.com

 Find Sams Teach Yourself MySQL in 24 Hours at
 http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP-DB] Search tutroial

2002-04-24 Thread Jennifer Downey

By the way SELECT uid, id, image, iname, quantity, type, user where it shows
below that user isn't in the query- it is there in my editor.
I just forgot to put it in before sending.
Jennifer
Jennifer Downey [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 This is basically what I am trying to do
 if($search)
 {
 $query = SELECT uid, id, image, iname, quantity, type FROM
 {$config[prefix]}_shop WHERE  iname = $shopsearch;
   $ret = mysql_query($query);
   while(list($quantity)=mysql_fetch_row($ret))

$name = $row['user'];
echo $name;

 }else{

 echo FORM METHOD=post ACTION='$PHP_SELF';
 echo Search ShopsBRinput type=text name=\shopsearch\ value=\\;
 echo BRINPUT TYPE='submit' NAME='search' VALUE='Search';

 }

 This is a dump of the table

 uid int(10) NOT NULL default '0',
   id int(5) NOT NULL default '0',
   iname varchar(50) NOT NULL default '',
   image varchar(100) NOT NULL default '',
   quantity int(10) unsigned NOT NULL default '1',
   type varchar(20) NOT NULL default '',
   price int(6) NOT NULL default '0',
   user varchar(50) NOT NULL default '',
   KEY uid (uid)

 Just a note this works throughout my site and I have no trouble with it:
 {$config[prefix]}_shop
 I'm not trying to be rude but I get sick of it when people tell me that
this
 is the problem when it has nothing to do with the question I am asking.

 Thanks for your time and help
 Jennifer

 Julie Meloni [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
  JD Would someone kindly point me to a tutorial on designing a search
 script for
  JD mysql db.
  JD I have tried to build one but can't get anywhere with it.
 
  Well, that would depend on what and how you are searching, your table
  structure, etc.  Essentially, every SELECT query is a search.
 
  If you post more information about your table(s) structure, your
  search methods and the search parameters, people would probably be
  able to help you.
 
 
  - Julie
 
  -- Julie Meloni
  -- [EMAIL PROTECTED]
  -- www.thickbook.com
 
  Find Sams Teach Yourself MySQL in 24 Hours at
  http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20
 


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP-DB] Search tutroial

2002-04-24 Thread Dan Brunner

Hello!!

Use LIKE in your WHERE clause...

You can also more then when Field

Example.

$query = SELECT uid, id, image, iname, quantity, type FROM
{$config[prefix]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY 
iname';
   $ret = mysql_query($query);
   while(list($quantity)=mysql_fetch_row($ret))

Dan



On Wednesday, April 24, 2002, at 01:47 PM, [EMAIL PROTECTED] wrote:

 By the way SELECT uid, id, image, iname, quantity, type, user where it 
 shows
 below that user isn't in the query- it is there in my editor.
 I just forgot to put it in before sending.
 Jennifer
 Jennifer Downey [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 This is basically what I am trying to do
 if($search)
 {
 $query = SELECT uid, id, image, iname, quantity, type FROM
 {$config[prefix]}_shop WHERE  iname = $shopsearch;
   $ret = mysql_query($query);
   while(list($quantity)=mysql_fetch_row($ret))

$name = $row['user'];
echo $name;

 }else{

 echo FORM METHOD=post ACTION='$PHP_SELF';
 echo Search ShopsBRinput type=text name=\shopsearch\ 
 value=\\;
 echo BRINPUT TYPE='submit' NAME='search' VALUE='Search';

 }

 This is a dump of the table

 uid int(10) NOT NULL default '0',
   id int(5) NOT NULL default '0',
   iname varchar(50) NOT NULL default '',
   image varchar(100) NOT NULL default '',
   quantity int(10) unsigned NOT NULL default '1',
   type varchar(20) NOT NULL default '',
   price int(6) NOT NULL default '0',
   user varchar(50) NOT NULL default '',
   KEY uid (uid)

 Just a note this works throughout my site and I have no trouble with 
 it:
 {$config[prefix]}_shop
 I'm not trying to be rude but I get sick of it when people tell me that
 this
 is the problem when it has nothing to do with the question I am asking.

 Thanks for your time and help
 Jennifer

 Julie Meloni [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 JD Would someone kindly point me to a tutorial on designing a search
 script for
 JD mysql db.
 JD I have tried to build one but can't get anywhere with it.

 Well, that would depend on what and how you are searching, your table
 structure, etc.  Essentially, every SELECT query is a search.

 If you post more information about your table(s) structure, your
 search methods and the search parameters, people would probably be
 able to help you.


 - Julie

 -- Julie Meloni
 -- [EMAIL PROTECTED]
 -- www.thickbook.com

 Find Sams Teach Yourself MySQL in 24 Hours at
 http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20



 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002




 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



 --
 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[2]: [PHP-DB] Search tutroial

2002-04-24 Thread Julie Meloni

JD By the way SELECT uid, id, image, iname, quantity, type, user where it shows
JD below that user isn't in the query- it is there in my editor.
 $query = SELECT uid, id, image, iname, quantity, type FROM 
{$config[prefix]}_shop WHERE  iname = $shopsearch;

The first problem would be that your search string needs to be enclosed
in quotes, preferably single, or at the very least escaped double
quotes.

Presumably, you want to find things that are inexact matches, but darn
close, and in that case you can use LIKE in your query.  Look in the
MySQL manual for the various permutations of LIKE clauses.

But fundamentally, you should to throw in an or die(mysql_error()) in
conjunction with your mysql_query function.  IE:

$ret = mysql_query($query) or die(mysql_error());

This will tell you exactly the problem when executing a query. And as
others have said, another fine way to debug your queries is to simply
echo them to the screen, look at what is being sent to MySQL, and
trying it manually if the problem isn't glaringly obvious.

But first, surround your search term with quotes and see how far you
get.

- Julie

-- Julie Meloni
-- [EMAIL PROTECTED]
-- www.thickbook.com

Find Sams Teach Yourself MySQL in 24 Hours at
http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20


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




[PHP-DB] ODBC problems in PHP 4.2

2002-04-24 Thread Ryan Jameson (USA)

If this is easy for anyone could someone verify that:

odbc_fetch_row($rs,0);  

...does not reset the result set in version 4.2? From what I can tell it doesn't work 
at all. I want to be certain that we cannot upgrade to 4.2. If someone has another way 
to reset an ODBC result set I'd love to hear about it. It's done in a central core 
function, but is necessary in a plethora of scripts. The result set comes from the MS 
SQL Server driver.
Thanks!

 Ryan

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




[PHP-DB] Re: WELCOME to php-db@lists.php.net

2002-04-24 Thread Jeff Hibser


Hello,

I am relatively new to php, and have a question regarding polling a 
mysql database and defining groups of data:

Say I have a table that looks like this:

Time|  Speed

1016278580  |   0
1016278582  |   0
1016278584  |   0
1016278586  |   3
1016278588  |   7
1016278590  |   5
1016278592  |   4
1016278594  |   0
1016278596  |   0
1016278598  |   2
1016278600  |   0


Now, the time is epoch time. Speed is MPH (so 0 means I am stopped). 
What I want to do is make a call into mysql that will return to me when 
I stopped, and for how long. IE:

You stop at 1016278580 for 6 seconds (calculated until speed !=0).
You also stopped at 1016278594 for 4 seconds
You also stopped at 1016278600 , and are still stopped (or something 
like that)

Whats the best way to do this? I can query the database for every row 
where speed = 0, but how do I make the distinction between the groups 
of 0's (IE, in the example above I would essentially have 
three groups of zeros that I would need to identify). Is there 
someway to pull the data out of mysql in this format (Select * WHERE 
speed=0 UNTIL speed !=0)? Something like that? Or would this be better 
handled by PHP after pulling the data out of mysql?

Any help I can get on this would be greatly appreciated.

Thanks.

-Jeff


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




[PHP-DB] Re: determine the primary key after adding a row to a table (mysql)

2002-04-24 Thread J. Wharton

I encountered something similar. Here is a snippet of code:

$tdate=date(Y\\-m\\-d);
$time=date(G\\:i\\:s);

$query=insert into trackinginfo (IP_Address, username, date, Time,
Processed, CommentFlag)
 values ('$REMOTE_ADDR', '$username', '$tdate', '$time', 'N',
'$commentExists');

mysql_query($query) or die(mysql_error());

//RecordID is an auto incrementing primary key.

$query=select RecordID from trackinginfo where IP_Address='$REMOTE_ADDR'
  and username='$username'
  and date='$tdate'
  and Time= '$time';

//used those variables as they are static for the page. And yes, that is a
bit of overkill you see there.
$result = mysql_query($query) or die(mysql_error());
$dummyvar = mysql_fetch_object($result);

$sid=$dummyvar-RecordID;



Cj [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 is there any way to determine the primary key of a row after it's added to
a
 table in mysql?

 i need to do this because i have another table which requires the id from
 one table as a foreign key.





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




Re: [PHP-DB] User getting superuser access. ack!

2002-04-24 Thread szii

It looks like $indinfo *may* get set to FALSE
and passed back on a failed query.  I'd vardump()
the $username in findLoginType() and make sure 
it's going in correctly, and that your output is not
FALSE coming out.

I also seem to remember something about 
== not being an equality operator for strings.
Seems like, and I may be incorrect here, that
$a == $b is only true if they reference the same
object in memory.  Perhaps there's something
about that for $a == 's'

For giggles, use strcmp() and see if it helps.
That == issue is about 1-2 years old by now,
and I'm not sure if it ever changed, or what the
status is currently.

'Luck!

-Szii

- Original Message - 
From: J. Wharton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 24, 2002 8:51 AM
Subject: Re: [PHP-DB] User getting superuser access. ack!


 here's the code for findLoginType($username):
 
 function findLoginType($username)
 {
  $dbusername=foo;
  $password=bar;
  DBConnect($dbusername, $password); //sets up a connection with the mysql
 database
 
  $userquery=select * from users where username='$username';
  $theresultsplz=mysql_query($userquery) or die (mysql_error());
  $indinfo=mysql_fetch_object($theresultsplz);
  return $indinfo-usertype;
 }
 
 
 [EMAIL PROTECTED] wrote in message
 01c701c1eb00$3fdf7120$[EMAIL PROTECTED]">news:01c701c1eb00$3fdf7120$[EMAIL PROTECTED]...
  Well, that looks like a problem within the findLoginType()
  call.  Since it's not been included, it's hard to help you. :)
 
  'Luck
 
  -Szii
 
 
  - Original Message -
  From: J. Wharton [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, April 23, 2002 11:09 AM
  Subject: [PHP-DB] User getting superuser access. ack!
 
 
   I am having a problem where from certain browsers, a user gets the
 superuser
   access, but from mine, she gets normal access. Help!
  
   Here is a snippet of my code:
  
   //findLoginType returns a single character code stored in the user table
 for
   each user.
   //variable $username=$REMOTE_USER as previously defined.
  
   $hm=findLoginType($username);
   if ($hm=='s')
   {echo meta http-equiv=\refresh\ content=\0; URL=supaIndex.php\;}
  
   else
   { //do normal user stuff}
  
  
  
  
  
   --
   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] Re: WELCOME to php-db@lists.php.net

2002-04-24 Thread Ryan Jameson (USA)

Interesting challenge. 

I tend to write TSQL more these days so this may not work on MySQL but the subquery 
approach should give you an idea of the method. I just typed this up so it may not 
even work! :-)

select min(stopped) as Stopped,Started, (Started-min(stopped)) as Duration from 
(select top 100 percent tbl1.myTime as Stopped,min(tbl2.myTime) as Started from
 
(select * from myTable where mySpeed = 0) as tbl1 
left join 
(select top 100 percent * from myTable where mySpeed  0 order by myTime ) as tbl2 
on tbl2.myTime  tbl1.myTime
group by tbl1.myTime
order by tbl1.myTime
) as tbl3
where started is not NULL
group by started

 Ryan


-Original Message-
From: Jeff Hibser [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 1:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: WELCOME to [EMAIL PROTECTED]



Hello,

I am relatively new to php, and have a question regarding polling a 
mysql database and defining groups of data:

Say I have a table that looks like this:

Time|  Speed

1016278580  |   0
1016278582  |   0
1016278584  |   0
1016278586  |   3
1016278588  |   7
1016278590  |   5
1016278592  |   4
1016278594  |   0
1016278596  |   0
1016278598  |   2
1016278600  |   0


Now, the time is epoch time. Speed is MPH (so 0 means I am stopped). 
What I want to do is make a call into mysql that will return to me when 
I stopped, and for how long. IE:

You stop at 1016278580 for 6 seconds (calculated until speed !=0).
You also stopped at 1016278594 for 4 seconds
You also stopped at 1016278600 , and are still stopped (or something 
like that)

Whats the best way to do this? I can query the database for every row 
where speed = 0, but how do I make the distinction between the groups 
of 0's (IE, in the example above I would essentially have 
three groups of zeros that I would need to identify). Is there 
someway to pull the data out of mysql in this format (Select * WHERE 
speed=0 UNTIL speed !=0)? Something like that? Or would this be better 
handled by PHP after pulling the data out of mysql?

Any help I can get on this would be greatly appreciated.

Thanks.

-Jeff


-- 
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] PROBLEM: localhost - localhost.localdomain

2002-04-24 Thread Erich Fuchs

Hello Freaks,

i have a strange problem, with PHP 4.2.0, RedHat 7.1, mySQL Server version
3.23.36, PHP internal mySQL Client running on two Servers with exactly the
same Settings and Compilations.

Now i have a DB User with rights on host localhost

on one server i can connect normall, the second says no connection possible,
if i change the db-permissions on the 2nd server to localhost.localdomain
all works fine.

CAN ANYBODY EXPLAIN WHATS GOING ON HERE ?!?! where is it possible to change
the hostsname handling ???

THX in advance !!!


--

warmest regards

--
Erich Fuchs
CEO

http://www.netone.at - PHP-Software-Design, Home of phpBazar, phpBannerEx,
phpListPro, ...
http://www.nethat.com - Webhosting, Applicationhosting, ... US and EU
DataCenters
http://www.domaintip.com - Domainname-Services, Registration   $9.95/yr,
DomainTrade, DomainValueCheck
http://www.upads.com - TrafficTools for your Site, BannerExchange,
PopUpService, Sitesubmission, ... FREE




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




Re: [PHP-DB] PROBLEM: localhost - localhost.localdomain

2002-04-24 Thread php3

Addressed to: Erich Fuchs [EMAIL PROTECTED]
  [EMAIL PROTECTED]

** Reply to note from Erich Fuchs [EMAIL PROTECTED] Wed, 24 Apr 2002 20:04:11 
+0200

 i have a strange problem, with PHP 4.2.0, RedHat 7.1, mySQL Server version
 3.23.36, PHP internal mySQL Client running on two Servers with exactly the
 same Settings and Compilations.


 CAN ANYBODY EXPLAIN WHATS GOING ON HERE ?!?! where is it possible to change
 the hostsname handling ???


You may be bumping into a bug in PHP 4.2.0.  There has been some discussion
about a problem with socket based (localhost) connections to MySQL with
this version of PHP.  4.2.1 release canidate 1 is expected Friday.  This
should be fixed, along with some problems with using PHP with Apache 2.


Rick

Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com

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




[PHP-DB] Weird Windows SQL

2002-04-24 Thread Michael K. Dolan Jr.

Hi, I just installed MySQL on Windows XP.

The winmysqladmin GUI only allows me to create databases that start with test. So, I 
can create a database called testmydata but I cannot create a database named 
mydata. This is driving me nuts. Any ideas?

Thanks,

Mike



RE: [PHP-DB] Weird Windows SQL

2002-04-24 Thread Peter Lovatt

have you set up permissions for the user you are connecting as?
see  GRANT in the MySql manual. The test bit is a default setting for users
with no privileges (from my slightly rusty memory)

HTH

Peter

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

 -Original Message-
 From: Michael K. Dolan Jr. [mailto:[EMAIL PROTECTED]]
 Sent: 25 April 2002 00:40
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Weird Windows SQL


 Hi, I just installed MySQL on Windows XP.

 The winmysqladmin GUI only allows me to create databases that
 start with test. So, I can create a database called
 testmydata but I cannot create a database named mydata. This
 is driving me nuts. Any ideas?

 Thanks,

 Mike



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




Re: [PHP-DB] Weird Windows SQL

2002-04-24 Thread Michael K. Dolan Jr.

I can create new databases if I create them from the command line logging
into mysql as root. However, I'm new to the GUI and I guess I would like to
login to the GUI as root. Do you know how to do this?


- Original Message -
From: Peter Lovatt [EMAIL PROTECTED]
To: Michael K. Dolan Jr. [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Wednesday, April 24, 2002 7:55 PM
Subject: RE: [PHP-DB] Weird Windows SQL


 have you set up permissions for the user you are connecting as?
 see  GRANT in the MySql manual. The test bit is a default setting for
users
 with no privileges (from my slightly rusty memory)

 HTH

 Peter

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

  -Original Message-
  From: Michael K. Dolan Jr. [mailto:[EMAIL PROTECTED]]
  Sent: 25 April 2002 00:40
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Weird Windows SQL
 
 
  Hi, I just installed MySQL on Windows XP.
 
  The winmysqladmin GUI only allows me to create databases that
  start with test. So, I can create a database called
  testmydata but I cannot create a database named mydata. This
  is driving me nuts. Any ideas?
 
  Thanks,
 
  Mike
 


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



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




[PHP-DB] Sybase - MSSQL Server 2000

2002-04-24 Thread tbrownridge

PHP.NET indicates that to connect to MSSQL Server, from Linux use Sybase.
I've installed Sybase, PHP and Apache and everything works well on my Linux
server when I connect to the Sybase test database.

When I try to connect to my MS SQL server, I get this...

sybase$ isql -S mssql-server -U username -P password
DB-LIBRARY error:
Unexpected EOF from SQL Server.

Anyone have any suggestions?

--Tom Brownridge


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




[PHP-DB] PHP tips to make your life easier

2002-04-24 Thread Adam Royle

Hello everybody,

There are some techniques which I use that come in REALLY handy when 
writing PHP (or even ASP). I will just go through them here briefly. Any 
questions? Email me.

1. Keep a php file (lib.php) inside a 'code' folder in a directory for 
every site you work on (depending on security needs, you might want to 
keep it out oft he web directory). In this file, keep your functions 
that you are likely to use again and again. In mine, I keep my database 
connection and query functions, and all the other string/array functions 
I create. Your pages become cleaner and to start a new page, all you 
have to type is the following:

?php include 'code/lib.php';

?

2. Try to use functions (and classes) to your advantage. Write them. I 
have written a few to make my life easier.

// Open a database connection
dbConnect();

// select and put into 2d associative array
$sql = SELECT * FROM tblTable;
$data = getData($sql, ASSOC);

If you want to use these functions, send me an email and I will send 
them to you. They are very flexible (although they are only mySQL 
compatible). Here are some functions that I wrote when I first started 
using PHP:

// if you want to quickly test a variable (such as an sql statement) 
chuck this in... saves time.

test($sql);

function test($str){
echo $str;
exit();
}

// Useful for: printing arrays and seeing their structure preformatted 
from php
// Example:
/*

plainText();

print_r($array);

*/

function plainText(){
header (Content-Type: text/plain);
}


// Useful for: sending someone back to the last page they were on
// Usage: goBack();

function goBack(){
header (Location: $HTTP_REFERER);
exit;
}



// Useful for: quick redirection to another page
// Usage: go(url.php);

function go($URL){
header (Location: $URL);
exit();
}


So you see, these functions aren't big, and they don't have to be, but 
it cleans things up a bit and makes your code more readable... And as a 
huge bonus, a lot of your syntax errors/spelling errors are fixed 
because you don't have to type as much.

Adam


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