Re: [PHP-DB] MySq lType and PHP??

2001-05-11 Thread Johannes Janson

Hi,

 I'm trying to get MySql type of a field (as string) into a php script.

sometime the answer is easier as you think:
mysql_field_type(link_identifier);

Johannes




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Odd - Even Results in a Table - Newbie question

2001-05-11 Thread Samuel Torton

sorry, i made a mistake.
correct with this :

--
$j = 0 ; $k = 0 ;
for ($i=0;$irows;$i++)
{
  $tmp = $i % 2 ;
  switch ($tmp)
  { case 0:
   even[$j++] = row[$i] ;
   break;
case 1:
   odd[$j++] = row[$i] ;
   break;
  }
}
--

redards,
samuel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] No MySQL-Link resource supplied

2001-05-11 Thread Steve Brett

the link will be the link you set up to connect to mysql, or the resource id
as php refers to it (i think)

you'll have something like $link=mysql_connect(...) as below

[example from manual]

?php

$link = mysql_connect (localhost, username, secret)
or die (Could not connect);
print (Connected successfully);
mysql_close ($link);

?

Steve

 -Original Message-
 From: Rankin, Randy [mailto:[EMAIL PROTECTED]]
 Sent: 10 May 2001 13:56
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] No MySQL-Link resource supplied 
 
 
 Is anyone familiar with this error and what causes it (or 
 better, how to fix
 it). 
   Warning: No MySQL-Link resource supplied in
 /usr/local/apache/htdocs/sales/login.php on line 46
 
 Line 46 =  mysql_close(); I cannot seem to find anything 
 regarding this
 message in the MySQL or PHP manuals. 
 
 Thanks in advance, 
 
 Randy Rankin
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Date formats from Postgres

2001-05-11 Thread Steve Brett

use $date=(d/m/Y,strtotime(value_from_db));

strtotime will convert a string value to a timestamp.

Steve

 -Original Message-
 From: Sean Weissensee [mailto:[EMAIL PROTECTED]]
 Sent: 10 May 2001 11:13
 To: PHPDB
 Subject: [PHP-DB] Date formats from Postgres
 
 
 
 I am reading a data datatype from a PostgreSQL database,
 
 the format sohwing  is 2001-01-05 for the 1st of May this year,
 
 I need this date in Australian format i.e. 01/05/2001,
 
 I tried using the string date (string format [, int timestamp])
 
 but with no success.I am not sure how to convert the database variable
 into
 a timestamp.
 
 any suggestions ?
 
 Sean Weissensee
 
 IT Manager
 Ion Solutions 
 
 www.ionsol.com.au
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Date formats from Postgres

2001-05-11 Thread Steve Brett

use $date=(d/m/Y,strtotime(value_from_db));

strtotime will convert a string value to a timestamp.

Steve

 -Original Message-
 From: Sean Weissensee [mailto:[EMAIL PROTECTED]]
 Sent: 10 May 2001 11:13
 To: PHPDB
 Subject: [PHP-DB] Date formats from Postgres
 
 
 
 I am reading a data datatype from a PostgreSQL database,
 
 the format sohwing  is 2001-01-05 for the 1st of May this year,
 
 I need this date in Australian format i.e. 01/05/2001,
 
 I tried using the string date (string format [, int timestamp])
 
 but with no success.I am not sure how to convert the database variable
 into
 a timestamp.
 
 any suggestions ?
 
 Sean Weissensee
 
 IT Manager
 Ion Solutions 
 
 www.ionsol.com.au
 


Steve Brett 
Internal Development
tel: 4251 
EMIS Ltd. 
Privileged and /or Confidential information may be contained in this
message. If you are not the original addressee indicated in this message (or
responsible for delivery of the message to such person), you may not copy or
deliver this message to anyone. In such case, please delete this message,
and notify us immediately. Opinions, conclusions and other information
expressed in this message are not given or endorsed by my firm or employer
unless otherwise indicated by an authorised representative independently of
this message.
Egton Medical Information Systems Limited. Registered in England. No
2117205. 
Registered Office: Park House Mews, 77 Back Lane, Off Broadway, Horsforth,
Leeds, LS18 4RF



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Autoincrement Question

2001-05-11 Thread Angie Tollerson

hmmm, that's interesting...I believe you are right about the version glitch.  I went 
to another database we have running on another server, it has 3.22.32 as you do.  When 
I delete the last record and then add one it DID NOT reuse the number, but 
incrememented! 
However, v.33 IS NOT reusing numbers that have been deleted anywhere up to the last 
record. So it is working partway at least. I suppose it could be a glitch that needs 
to be reported on .33 .  I will submit it to mysql.com. 
Thanks!
Angie


 Miles Thompson [EMAIL PROTECTED] 05/11/01 09:17AM 
Angie,
Is there a bug here? How do you re-add a fourth record? Is 3.22.33 a 
development or a stable version?
With MySQL 3.22.32, and table type of MyISAM I did not get re-use of the 
auto_increment keys , no matter where the records were deleted or inserted.
Miles

At 03:24 PM 5/10/01 -0500, Angie Tollerson wrote:
I am also doing it on 3.23.33 with MyISAM recover options off, is that 
what is happening? like I said...if I delete record one, and add a fourth 
record, It DOES NOT add it as 1.  But as 5.  however, if I delete 4, then 
add a fourth again, it sets it as 4.  I'm not sure if that has anything to 
do with my MyISAM settings or not..but there you go.

  CC Zona [EMAIL PROTECTED] 05/10/01 03:11PM 
[quotes restored to bottom-posting order, for clarity]

 If I have a database that has three records and I delete the entire
 third record, when another record is then added will the auto 
 increment
 number be 3 or 4? Thanks.

I will be 3 Jeff :)

   Only if the auto increment values started at zero.  Otherwise, the 
 number
   will be 4.

  That is true if you delete a row in between other records..if you delete 2
  the fourth record added would be 4, not 2.  BUT..in the default 
 installation
  of mysql, if you delete the last record the auto increment will fill it's
  place..trust me, I just tried it :)

What version of MySQL and table type are you getting that on?  I just tried
it with a MyISAM table in 3.23.33 (insert, immediate delete, immediate
insert), and the pk incremented as expected.  No re-use of values.

--
CC

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 
To contact the list administrators, e-mail: [EMAIL PROTECTED] 



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 
To contact the list administrators, e-mail: [EMAIL PROTECTED] 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 
To contact the list administrators, e-mail: [EMAIL PROTECTED] 



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Checking abuses

2001-05-11 Thread vipin chandran

Hi,
I am presently develepong a message board system. Can anyone tell me
how to prevent abuses in the messages posted in the message board,
from getting displayed?.
 
thanx,
vipin.

vipin chandran
[EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Checking abuses

2001-05-11 Thread Kelvin

Hi Vipin,

Don't want to explain to much , I have my code here ,  you can look at
it and put it into your coding.
P.S  don't worry, the code is working fine.


---
html
head
 titlePost Board/title
/head
body
div align=center
form action=filename.php method=POST
font face=Arial, Helvetica, sans-serif size=3 color=#ff6600
textarea name=comment cols=45 rows=9/textarea
/font
brbr
input type=submit value=Submit
/form
/div
/body
/html
--Save as
yourfilename.php---OK
And than,

?
include(newvetting.inc);
keywordMatch($comment,$keyword,yourfilename.php);

//  if everything is ok- put your script at below, otherwise it will
return back to yourfilename.php...
.
..
.
?
---Save as
filename.phpOK

?
$keyword=array(.com, put all the words
herewop,www.,xxx);

function keywordMatch($left, $keyword,$notpassurl)
{
$left=strtolower($left);
for($index1=0;$index1count($keyword);$index1++)
{
$strvalkeyword=strval($keyword[$index1]);
$strmatch=strstr($left, $strvalkeyword);
if ($strmatch!=)
{
Header(location:$notpassurl\n);
exit();
}/*end if*/
}/*end inner for*/
}/*end function*/
?
Save as
newvetting.incOK


vipin chandran [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,
 I am presently develepong a message board system. Can anyone tell me
 how to prevent abuses in the messages posted in the message board,
 from getting displayed?.

 thanx,
 vipin.

 vipin chandran
 [EMAIL PROTECTED]


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Backup Database

2001-05-11 Thread Jason Stechschulte

On Fri, May 11, 2001 at 10:02:41AM +0800, Jennifer Arcino Demeterio wrote:
 what will i do to have a realtime backup of my database?

It would help to know which database you are using.

-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
Your csh still thinks true is false.  Write to your vendor today and tell
them that next year Configure ought to rm /bin/csh unless they fix their
blasted shell. :-)   -- Larry Wall in Configure from the perl distribution

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] How do you make MySQL users so they can only view there database and not others while using php4

2001-05-11 Thread Dave Torres

I have some what of a security issue that I can't seem to solve.

I run php4 and MySQL on a FreeBSD server with Apache 1.3 as the webserver
and have users that I allow access to there personal database. (example:
user johndoe uses database johndoe).

I can configure johndoe so he can only have access to his database and
tables with in his database however they can still use MySQL functions like
mysql_list_db to see all databases. They can't alter or read them, but it
seem to me being able to display
all database names could cause a problem.

Has anyone had this same problem, and if so is there a way to stop any php
user with a mysql account to view all database?

Help Please, Thanks!
[EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] mssql connect problem from php4 on linux

2001-05-11 Thread Peter Wilson

Hi everyone

I am trying to set up php4, apache on linux redhat 7 to connect to Microsoft
SQL server version 7 or 2000.  I have downloaded the sybase open client
libraries and installed the common rpm and the openclient rpm.  When i try a
mssql_connect(...,user,pass);  I get:

Warning: Sybase: Unable to connect in ...[the file name]

If I then do a mssql_get_last_message(); I receive:

ct_connect(): network packet layer: internal net library error: Net-Library
operation terminated due to disconnect

Does anyone know what is going on and what I should do next to get this to
work?  Any help would be greatly appreciated.

Thanks in advance,
Pete



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Cookie effect

2001-05-11 Thread David Balatero

I have a login script that sets a cookie on your hard drive...the only
problem is, the cookie only comes into effect after I've clicked thru to
another page from login.php...any ideas on this? My (abridged) code is
currently:

?php
header(Set-Cookie: LoggedIn=1; path=/;);
header(Set-Cookie: GHSUserName=$username; path=/;);
header(Set-Cookie: GHSUserID=$user_id; path=/;);
?

If anyone could help me on this one, that would be great!

Thanks,
David Balatero
[EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Cookie effect

2001-05-11 Thread Ashley M. Kirchner

On Fri, 11 May 2001, David Balatero wrote:

 I have a login script that sets a cookie on your hard drive...the only
 problem is, the cookie only comes into effect after I've clicked thru to
 another page from login.php...any ideas on this? My (abridged) code is
 currently:

 ?php
 header(Set-Cookie: LoggedIn=1; path=/;);
 header(Set-Cookie: GHSUserName=$username; path=/;);
 header(Set-Cookie: GHSUserID=$user_id; path=/;);
 ?


Read:

http://www.php.net/manual/en/function.setcookie.php


Cheers.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Cookie effect

2001-05-11 Thread Jesse Scott

I believe that this is the default and only possible behavior.  The browser 
won't return the cookie value until another page is loaded.  But since you 
set the cookie on that page, you should still have access to the variables 
you used to set the cookie right?

 From the manual:

Cookies will not become visible until the next loading of a page that the 
cookie should be visible for.

-Jesse

At 04:56 PM 5/11/01 -0700, David Balatero wrote:
I have a login script that sets a cookie on your hard drive...the only
problem is, the cookie only comes into effect after I've clicked thru to
another page from login.php...any ideas on this? My (abridged) code is
currently:

?php
header(Set-Cookie: LoggedIn=1; path=/;);
header(Set-Cookie: GHSUserName=$username; path=/;);
header(Set-Cookie: GHSUserID=$user_id; path=/;);
?

If anyone could help me on this one, that would be great!

Thanks,
David Balatero
[EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]