Re: [PHP-DB] LIMIT problem MSSQL

2003-02-19 Thread Adam Voigt




Well if you do, (sort by id) this will work.



On Wed, 2003-02-19 at 11:14, Noam Giladi wrote:

i'm not using a fixed sort



tnx  noam

  Adam Voigt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]

  Assuming your sorting by id, just do: 



  SELECT TOP 50 * FROM TABLE WHERE id  $lastid 



  And just have lastid posting to the page every time 

  they hit next, and in lastid, put the last id of the results 

  on that page. 



  On Wed, 2003-02-19 at 09:59, Noam Giladi wrote: 

I'm trying to split results into different pages and number the pages 

accordingly. I've been able to build a fairly intelligent page numbering 

system which knows which rows it should pull (at least by numbering each row 

numerically) but I don't know how to construct a SQL query to pull 10 

results starting at a certain number. 



please did anyone wrote a proc that do it?. 









-- 

PHP Database Mailing List (http://www.php.net/) 

To unsubscribe, visit: http://www.php.net/unsub.php 



-- 

Adam Voigt ([EMAIL PROTECTED])

The Cryptocomm Group

My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc

   






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


[PHP-DB] Re: Recordsets and associative arrays

2003-02-17 Thread Adam Royle
Hi Don,

Use this process:

?php

 // create an empty array to fill with data
 $data = array();

$row = 0;
  while ($r = mysql_fetch_assoc($result)){
   foreach ($r as $key = $value){
$data[$row][$key] = $value;
   }
   $row++;
  }

?

The array structure would be something like this:

$data[0]['Name'] = 'Name 1';
$data[0]['Address'] = 'Address1';
$data[0]['City'] = 'City1';
$data[1]['Name'] = 'Name 2';
$data[1]['Address'] = 'Address2';
$data[1]['City'] = 'City2';
$data[2]['Name'] = 'Name 3';
$data[2]['Address'] = 'Address3';
$data[2]['City'] = 'City3';

etc etc

HTH Adam

- Original Message -
Message-ID: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
From: Don Briggs [EMAIL PROTECTED]
Date: Mon, 17 Feb 2003 16:42:51 -0600
Subject: Recordsets and associative arrays

Hello.

I am having a problem with syntax. Here is what I am doing. I have the
follwing table

|Name|Address  |City|
=
|Name 1 | Address1   | City1 |
|Name 2 | Address2   | City2 |
|Name 3 | Address3   | City3 |
|Name 4 | Address4   | City4 |
=

I can fetch a single record into an associative array. But I need to put
these records into an multi-dimentional associatave array. I have tried to
figure out what the syntax should be, but it has not worked. The only thing
is that the key names will be different from the field names, and we won't
be putting all of the record fields into the table. So we can't just make an
array of the associative arrays returned by mysql_fetcharray($result). Hope
you can help me out.

Don!


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




[PHP-DB] Re: Web Page Caching

2003-02-16 Thread Adam Royle
This may not be true in your case, but I remember another user on this list claiming a 
similar thing, and his problem was actually code-related. He had his db update code 
*AFTER* the results were displayed (ie. doing edit and save on same page).

Check your programming logic. Just a note to people out there who may not have much 
programming experience - try doing all of your server-side processing (or at least db 
and filesystem calls, etc) before you output any data, this way you can implement 
error checking etc and still use the header() function, etc. 

Adam


--- Original Message ---

Hello,

I don't know if this is the right list to send this question to.  It appears that the 
browser caches the result after a PHP page updates the database.  I have to manually 
reload it in order to see the updates.  Does anyone know how to overcome this?

Thanks,

Philip



Re: [PHP-DB]

2003-02-12 Thread Adam Voigt




Very first result on google:



http://www.oreillynet.com/cs/user/view/cs_msg/7231



Look at the first reply.

(Next time go to google first.)



On Wed, 2003-02-12 at 08:40, nikos wrote:

Hi List!



I'm trying to Drop a Table and aI get an error as follows:

Error on delete of './horceng/oikology.MYI' (Errcode: 13)



Does anybody know what is the error 13?

Thanks





Qbit

  - Gatsis Nikos

Web developer

tel.: 2108256721 - 2108256722

fax: 2108256712

email: [EMAIL PROTECTED]

http://www.qbit.gr 




-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


RE: [PHP-DB] collaborating on a document

2003-02-11 Thread Adam Voigt




Riiight, anyway, since Adobe Acrobat is the worst possible answer for

updating in real time (and completely wouldn't work), I would say, yes,

two frames should work, but you might even want a third (hidden) at the

bottom that never stops executing, just pulling entry's out when new ones

are added, and use _javascript_ to add them to the right frames with the ideas.



On Tue, 2003-02-11 at 10:16, Hutchins, Richard wrote:

1. This question has nothing to do with PHP or databases.

2. Adobe already thought of it: Adobe Acrobat 5.0.



 -Original Message-

 From: Baumgartner Jeffrey [mailto:[EMAIL PROTECTED]]

 Sent: Tuesday, February 11, 2003 10:13 AM

 To: [EMAIL PROTECTED]

 Subject: [PHP-DB] collaborating on a document

 

 

 I'm thinking about making a little tool where people can 

 contribute ideas in

 real time. Thus far, the best way I can see to do this is via 2 frames

 

 Frame 1: for entering data - which is inserted into a table. 

 

 Frame 2: would select from the table.  It would also refresh 

 frequently -

 say every 30 seconds.

 

 But perhaps you have a more elegant solution?

 

 Thanks,

 

 Jeffrey Baumgartner

 

 eBusiness Consultant - ITP Europe

 http://www.itp-europe.com

 [EMAIL PROTECTED]

 +32 2 721 51 00

 

 

 -- 

 PHP Database Mailing List (http://www.php.net/)

 To unsubscribe, visit: http://www.php.net/unsub.php

 



-- 

PHP Database Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


RE: [PHP-DB] collaborating on a document

2003-02-11 Thread Adam Voigt




Ofcourse then everyone has to have Adobe installed, which is probably less likely

then having _javascript_ enabled.



On Tue, 2003-02-11 at 10:39, Hutchins, Richard wrote:

Actually, Adobe 5.0 implemented on a server in Assembled or Integrated

(their words, not mine) configuration DOES allow for real-time document

collaboration. Whether this solution would actually solve the problem is

determined by the requirements of the collaboration environment.



If you're thinking Acrobat 4.0, you're absolutely right. Real-time

collaboration is, for all practical purposes, non-existent.



I'm not going to get into any further debate because it's off topic and all

of the information is available on Adobe.com, specifically in the following

links:

http://www.adobe.com/products/acrobat/pdfs/acr05_review_wp.pdf

and, more generally, http://www.adobe.com/acrofamily/collaboration.html.



In regards to actually implementing a solution using JS, yes can work, but

you're walking what can be a tight rope on client-side configuration. Some

of the standard issues are:

1. You have to make sure your users all have JS enabled or your app won't

work.

2. You'll have to write cross-browser compatible code back to v. 4.0

browsers as a standard.

3. Refreshing a screen every 30 seconds is going to really tick off users

that don't have DSL or better connections.



These issues are certainly not insurmountable. All of the above concerns can

be alleviated, if not eliminated, if you're going to implement on an

intranet where you have control over what clients are used. But in the WWW

arena, you just don't know what clients are going to be used.

-Original Message-

From: Adam Voigt [mailto:[EMAIL PROTECTED]]

Sent: Tuesday, February 11, 2003 10:25 AM

To: [EMAIL PROTECTED]

Cc: [EMAIL PROTECTED]

Subject: RE: [PHP-DB] collaborating on a document





Riiight, anyway, since Adobe Acrobat is the worst possible answer

for 

updating in real time (and completely wouldn't work), I would say, yes, 

two frames should work, but you might even want a third (hidden) at the 

bottom that never stops executing, just pulling entry's out when new ones 

are added, and use _javascript_ to add them to the right frames with the

ideas. 



On Tue, 2003-02-11 at 10:16, Hutchins, Richard wrote: 

1. This question has nothing to do with PHP or databases. 

2. Adobe already thought of it: Adobe Acrobat 5.0. 



 -Original Message- 

 From: Baumgartner Jeffrey [mailto:[EMAIL PROTECTED]] 

 Sent: Tuesday, February 11, 2003 10:13 AM 

 To: [EMAIL PROTECTED] 

 Subject: [PHP-DB] collaborating on a document 

 

 

 I'm thinking about making a little tool where people can 

 contribute ideas in 

 real time. Thus far, the best way I can see to do this is via 2 frames 

 

 Frame 1: for entering data - which is inserted into a table. 

 

 Frame 2: would select from the table. It would also refresh 

 frequently - 

 say every 30 seconds. 

 

 But perhaps you have a more elegant solution? 

 

 Thanks, 

 

 Jeffrey Baumgartner 

 

 eBusiness Consultant - ITP Europe 

 http://www.itp-europe.com 

 [EMAIL PROTECTED] 

 +32 2 721 51 00 

 

 

 -- 

 PHP Database Mailing List (http://www.php.net/) 

 To unsubscribe, visit: http://www.php.net/unsub.php 

 



-- 

PHP Database Mailing List (http://www.php.net/) 

To unsubscribe, visit: http://www.php.net/unsub.php 



-- 

Adam Voigt ([EMAIL PROTECTED])

The Cryptocomm Group

My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



-- 

PHP Database Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Storing iterated results into various variables

2003-02-04 Thread Adam Voigt




$counter = 1;

$query = mysql_query(SELECT image,caption FROM tablename ORDER BY id;);



while($row = mysql_fetch_array($query))

{



$imagevar = image . $counter;

$captionvar = caption . $counter;



$$imagevar = $row[image];

$$captionvar = $row[caption];



$counter++;



}



Change the query to match what you need, and that should work, if

your interested, check out the manual page on Variable Variables at: 



http://www.php.net/manual/en/language.variables.variable.php



Enjoy.



On Tue, 2003-02-04 at 07:02, Geckodeep wrote:

May be some one could help me here, I am trying to retrieve results from a

table that gives 9 rows, from each row I am trying to pull out two fields

and assign the two values of those column fields to a variable $image1 and

$caption1, and now I want to go to the next row and pick up the values of

the corresponding fields and store it in the next variable $image2 and

$caption2 and to continue until I reach 9 rows.



The reason for this technique is I am trying to inject the dynamic data

inside a page which is already formatted with HTMLs (kind of template) and

by means of Php tags I can echo these variables where needed.







Thanks for your time and help in advance I'd appreciate it.







GD







-- 

PHP Database Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


RE: [PHP-DB] A little JOIN help please...

2003-02-04 Thread Adam Royle
SELECT B.Title FROM phpCalendar_Details AS B, phpCalendar_Daily AS A
WHERE A.CalendarDetailsID = B.CalendarDetailsID AND CURDATE(  )  BETWEEN
A.StartDate AND A.StopDate





Also, you don't need to use the backticks around field names unless they contain 
spaces or other reserved words and characters.

Adam



Re: [PHP-DB] Date format in MySQL

2003-02-03 Thread Adam Voigt




$query = mysql_query(SELECT UNIX_TIMESTAMP(fieldname) AS date WHERE id = '1';);

$array = mysql_fetch_array($query);



$mydate = date(j F, Y,$array[date]);



Change fieldname and the where clause, and that should work.

If you want to further munipulate how it looks, just look at the

date manual page:



http://www.php.net/date



And change the first parameter to the date function.





On Mon, 2003-02-03 at 09:09, RUBANOWICZ Lisa wrote:

Hi All, I have a date format of -MM-DD in MySQL and am showing it on a PHP page.  However I want to show it as 

2 February, 2003

or 2 February

Can someone please help me.  The date will not necessarily be todays date (I looked at the datetime() function and the getdate() function but couldn't work it out for these)

Thanks for your support

All the best

Lisa



Lisa Rubanowicz

CNH Ireland

Tel: +353 46 77663

Email:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]



 








-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


[PHP-DB] Re: Images-weird!!

2003-02-02 Thread Adam Royle
Hi Mihai,

Didn't try your code, but noticed your comment on colours. RBG values go from 0 - 255, 
not 1 - 256, so this may be your problem.

Adam



[PHP-DB] Re: Using strlen and substr to Shorten DB Results

2003-01-26 Thread Adam Royle
Try this. PHP arrays are cool! Of course there are tidier ways to  
implement this, but this is just an example.

Adam

-- Code --

$getscname = mysql_query(SELECT * FROM subcat WHERE subcatid =  
'$subcatid') or die (Couldn't get the info.br.mysql_error());

while($sub_cat = mysql_fetch_array($getscname)){
	$subcat_id = $sub_cat['subcatid'];
	$subcat_name = $sub_cat['subcatname'];

	$arrCats[] = 'a  
href=subcat.php?catid='.$catid.'sc='.$subcat_id.''.$subcat_name.'/ 
a';
}
	
echo  
implode('nbsp;nbsp;nbsp;nbsp;|nbsp;nbsp;nbsp;nbsp;',$arrCats);

-- Code --


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



[PHP-DB] Re: Email to a list of address in your database.

2003-01-19 Thread Adam Royle
This should work. You were on the right track, although you might want to
use better var names so you don't get confused. You can see I have changed
them to what I would normally use.

Adam

?php
$sql = select * from users;
$result = mysql_query($sql, $connection) or die(Couldn't execute
query.);

while($row = mysql_fetch_array($result)) {
 $to[] = $row['emailAddress'];
}

$mailTo = implode(;,$to);
?
pa href=mailto:?= $mailTo ?mail To all my list/a/p


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




RE: [PHP-DB] Send mail with a file

2003-01-16 Thread Adam Voigt




Unix has nothing to do with it, the mail command in PHP on unix is the same mail command

in PHP on windows. If you want to use attachments you need to use a class like phpMimeEmail

or whatever it's called go to phpclasses.org, it's on there somewhere.



On Thu, 2003-01-16 at 09:33, NIPP, SCOTT V (SBCSI) wrote:

	Under Unix I don't know that this is possible, but hopefully someone

else will know of a way.  I would love to be able to e-mail some Excel files

that I generate with a Perl cron job, but there does not appear to be any

practical way to do this in Unix.



-Original Message-

From: Bruno Pereira [mailto:[EMAIL PROTECTED]]

Sent: Thursday, January 16, 2003 3:47 AM

To: [EMAIL PROTECTED]; [EMAIL PROTECTED]

Subject: [PHP-DB] Send mail with a file





How can i insert a file on a mail, with the command mail()? It is

possible?



Cumprimentos



Bruno Pereira

[EMAIL PROTECTED]



-Original Message-

From: Bruno Pereira [mailto:[EMAIL PROTECTED]]

Sent: quarta-feira, 15 de Janeiro de 2003 14:48

Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]

Subject: Concatenate two strings





How can i join two strings.

My code is something like:

$valor1=bruno;

$valor2=Pereira;

$valor=$valor1 +   + $valor2



Can someone help me. Thanks.



Cumprimentos



Bruno Pereira

[EMAIL PROTECTED]





-- 

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






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] javascript and submitting forms

2003-01-14 Thread Adam Royle
Hi Mignon,

This should work, never closing the window without submitting  
(foolproof). Just add some error checking, and you'll be sweet as a  
nut! All I did was add the echo statement underneath the data insert.

Adam


?
include ('dbconn.php');
if(isset($submit))
	 {
	$query = INSERT INTO `comments` (  `track_id`, `cat_comments` )  
VALUES ( '0', '$comm' );;
	mysql_query ($query, $link );
	
	echo 'htmlheadscript  
language=JavaScriptwindow.close();/script/headbody/body/ 
html';
		
	}
?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
html
head
title/title
/head
body
form action=comp_page3.php method=POST
Enter your details here:br
textarea name=comm rows=15 cols=30/textareabr

input type=submit name=submit value=Close and Save

/form
/body
/html


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



Re: [PHP-DB] data move

2003-01-13 Thread Adam Voigt




Umm, if it's a one time deal, why not just have access output a CSV (comma seperated version, or something like that)

and use PHP or phpMyAdmin if it will do it, to do your insert's? That way you don't have to have PHP interface with

Access, just the MySQL part which is real easy.



On Mon, 2003-01-13 at 09:12, Edward Peloke wrote:

Ok, I know I have asked this question several times but it is time for me to

start coding so I am looking for some goog tutorials somewhere.  I need to

use php to transfer data from an access file to mysql db.  I assume I will

just use an odbc connection but I am unsure as to where to start.  If anyone

knows of any good tutorials or samples, please point me in the right

direction.



Thanks,

Eddie





-- 

PHP Database Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


[PHP-DB] Re: mysql_errno() list?

2003-01-10 Thread Adam Royle
Just use a combination of mysql_errno() and mysql_error():

 echo mysql_errno() . :  . mysql_error(). \n;

Adam

PS. Documentation always rocks!


Hi guys,
I've been playing with PHP for a while now, and love the mysql 
functions,
but there's one thing I'd like to know...

I want to check if a mysql error is a certain number, and thats all 
fair
enough because every time i encounter an error I can write down what 
that
error was. However, it would be handy if I could have my own define 
file
with all the errors in. Can I ask if anyone has a list of errors and 
their
numbers for mysql_errno? I've looked on the web and found a load of 
errors
for the mysql daemon (the page told me to look in
/usr/share/mysql/mysql_errors.txt) but this isnt the file I want as the
errors there relate to the server and not errors with a query I'm 
running

Thanks in advance for any help

James Booker
EMPICS Sports Photo Agency
http://www.empics.com


[PHP-DB] Re: File Upload ---Thanks!

2003-01-07 Thread Adam Royle
Yep. Been using Mac OS X (10.1 - 10.2.3) with mySQL no problems. I 
built it from source first time, but now I just use Mac OS X packages 
from Mark Liyanage. You can find them here. Also he has a good 
pre-compiled PHP4 you can download and use.

http://www.entropy.ch/software/MacOSx/mysql/

Adam


Thanks folks - persistence pays off and so does group discussions . I 
had chmodded the uploads directory to 777 but it was within the 
public_html directory with different file permissions so I guess 
public_html permissions were taking presidence. After reading all of 
your suggestions... a little light turned on and I moved the uploads 
directory outside of the public-html directory and Volia!

Uploading file...
File uploaded successfully

Preview of uploaded file contents:
THIS IS A TEST.


Thanks Again.
Anyone using a Macintosh with MySql? That is my next goal.


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




Re: [PHP-DB] Help with FTP

2002-12-27 Thread Adam Williams
use system() to run /bin/df

depending on the OS you might need to add a flag to it like -h (linux) or
-k (solaris).

www.php.net/system

Adam

On Fri, 27 Dec 2002, Dankshit wrote:

 Is there a way to see how much space is left in a ftp server?

 thanks in advance!



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




[PHP-DB] Re: Finding zipcode within radius of another zipcode.

2002-12-25 Thread Adam Royle
There are databases / packages you can buy which already have this 
information in them. A simple search for 'purchase postcode database' 
on Google gave me a few leads.

Adam

Hi folks,

I'm building a PHP/MySQL database for a customer. It's an advanced 
mailing
list for a band. They want to be able to send e-mails targetted to 
people
around where a gig takes place. For instance, if a concert is taking 
place
somewhere in the 42071 zipcode, they want to e-mail everyone within 500
miles of 42071. The database will have around 10,000 members, with 
e-mail
and mailing addresses.

Does anyone have a good idea for this?

Thanks a ton,

John Thile (gilrain)
http://lunarpolicy.net


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




Re: [PHP-DB] keyword search a mysql database.

2002-12-18 Thread Adam Voigt




$searchstring = $_POST[searchfor];

$searchstring = str_replace( ,%,$searchstring);



mssql_query(SELECT id FROM table WHERE field LIKE '$searchstring';);



This will give you a looser search where all search terms have

to be there, but not necessarily next to each other, if you want a phrase search

so they have to follow each other:



$searchstring = % . $_POST[searchfor] . %;



mssql_query(SELECT id FROM table WHERE field LIKE '$searchstring';);



Make sense?



On Wed, 2002-12-18 at 12:44, mike karthauser wrote:

I'm looking for tips and tricks in how to approach building a keyword search

over an number of fields in a courses database.



I know how i can search for one word at a time, but i am not sure on how i

would approach searching via a defined string.



Anyone got any good pointers for doing this/ or some tutorial that i can

read though?



Thanks..



BTW kettles on if anyone wants a brew..

-- 

Mike Karthauser 

Managing Director - Brightstorm Ltd



Email[EMAIL PROTECTED]

Web  http://www.brightstorm.co.uk

Tel  0117 9426653 (office)

   07939 252144 (mobile)



SnailmailUnit 8, 14 King Square,

   Bristol BS2 8JJ





-- 

PHP Database Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Get error message, need help

2002-12-16 Thread Adam Voigt




Your missing a semicolon (;) after your first $myquery = line.



- Original Message -

From: David [EMAIL PROTECTED]

To: [EMAIL PROTECTED]

Sent: Monday, December 16, 2002 2:16 AM

Subject: [PHP-DB] Get error message, need help





 Hello all,



 I am new to PHP so I am going to need some help.



 I am trying to create a admin login page. But I am getting this error

 message:



 Parse error: parse error, unexpected T_VARIABLE in c:\program files\apache

 group\apache\htdocs\sunwestsilver\admin\tmpi5pcf76sy9.php on line 43



 tmpi5pcf76sy9.php is generated by Dreamweaver MX as a temp file from

 admin.php



 It is coming  from this line:



 this is line 43 code



 # $myquery = .' AND password = ' . crypt($password, xpz8ty) . ';



 The complete code is:



 // Query Database with username and encrypted password

   #$myquery = SELECT * FROM user WHERE username = ' . $user

   #$myquery = .' AND password = ' . crypt($password, xpz8ty) . ';

   #$result = mysql_query($myquery);

   #if (!$result)

   #{

   #  $error = Cannot run Query;

  #return($error);

   #}



 Any help will be nice.



 I got this code from Dreamweaver MX: PHP Web Development pg. 257



 Thanks



 David







 --

 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






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] bulk miorting rows into mysql db

2002-12-13 Thread Adam Williams
use mysqlimport, its a program that comes with MySQL.  go to www.mysql.com
and click on documentation to learn more about it.

Adam

On Fri, 13 Dec 2002, mikek wrote:

 I have a few hundred rows of data to import into a mysql db. Its currently
 tab separated.

 What's the most straight forward way (ie i dont want to enter it line by
 line) of doing a bulk import?

 I have full admin rights to my dev server. Is there a method or software app
 that people can recommend to me.

 Much appreciated.

 ---
 Mike Karthauser - email:[EMAIL PROTECTED] - phone:0117 9426653
 brightstorm - curiously online - http://www.brightstorm.co.uk





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




[PHP-DB] MSSQL Text Length Restriction

2002-12-10 Thread Adam Voigt




I can't seem to get more then 255 characters to be sent back from a field

in our MSSQL database, unless the fields is a TEXT type, which is very

inefficient. Anyone know a fix? (I've already tried modifying the max size

variables in the php.ini under the MSSQL section.)





-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


RE: [PHP-DB] MSSQL Text Length Restriction

2002-12-10 Thread Adam Voigt




Didn't work, thanks anyway.



On Tue, 2002-12-10 at 10:43, [EMAIL PROTECTED] wrote:

 this little snippet works for me.



mssql_query(set textsize 65536);



HTH

Jeff







Adam Voigt  

adam@cryptoco   To: Hutchins, Richard [EMAIL PROTECTED]   

mm.com  cc: [EMAIL PROTECTED]   

 Subject: RE: [PHP-DB] MSSQL Text Length Restriction

12/10/2002  

10:35 AM













Ok, my question was in reguards to Microsoft SQL (MSSQL), you are

referering to MySQL.





On Tue, 2002-12-10 at 10:21, Hutchins, Richard wrote: Look at the tinyblob

(tinytext), mediumblob (mediumtext), blob (text), longblob

(longtext)column types in the MySQL manual. Storage-wise they don't look

too terribly inefficient. -Original Message-

From: Adam Voigt [mailto:[EMAIL PROTECTED]]

Sent: Tuesday, December 10, 2002 10:18 AM

To: [EMAIL PROTECTED]

Subject: [PHP-DB] MSSQL Text Length Restriction





I can't seem to get more then 255 characters to be sent back from a field

in our MSSQL database, unless the fields is a TEXT type, which is very

inefficient. Anyone know a fix? (I've already tried modifying the max size

variables in the php.ini under the MSSQL section.)













   --   

   Adam Voigt ([EMAIL PROTECTED]) 

   The Cryptocomm Group 

   My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc 









   --   

   Adam Voigt ([EMAIL PROTECTED]) 

   The Cryptocomm Group 

   My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc 


















-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


RE: [PHP-DB] MSSQL Text Length Restriction

2002-12-10 Thread Adam Voigt




Uncommented, and set to the max value (2147483647). No effect.



On Tue, 2002-12-10 at 10:57, [EMAIL PROTECTED] wrote:

Adam.

 are these lines uncommented in your php.ini?  They are under [MSSQL]



; Valid range 0 - 2147483647.  Default = 4096.

;mssql.textlimit = 4096



; Valid range 0 - 2147483647.  Default = 4096.

;mssql.textsize = 4096



sorry, i'm not replying to the other email.  i deleted it accidentally











Jeffrey N Dyke  

 To: Adam Voigt [EMAIL PROTECTED]   

12/10/2002   cc: [EMAIL PROTECTED], Hutchins, Richard  

10:43 AM [EMAIL PROTECTED]   

 Subject: RE: [PHP-DB] MSSQL Text Length Restriction(Document link: 

 Jeff Dyke) 









 this little snippet works for me.



mssql_query(set textsize 65536);



HTH

Jeff







Adam Voigt  

adam@cryptoco   To: Hutchins, Richard [EMAIL PROTECTED]   

mm.com  cc: [EMAIL PROTECTED]   

 Subject: RE: [PHP-DB] MSSQL Text Length Restriction

12/10/2002  

10:35 AM













Ok, my question was in reguards to Microsoft SQL (MSSQL), you are

referering to MySQL.





On Tue, 2002-12-10 at 10:21, Hutchins, Richard wrote: Look at the tinyblob

(tinytext), mediumblob (mediumtext), blob (text), longblob

(longtext)column types in the MySQL manual. Storage-wise they don't look

too terribly inefficient. -Original Message-

From: Adam Voigt [mailto:[EMAIL PROTECTED]]

Sent: Tuesday, December 10, 2002 10:18 AM

To: [EMAIL PROTECTED]

Subject: [PHP-DB] MSSQL Text Length Restriction





I can't seem to get more then 255 characters to be sent back from a field

in our MSSQL database, unless the fields is a TEXT type, which is very

inefficient. Anyone know a fix? (I've already tried modifying the max size

variables in the php.ini under the MSSQL section.)













   --   

   Adam Voigt ([EMAIL PROTECTED]) 

   The Cryptocomm Group 

   My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc 









   --   

   Adam Voigt ([EMAIL PROTECTED

Re: [PHP-DB] passing variables

2002-12-09 Thread Adam Williams
www.php.net/isset

if !isset($var)
{
echo var is not set to anything;
}
else
{
echo var is set to $var;
}


On Mon, 9 Dec 2002, Edward Peloke wrote:

 Hello all,

 I have a login/register screen for my php/mysql db.  When the page opens,
 the user sees the log in screen but I have a button and reloads the same
 page, hopefully with the register screen.  I know I can simply check to see
 if a variable is set with

 if ($variable){} .  This does not seem to work when I give an image a name
 and link it to the same page.  The image is named register and it links back
 to the same page, so the page loads, I click on the register image , the
 page reloads but the variable is not set.


 Any ideas?

 Thanks,
 Eddie





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




Re: [PHP-DB] More Apache Installation problems

2002-12-09 Thread Adam Williams
can your main workstation ping 192.168.1.1

On Mon, 9 Dec 2002, Alex Francis wrote:

 At last I have Apache and PHP running on my server.
 My server IP is 192.168.1.1 and I have set ServerName 192.168.1.1 in my
 httpd.conf file.

 I can access my test files from the server using either http://localhost or
 http://192.168.1.1, however if I try the same on my main workstation I can't
 find the server. Is there something else I need to do.






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




Re: [PHP-DB] More Apache Installation problems

2002-12-09 Thread Adam Williams
can you ping your router?  is it filtering ICMP?  can you ping anything?
is your cat 5 cable crimped properly and you have link lights on your
switch/hub/router and network card?

Adam

On Mon, 9 Dec 2002, Alex Francis wrote:

 It seems like a network problem. I can access the network through windows
 network neighborhood but can't ping it, any suggestions?

 Gene Dymarskiy [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 make sure both your server and workstation  can see each other.

 try  pinging the server:

 ping 192.168.1.1



 -Original Message-
 From: Alex Francis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 09, 2002 1:39 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] More Apache Installation problems


 At last I have Apache and PHP running on my server.
 My server IP is 192.168.1.1 and I have set ServerName 192.168.1.1 in my
 httpd.conf file.

 I can access my test files from the server using either http://localhost or
 http://192.168.1.1, however if I try the same on my main workstation I can't
 find the server. Is there something else I need to do.



 --
 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] More Apache Installation problems

2002-12-09 Thread Adam Williams
No I think he has his WS with a real IP from his ISP and then his web
server plugged into the same hub as his WS but with 192.168.1.1.  He'll
either need to get a 2nd NIC and give it an ip like 192.168.1.2 or get a
cable modem router.  Or change his WS to linux and add eth0:0 with
192.168.1.2 :)

Adam

On Mon, 9 Dec 2002, Gene Dymarskiy wrote:





 I am a bit confused.

 Your WS is connected to cable modem and gets public IP assigned by your ISP. Your WS 
is also connected to a hub shared with your web server.

 does it mean you have two network cards, one connected to cable modem, and the other 
to the hub?





 -Original Message-
 From: Alex Francis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 09, 2002 2:20 PM
 To: Gene Dymarskiy
 Subject: RE: [PHP-DB] More Apache Installation problems


 I need to have a server assigned IP address on my workstation for my cable
 modem.

 -Original Message-
 From: Gene Dymarskiy [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 09, 2002 8:06 PM
 To: Alex Francis; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] More Apache Installation problems


 I'd check IP address of your workstation. make sure both the WS and the
 server are on the same subnet. Your WS should have 192.168 address, too.

 good luck

 -Original Message-
 From: Alex Francis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 09, 2002 2:00 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] More Apache Installation problems


 It seems like a network problem. I can access the network through windows
 network neighborhood but can't ping it, any suggestions?

 Gene Dymarskiy [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 make sure both your server and workstation  can see each other.

 try  pinging the server:

 ping 192.168.1.1



 -Original Message-
 From: Alex Francis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 09, 2002 1:39 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] More Apache Installation problems


 At last I have Apache and PHP running on my server.
 My server IP is 192.168.1.1 and I have set ServerName 192.168.1.1 in my
 httpd.conf file.

 I can access my test files from the server using either http://localhost or
 http://192.168.1.1, however if I try the same on my main workstation I can't
 find the server. Is there something else I need to do.



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




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





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



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




Re: [PHP-DB] More Apache Installation problems

2002-12-09 Thread Adam Williams
what you need to do is have 1 nic going directly to your cable modem using
a cross over cable, and then with the 2nd NIC in your WS plug it into the
hub along with the web server box, or ditch the hub and connect the WS to
the web server with a cross over cable.

Adam

On Mon, 9 Dec 2002, Alex Francis wrote:

 Adam, You are correct.

 I had two NICs, set up exactly as you describe, but kept getting problems (I
 would lose my internet connection and have to reboot to get it back. I think
 I will try againand if that fails, buy a cable modem router.

 Adam Williams [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  No I think he has his WS with a real IP from his ISP and then his web
  server plugged into the same hub as his WS but with 192.168.1.1.  He'll
  either need to get a 2nd NIC and give it an ip like 192.168.1.2 or get a
  cable modem router.  Or change his WS to linux and add eth0:0 with
  192.168.1.2 :)
 
  Adam
 
  On Mon, 9 Dec 2002, Gene Dymarskiy wrote:
 
  
  
  
  
   I am a bit confused.
  
   Your WS is connected to cable modem and gets public IP assigned by your
 ISP. Your WS is also connected to a hub shared with your web server.
  
   does it mean you have two network cards, one connected to cable modem,
 and the other to the hub?
  
  
  
  
  
   -Original Message-
   From: Alex Francis [mailto:[EMAIL PROTECTED]]
   Sent: Monday, December 09, 2002 2:20 PM
   To: Gene Dymarskiy
   Subject: RE: [PHP-DB] More Apache Installation problems
  
  
   I need to have a server assigned IP address on my workstation for my
 cable
   modem.
  
   -Original Message-
   From: Gene Dymarskiy [mailto:[EMAIL PROTECTED]]
   Sent: Monday, December 09, 2002 8:06 PM
   To: Alex Francis; [EMAIL PROTECTED]
   Subject: RE: [PHP-DB] More Apache Installation problems
  
  
   I'd check IP address of your workstation. make sure both the WS and the
   server are on the same subnet. Your WS should have 192.168 address,
 too.
  
   good luck
  
   -Original Message-
   From: Alex Francis [mailto:[EMAIL PROTECTED]]
   Sent: Monday, December 09, 2002 2:00 PM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP-DB] More Apache Installation problems
  
  
   It seems like a network problem. I can access the network through
 windows
   network neighborhood but can't ping it, any suggestions?
  
   Gene Dymarskiy [EMAIL PROTECTED] wrote in message
   [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   make sure both your server and workstation  can see each other.
  
   try  pinging the server:
  
   ping 192.168.1.1
  
  
  
   -Original Message-
   From: Alex Francis [mailto:[EMAIL PROTECTED]]
   Sent: Monday, December 09, 2002 1:39 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP-DB] More Apache Installation problems
  
  
   At last I have Apache and PHP running on my server.
   My server IP is 192.168.1.1 and I have set ServerName 192.168.1.1 in my
   httpd.conf file.
  
   I can access my test files from the server using either http://localhost
 or
   http://192.168.1.1, however if I try the same on my main workstation I
 can't
   find the server. Is there something else I need to do.
  
  
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
  
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 






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




[PHP-DB] Re: Delay Confirmation....

2002-12-09 Thread Adam Royle
Use:

set_time_limit(0); // let script run forever

Have a look at output control functions, particularly:

ob_start();
ob_flush();

They might help you

Adam

--- Original Message ---

Hi, I'm still new in PHP...,

I have some problem in using sleep() function.

Actually, I want to make a script that confirm the user to wait for 10
seconds before proceed to the next step. First the message Please wait
for 10 seconds while we're processing your request... will be shown to
user, then at the same time I want to delay the processing for 10
seconds with sleep() function.

This is my script :

?php
$i=0;
set_time_limit(10);
print(Please wait for 10 seconds while we're processing your
request...); sleep(10);
$query=insert into..; 
etc.
?

But the result juz not like I wanted. The sleep runs before the message
shown up..., not before the query...  I think, sleep() is delayed a
whole scriptboth, the message and the query result are printed out
after 10 seconds... It makes me so confused

How could I fix it ??? Please help me...


--www.kapsul.org--
  DuFronte




[PHP-DB] Re: Check Automaticaly

2002-12-08 Thread Adam Royle
I would imagine your game would have two frames (one hidden frame), and the hidden 
frame would contain scripts to check and update page.

In the bottom frame i see you might have two choices:

1. have a meta refresh which checks every 5 (or so) secs if a move has been made, and 
if detects a move, sends a refresh command to the top frame

2. have a php script which continually checks if a move has been made ( using sleep() 
function and set_time_limit() ), and if detects a move, sends a javascript command to 
browser, then continue detecting if changes have been made..

the implications of #2 (i would image), is the explorer icon will be constantly 
loading a page, so if you click stop, the game will cease

hope that helps
adam



Re: [PHP-DB] Return 1 instance of each unique record?

2002-12-06 Thread Adam Williams
use GROUP BY field

Adam

On Fri, 6 Dec 2002, Doug Coning wrote:

 Hi everyone:

 How do I get MySQL to summarize a query so that I receive only 1 instance
 per similar record.  I.E. if you have 10 records with name Smith and 5
 records with Barney, etc, that it would return 2 records instead of 15.

 Thanks!

 Doug Coning







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




Re: [PHP-DB] Refining my search app..

2002-12-02 Thread Adam Voigt




A little cleaner:



switch($_POST[column])

{

case(foo):$query = mysql_query(WHATVER);break;

case(too):$query = mysql_query(BLAH);break;

default:$query = mysql_query(DOH);break;

}



while($row = mysql_fetch_array($query))

{

// DO SOMETHING

}





-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Connecting to MS SQL 7

2002-11-27 Thread Adam Voigt
A. I think the php3_ isn't a good sign. 
B. You should remove whatever you found on the web and downloaded.
C. Copy all the DLL's in the dll folder (under your PHP folder) to
C:\WINNT\SYSTEM32
D. Re-copy the php.ini-recommended from your PHP folder to
C:\WINNT\php.ini and see if it stops looking for php3.

On Tue, 2002-11-26 at 18:36, Mark Farmer wrote:
 I have successfully installed PHP 4.2.3 on a Win NT 4 server, running IIS 4, 
 and can execute PHP functions now.
 
 However, when I try to connect to an MS SQL 7 database on the same box, I 
 receive this error: PHP Warning: Unable to load dynamic library 
 './php3_mssql70.dll' - %1 is not a valid Windows NT application, and my 
 mssql_connect statment fails.
 
 What I had done was to find a copy of php3_mssql70.dll on the web and copy 
 it onto the server -- various faqs told me this needed to happen in order 
 for database calls to work.
 
 Why isn't this dll being recognized as a valid Windows NT application, then?
 
 Thank you.
 
 _
 STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
 http://join.msn.com/?page=features/junkmail
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Resource id #2

2002-11-27 Thread Adam Voigt
Umm, he is putting them into an array, I quote:

while ($row = mysql_fetch_array($result)) {
  $row['Books.Title'];
  $row['Books.Author'];
  $row['Books.ISBN'];
  $row['BookList.dbase'];
  $row['BookList.dbase_user'];
  $row['BoxSet.BoxSet'];
  $row['Category.Category'];
  $row['Category.Sub_category'];
  $row['Publisher.Publisher'];
  $row['AuthUsers.email'];
  
  }

See the while condition?

On Wed, 2002-11-27 at 06:03, Chris Barnes wrote:
 You need to put your $result into an array. you can use:
 
 $result_array = mysql_fetch_array($result);
 
 then, if you know the field names in the array, print them like so:
 
 echo $result_array[field1];
 echo $result_array[field2];
 
 or if you dont know their names you can refer to their position numbers
 starting from 0 e.g.
 
 echo $result_array[0];
 echo $result_array[1];
 
 using the position numbers you could put together a quick script to
 crawl through the array and print all the fields with a few lines of
 code.
 
 On Wed, 2002-11-27 at 05:09, The Cossins Fam wrote:
  Hello.
  
  I am using MySQL as a database for a departmental library.  I have written
  a quick search script, but keep getting resource id #2 as a result to my
  search.  I have read the online documentation for the
  mysql_fetch_array() function and must say, I don't see that I'm missing
  anything.  However, I've only started programming, much less working with
  PHP, so perhaps someone can help me out.  Here's my code:
  
  ?
  
  $quickSearch = mcse;
  
  $table1 = Books;
  $table2 = BookList;
  $table3 = BoxSet;
  $table4 = Category;
  $table5 = Publisher;
  $table6 = AuthUsers;
  $table7 = CD;
  
  $connection = mysql_connect(localhost, root) or die(Couldn't connect
  to the library database.);
  
  $db_select = mysql_select_db(library, $connection) or die(Couldn't
  select the library database.);
  
  $search = SELECT * FROM $table1 LEFT JOIN $table2 ON Books.BookListID =
  BookList.BookListID
  LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
  LEFT JOIN $table4 ON Books.CategoryID = Category.CategoryID
  LEFT JOIN $table5 ON Books.PublisherID = Publisher.PublisherID
  LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
  LEFT JOIN $table7 ON Books.CD = CD.CD_ID
  WHERE Books.Title LIKE \%'$quickSearch'%\
  OR Books.Author LIKE \%'$quickSearch'%\
  OR Books.ISBN LIKE \%'$quickSearch'%\
  OR BookList.dbase LIKE \%'$quickSearch'%\
  OR BookList.dbase_user LIKE \%'$quickSearch'%\
  OR BoxSet.BoxSet LIKE \%'$quickSearch'%\
  OR Category.Category LIKE \%'$quickSearch'%\
  OR Category.Sub_category LIKE \%'$quickSearch'%\
  OR Publisher.Publisher LIKE \%'$quickSearch'%\;
  
  $result = mysql_query($search, $connection) or die(Couldn't search the
  library.);
  
  while ($row = mysql_fetch_array($result)) {
  $row['Books.Title'];
  $row['Books.Author'];
  $row['Books.ISBN'];
  $row['BookList.dbase'];
  $row['BookList.dbase_user'];
  $row['BoxSet.BoxSet'];
  $row['Category.Category'];
  $row['Category.Sub_category'];
  $row['Publisher.Publisher'];
  $row['AuthUsers.email'];
  
  }
  
  
  ?
  
  I then have some HTML to display the result of the search.  I don't
  receive any error messages - I just see an empty table from the HTML
  code I wrote.  I added an echo of the $result to find the resouce id
  #2.
  
  Thanks for any help you can provide.
  
  --joel
  
  
  
  
  
  
  
  _
  The new MSN 8: advanced junk mail protection and 2 months FREE* 
  http://join.msn.com/?page=features/junkmail
  
  
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] PHP4, Apache 1.3.x, and mod ssl install document?

2002-11-27 Thread Adam Voigt
Off the top of my head (general guidelines, don't use word for word):

mkdir /usr/local/apache
cd /usr/local/apache
wget http://www.apache.org/dist/httpd/apache_1.3.27.tar.gz
tar -zxf *
cd apache_1.3.27
./configure --prefix=/usr/local/apache_1.3.27
mkdir /usr/local/modssl
cd /usr/local/modssl
wget http://www.modssl.org/source/mod_ssl-2.8.12-1.3.27.tar.gz
tar -zxf *
cd mod_ssl-2.8.12-1.3.27
./configure --with-apache=/usr/local/apache/apache_1.3.27
cd /usr/local/apache/apache_1.3.27

./configure --prefix=/usr/local/apache_1.3.27 --enable-module=ssl
--enable-module=so

make
make certificate type=test (OPTIONAL)
make install
mkdir /usr/local/php
cd /usr/local/php

lynx
http://www.php.net/do_download.php?mr=http%3A%2F%2Fwww.php.net%2Fdf=php-4.2.3.tar.gz
(Save the file with lynx)

tar -zxf *
cd php_4.2.3

./configure --with-apxs=/usr/local/apache_1.3.27/bin/apxs
--with-mysql=/usr

make
make install

Add the line:

application/x-httpd-php .php

To somewhere near the bottom of your httpd.conf
and while your in httpd.conf configure the values you like.

On Wed, 2002-11-27 at 10:38, RClark wrote:
 Hello all,
 
 I have a FreeBSD server which has been updated to 4.7 STABLE. I have updated
 my ports collection and installed mysql server. Does anyone have an updated
 doc on how to install apache with PHP4 and modssl support either from ports
 collection or from source. I would greatly appreciate it.
 
 Thanks
 Ron
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Resource id #2

2002-11-27 Thread Adam Voigt
They don't do anything, but my point was, he said that what he pulled
from the DB needed to be put into an array, and I was pointing out, it
already was.

On Wed, 2002-11-27 at 12:23, Mark wrote:
 But what do all those $row['fieldname'} rows do? Call me ignorant
 (you wouldn't be the first), but a statement that simply has a
 variable name doesn't DO anything. Should these have echos in front
 of them?
 
 --- Adam Voigt [EMAIL PROTECTED] wrote:
  Umm, he is putting them into an array, I quote:
  
  while ($row = mysql_fetch_array($result)) {
$row['Books.Title'];
$row['Books.Author'];
$row['Books.ISBN'];
$row['BookList.dbase'];
$row['BookList.dbase_user'];
$row['BoxSet.BoxSet'];
$row['Category.Category'];
$row['Category.Sub_category'];
$row['Publisher.Publisher'];
$row['AuthUsers.email'];

}
  
  See the while condition?
  
  On Wed, 2002-11-27 at 06:03, Chris Barnes wrote:
   You need to put your $result into an array. you can use:
   
   $result_array = mysql_fetch_array($result);
   
   then, if you know the field names in the array, print them like
  so:
   
   echo $result_array[field1];
   echo $result_array[field2];
   
   or if you dont know their names you can refer to their position
  numbers
   starting from 0 e.g.
   
   echo $result_array[0];
   echo $result_array[1];
   
   using the position numbers you could put together a quick script
  to
   crawl through the array and print all the fields with a few lines
  of
   code.
   
   On Wed, 2002-11-27 at 05:09, The Cossins Fam wrote:
Hello.

I am using MySQL as a database for a departmental library.  I
  have written
a quick search script, but keep getting resource id #2 as a
  result to my
search.  I have read the online documentation for the
mysql_fetch_array() function and must say, I don't see that I'm
  missing
anything.  However, I've only started programming, much less
  working with
PHP, so perhaps someone can help me out.  Here's my code:

?

$quickSearch = mcse;

$table1 = Books;
$table2 = BookList;
$table3 = BoxSet;
$table4 = Category;
$table5 = Publisher;
$table6 = AuthUsers;
$table7 = CD;

$connection = mysql_connect(localhost, root) or
  die(Couldn't connect
to the library database.);

$db_select = mysql_select_db(library, $connection) or
  die(Couldn't
select the library database.);

$search = SELECT * FROM $table1 LEFT JOIN $table2 ON
  Books.BookListID =
BookList.BookListID
LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
LEFT JOIN $table4 ON Books.CategoryID =
  Category.CategoryID
LEFT JOIN $table5 ON Books.PublisherID =
  Publisher.PublisherID
LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
LEFT JOIN $table7 ON Books.CD = CD.CD_ID
WHERE Books.Title LIKE \%'$quickSearch'%\
OR Books.Author LIKE \%'$quickSearch'%\
OR Books.ISBN LIKE \%'$quickSearch'%\
OR BookList.dbase LIKE \%'$quickSearch'%\
OR BookList.dbase_user LIKE \%'$quickSearch'%\
OR BoxSet.BoxSet LIKE \%'$quickSearch'%\
OR Category.Category LIKE \%'$quickSearch'%\
OR Category.Sub_category LIKE \%'$quickSearch'%\
OR Publisher.Publisher LIKE \%'$quickSearch'%\;

$result = mysql_query($search, $connection) or die(Couldn't
  search the
library.);

while ($row = mysql_fetch_array($result)) {
$row['Books.Title'];
$row['Books.Author'];
$row['Books.ISBN'];
$row['BookList.dbase'];
$row['BookList.dbase_user'];
$row['BoxSet.BoxSet'];
$row['Category.Category'];
$row['Category.Sub_category'];
$row['Publisher.Publisher'];
$row['AuthUsers.email'];

}


?

I then have some HTML to display the result of the search.  I
  don't
receive any error messages - I just see an empty table from the
  HTML
code I wrote.  I added an echo of the $result to find the
  resouce id
#2.

Thanks for any help you can provide.

--joel







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


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

   
  -- 
  Adam Voigt ([EMAIL PROTECTED])
  The Cryptocomm Group
  My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
  
 
  ATTACHMENT part 2 application/pgp-signature name=signature.asc
 
 
 
 =
 Mark Weinstock
 [EMAIL PROTECTED]
 ***
 You can't demand something

[PHP-DB] MySQL/PHP Iterative Tree

2002-11-26 Thread Adam Voigt
Ok, I've been racking my brain trying to figure this one out, so
I thought I'd post the question here and see who bytes. =)

I have a table:

id INTEGER, PRIMARY KEY
parentid INTEGER DEFAULT (0)
name VARCHAR(32) NOT NULL

Ok, and I am using this structure to make a kind of drill down
structure, so the top level would be where parentid = '0', then
you take those id's and select from this table where parentid is
equal to those id's, and now your starting to navigate through
the tree, and so on.

Now, the real question, I have found a Javascript menu script which
will let users of the site click on it, and then click on the submenu
and down and down through all the level's that might dynamically exist,
but I can't for the life of me figure out how to recursively get the
name and id for each row (which is what I need to build the menu and
make link's out of each item), for as many sublevel's as there might be
(infinite). Am I missing something, is there a simple logical way to do
this recursively? Or if there's a semi-complex way, anyone got a script
example? I'd very much appreciate it.

-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Re: MySQL/PHP Iterative Tree

2002-11-26 Thread Adam Voigt
A coworker suggested I just write either the array or the actual menu
itself (in a .js file) at the time of category/subcategory creation and
just include it on the page with the menu, which I suppose is what I
must do since most other on-the-fly solutions seem fairly complicated
and can get exponentially resource intensive. Thanks for your help.

On Tue, 2002-11-26 at 11:07, David Elliott wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hello 1LT
 
 On 26 November 2002 at 09:54:57 -0500 (which was 14:54 where I live) 1LT
 John W. Holmes emanated these words of wisdom
 
  You may want to check out using Nested Sets instead of a Parent-Child-ID
  system.
 
 This is OK for some simple trees, however it does have some limitations.
 
 (1) Adding another tree / series of nodes into the middle if the set.
 
 (2) A child node that belongs to more than one parent.
 
 - --
  Cheers,   ___
   David   |David  Elliott|   Software Engineer|
  _| [EMAIL PROTECTED] | PGP Key ID 0x650F4534  |
 | Mathematicians DO IT with sum.  |
 
 -BEGIN PGP SIGNATURE-
 Version: 6.5.8ckt http://www.ipgpp.com/
 
 iQA/AwUBPeOcYPmK8eZlD0U0EQJRVACfXZGjwwUlKOV1yEvtEf96D0MdNakAnAuF
 PBlwh2HSenDKSVvldLp8H3fb
 =QE8q
 -END PGP SIGNATURE-
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Resource id #2

2002-11-26 Thread Adam Voigt
Add: print_r($row)

In your while loop, that will show you everything that is being returned
with both it's numeric and text based position.

On Tue, 2002-11-26 at 13:09, The Cossins Fam wrote:
 Hello.
 
 I am using MySQL as a database for a departmental library.  I have written
 a quick search script, but keep getting resource id #2 as a result to my
 search.  I have read the online documentation for the
 mysql_fetch_array() function and must say, I don't see that I'm missing
 anything.  However, I've only started programming, much less working with
 PHP, so perhaps someone can help me out.  Here's my code:
 
 ?
 
 $quickSearch = mcse;
 
 $table1 = Books;
 $table2 = BookList;
 $table3 = BoxSet;
 $table4 = Category;
 $table5 = Publisher;
 $table6 = AuthUsers;
 $table7 = CD;
 
 $connection = mysql_connect(localhost, root) or die(Couldn't connect
 to the library database.);
 
 $db_select = mysql_select_db(library, $connection) or die(Couldn't
 select the library database.);
 
 $search = SELECT * FROM $table1 LEFT JOIN $table2 ON Books.BookListID =
 BookList.BookListID
 LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
 LEFT JOIN $table4 ON Books.CategoryID = Category.CategoryID
 LEFT JOIN $table5 ON Books.PublisherID = Publisher.PublisherID
 LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
 LEFT JOIN $table7 ON Books.CD = CD.CD_ID
 WHERE Books.Title LIKE \%'$quickSearch'%\
 OR Books.Author LIKE \%'$quickSearch'%\
 OR Books.ISBN LIKE \%'$quickSearch'%\
 OR BookList.dbase LIKE \%'$quickSearch'%\
 OR BookList.dbase_user LIKE \%'$quickSearch'%\
 OR BoxSet.BoxSet LIKE \%'$quickSearch'%\
 OR Category.Category LIKE \%'$quickSearch'%\
 OR Category.Sub_category LIKE \%'$quickSearch'%\
 OR Publisher.Publisher LIKE \%'$quickSearch'%\;
 
 $result = mysql_query($search, $connection) or die(Couldn't search the
 library.);
 
 while ($row = mysql_fetch_array($result)) {
 $row['Books.Title'];
 $row['Books.Author'];
 $row['Books.ISBN'];
 $row['BookList.dbase'];
 $row['BookList.dbase_user'];
 $row['BoxSet.BoxSet'];
 $row['Category.Category'];
 $row['Category.Sub_category'];
 $row['Publisher.Publisher'];
 $row['AuthUsers.email'];
 
 }
 
 
 ?
 
 I then have some HTML to display the result of the search.  I don't
 receive any error messages - I just see an empty table from the HTML
 code I wrote.  I added an echo of the $result to find the resouce id
 #2.
 
 Thanks for any help you can provide.
 
 --joel
 
 
 
 
 
 
 
 _
 The new MSN 8: advanced junk mail protection and 2 months FREE* 
 http://join.msn.com/?page=features/junkmail
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


[PHP-DB] Get Last ID Inserted

2002-11-21 Thread Adam Voigt
Using Microsoft SQL does anyone know how to get the id of the row that
you just inserted without clumsily trying to select the id back based on
the same criteria of your insert (which might be overlapping)?

-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] inserting html into mysql tables

2002-11-21 Thread Adam Voigt
Well for one, VARCHAR is limited to 255 characters, so I would use
a TEXT type datafield if you want to store more then 255.

On Thu, 2002-11-21 at 11:01, mike karthauser wrote:
 hi, 
 is there anything special i need to know in regards to creating a table to
 hold html data? I am building a CMS for a site using php and mysql. The
 various tables hold course information that the client wants to edit. I
 imagine it will be a case of dropping the cleaned html source from
 dreamweaver into a form box and posting it to the table.
 
 What would a good varchar(?) be for say 5K of data?
 
 cheers
 mikek  
 -- 
 Mike Karthauser 
 Managing Director - Brightstorm Ltd
 
 Email[EMAIL PROTECTED]
 Web  http://www.brightstorm.co.uk
 Tel  0117 9426653 (office)
07939 252144 (mobile)
 
 SnailmailUnit 8, 14 King Square,
Bristol BS2 8JJ
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Re: Get Last ID Inserted

2002-11-21 Thread Adam Voigt
But if there are heavy operations on the site, will this not also pick
up a different last inserted id, if in the split milisecond between the
insert and the next mssql_query which has the @@identity say, another
user does an insert?

On Thu, 2002-11-21 at 11:03, David Elliott wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hello Adam
 
 On 21 November 2002 at 10:47:15 -0500 (which was 15:47 where I live) Adam
 Voigt wrote
 
  Using Microsoft SQL does anyone know how to get the id of the row that
  you just inserted without clumsily trying to select the id back based on
  the same criteria of your insert (which might be overlapping)?
 
 select @@identity
 
 - --
  Cheers,   ___
   David   |David  Elliott|   Software Engineer|
  _| [EMAIL PROTECTED] | PGP Key ID 0x650F4534  |
 | No dinner with Mel Gibson?! - Dot Warner|
 
 -BEGIN PGP SIGNATURE-
 Version: 6.5.8ckt http://www.ipgpp.com/
 
 iQA/AwUBPd0DwfmK8eZlD0U0EQI3fACgsv52o5AvhuroJIVYblYXTnkiDZYAn2Ao
 y1AeA+bR4KPOwZhZTAa2x7kr
 =f/lr
 -END PGP SIGNATURE-
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Re: Get Last ID Inserted

2002-11-21 Thread Adam Voigt
Ahh, thanks very much.

On Thu, 2002-11-21 at 12:08, David Elliott wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hello Adam
 
 On 21 November 2002 at 11:12:46 -0500 (which was 16:12 where I live) Adam
 Voigt rearranged electrons to get
 
  But if there are heavy operations on the site, will this not also pick
  up a different last inserted id, if in the split milisecond between the
  insert and the next mssql_query which has the @@identity say, another
  user does an insert?
 
 No. It picks up the last identity on that connection. So it does not mater
 how many other connections and what they are doing.
 
 It can only be wrong if you close off the connection and open another one.
 The other way is to put it all into one SQL statement (as long as you don't
 use mssql_? functions in PHP)
 
 e.g. (one I used earlier)
 
 ==8=
 begin transaction
 
 set nocount on
 
 declare
   @NewId int
 
 update item
 set name = 'Canada Delivery'
 where itemid = '428'
 
 insert into item
 (ItemTypeId, Name, LastUpdated)
 values
 (49,'Mexico Delivery',getutcdate())
 
 set @NewId = @@identity
 
 insert into DelArea
 (itemid,StdEUR, StdGBP, StdUSD, HotEUR, HotGBP, HotUSD)
 values
 (@NewId,37,19,45,134,70,70)
 
 Update country
 set DelId = @NewId
 where itemid = 288
 
 commit
 
 select
   @NewId NewDelId
 
 ==8=
 
 
 
 - --
  Ti2GO,___
   David   |David  Elliott|   Software Engineer|
  _| [EMAIL PROTECTED] | PGP Key ID 0x650F4534  |
 | Do you think someone was BORGED when they made these up?|
 
 -BEGIN PGP SIGNATURE-
 Version: 6.5.8ckt http://www.ipgpp.com/
 
 iQA/AwUBPd0TBPmK8eZlD0U0EQL1awCgmS57QwyvS+bz02XsLQtwJOSGSB8AoLmo
 I9VdgNIsp3GXkzWAX6I1jYpp
 =UXBQ
 -END PGP SIGNATURE-
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


RE: [PHP-DB] Check data exists in MySQL

2002-11-21 Thread Adam Royle
Sorry about previous post (some stupid shortcut key made it send)

Your row:

$sql = INSERT INTO count VALUES('$dept', '$deptsub', '0');

should be:

$sql = INSERT INTO count VALUES('$dept', '$deptsub', '0');

You missed the double quotes.

Adam




--- Original Message ---

Hi,

for some reason i'm getting an error when I try to run this query:
__

  $sql=SELECT num FROM count where dept='$dept' AND deptsub='$deptsub';
  $page_count = mysql_query($sql,$db);

  # If does not exist in the database, insert a new entry
  if (!mysql_num_rows($page_count)){
$sql = INSERT INTO count VALUES('$dept', '$deptsub', '0');
$result = mysql_query($sql,$db);
  }

  #Update the count in the database
  $page_count = $page_count + 1;
  $sql=UPDATE count SET num='$page_count' WHERE dept='$dept' AND
deptsub='$deptsub';
  $result = mysql_query($sql, $db);
__

My table looks like this:
  count:
 dept VARCHAR(32)
 deptsub VARCHAR(32)
 num INT(10)
__

I'm getting the following error message:
  Parse error: parse error in /home/./public_html/public/index.php on
line 25
(Which is the line: $sql=UPDATE count...)


Any thoughts would b most helpful.
Thanks,
Gav




Re: [PHP-DB] Fastest, easiest Flatfile DB with PHP

2002-11-18 Thread Adam Voigt
For massive amounts of data, you really want to use some type
of SQL database. Not only will you save time programming, but
massive server resources aswell since the disk doesn't have to parse
and seek a large flatfile everytime.

On Mon, 2002-11-18 at 09:15, Teemu Pentinsaari wrote:
 hi,
 
 Maybe someone here can point me the way ...
 I'm looking for a fast and easy to use flatfile database working with PHP.
 The amount of stored data, the frequency and number of queries are really
 massive so I'm hoping to be able to skip MySql and build this service with
 some alternative technique. Anyone ?
 
 thanks
 
 Teemu
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


RE: [PHP-DB] php sessions using mysql (or any db)

2002-11-18 Thread Adam Nelson
Thanks for the clarification with the returns.  I made the changes
however and it still doesn't work.  This code comes pretty much straight
off the presses from http://www.onlamp.com/lpt/a/832

What I have is quite modified from what is on there as it is quite buggy
to begin with.  Anyway, It still doesn't work.  In perl, this would have
been done already.  I can't be the first person to try running sessions
on a database.  Does anyone have a session.inc file that would be
appropriate for me.  I feel like it should just be in the php base
files.


 -Original Message-
 From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, November 15, 2002 4:59 PM
 To: Adam Nelson
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] php sessions using mysql (or any db)
 
 
  CREATE TABLE `SessionsTable` (
`SID` varchar(32) NOT NULL default '',
 
 This doesn't need to be a varchar.  The sid will always be 32 
 chars, so
 make it a char(32)
 

This is just an artifact of InnoDB/Mysql.  I don't know the specifics,
but I think char is no longer used by InnoDB (ie. it is just an alias
for varchar).  Anyway, I put in char, the ddl pops out as varchar.

`expiration` int(11) NOT NULL default '0',
 
 I would suggest using a timestamp type here so MySQL will handle
 updating it for you automatically.

timestamp would change with every update.  This is a field to describe
when the record should expire

 
  function mysql_session_open($session_path, $session_name) {
 
mysql_pconnect(localhost, root, )
   or die(Can't connect to MySQL server! );
 
mysql_select_db(globalDB)
   or die(Can't select MySQL sessions database);
 
  } // end mysql_session_open()
 
 You need to return true; at the end of this.
 
true.

  function mysql_session_close() {
 
return 1;
 
 No, use return true;
 
  function mysql_session_select($SID) {
 
GLOBAL $sess_db;
GLOBAL $sess_table;
 
$query = SELECT value FROM $sess_table
WHERE SID = '$SID' AND
expiration  . time();
 
$result = mysql_query($query);
 
  } // end mysql_session_select()
 
 Uh, you need to return the actual value here or an empty string on an
 error.
 
  function mysql_session_write($SID,$value) {
 
GLOBAL $sess_db;
GLOBAL $sess_table;
GLOBAL $lifetime;
 
$expiration = time() + $lifetime;
 
$query = INSERT INTO $sess_table
VALUES('$SID', '$expiration', '$value');
 
$result = mysql_query($query);
 
if (! $result) :
 
 $query = UPDATE $sess_table SET
 expiration = '$expiration',
 value = '$value' WHERE
 SID = '$SID' AND expiration . time();
 $result = mysql_query($query);
 
endif;
 
  } // end mysql_session_write()
 
 Again, you *must* return true; on a sucessful write.
 
  function mysql_session_destroy($sessionID) {
 
GLOBAL $sess_table;
 
$query = DELETE FROM $sess_table
WHERE SID = '$sessionID';
$result = mysql_query($query);
 
  } // end mysql_session_destroy()
 
 return true;
 
 -Rasmus
 
 
 
 




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




RE: [PHP-DB] php sessions using mysql (or any db)

2002-11-18 Thread Adam Nelson
This works great :-) Thanks.  

I'll write a letter to onlamp.com to get that misleading code off their
website (maybe it's PHP3 based?).
Perhaps this should be added to PEAR?  It appears that this is the
proper repository for such things.  I'll look into it although I would
be much obliged if somebody in the know could handle this since I am new
to PHP.

One thing I left out - I had to take out the $GLOBALS[acdb] part from
mysql_query.  This doesn't work with my version of php (4.2.3) I guess.
Also, assert(!empty($SessionTableName)); didn't work, so I commented it
out.


 -Original Message-
 From: Peter Beckman [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, November 18, 2002 12:01 PM
 To: Adam Nelson
 Cc: [EMAIL PROTECTED]; 'Rasmus Lerdorf'
 Subject: RE: [PHP-DB] php sessions using mysql (or any db)
 
 
 ?php  // I got this somewhere.  It works.
// This code is released under the same license as 
 PHP. (http://www.php.net/license.html)
assert(get_cfg_var(session.save_handler) == user);
// Without save_handler being set to user, everything 
 works fine until it calls the write handler.
$SessionTableName = get_cfg_var(session.save_path); 
 // [$database.]tablename
'
function db_error_message() {
  return mysql_error();
}
function mysql_session_open ($save_path, $session_name) {
return true;
}
function mysql_session_close() {
return true;
}
function mysql_session_read ($SessionID) {
global $SessionTableName;
$SessionID = addslashes($SessionID);
$session_data = mysql_query(SELECT Data FROM 
 $SessionTableName WHERE SessionID = '$SessionID',$GLOBALS[acdb]) or
 die(db_error_mess
 age());
if (mysql_numrows($session_data) == 1) {
return mysql_result($session_data, 0);
} else {
return false;
}
}
function mysql_session_write ($SessionID, $val) {
global $SessionTableName;
$SessionID = addslashes($SessionID);
$val = addslashes($val);
$SessionExists = mysql_result(mysql_query(SELECT 
 COUNT(*) FROM $SessionTableName WHERE SessionID = 
 '$SessionID',$GLOBALS[acdb]),
 0
 );
if ($SessionExists == 0) {
$retval = mysql_query(INSERT INTO 
 $SessionTableName (SessionID, LastActive, Data) VALUES ('$SessionID',

 UNIX_TIMESTAMP(NOW()),'$val'),$GLOBALS[acdb]) or 
 die(db_error_message());
} else {
$retval = mysql_query(UPDATE 
 $SessionTableName SET Data = '$val', LastActive = 
 UNIX_TIMESTAMP(NOW()) WHERE SessionID =
'$SessionID',$GLOBALS[acdb]) or 
 die(db_error_message());
if (mysql_affected_rows()  0) {
error_log(unable to update session data 
 for session $SessionID);
}
}
return $retval;
}
function mysql_session_destroy ($SessionID) {
global $SessionTableName;
$SessionID = addslashes($SessionID);
$retval = mysql_query(DELETE FROM 
 $SessionTableName WHERE SessionID = 
 '$SessionID',$GLOBALS[acdb]) or die(db_error_message());
return $retval;
}
function mysql_session_gc ($maxlifetime = 604800) {
global $SessionTableName;
$CutoffTime = time() - $maxlifetime;
$retval = mysql_query(DELETE FROM 
 $SessionTableName WHERE LastActive  
 $CutoffTime,$GLOBALS[acdb]) or die(db_error_message());
return $retval;
}
session_set_save_handler (
'mysql_session_open',
'mysql_session_close',
'mysql_session_read',
'mysql_session_write',
'mysql_session_destroy',
'mysql_session_gc'
);
 ?
 On Mon, 18 Nov 2002, Adam Nelson wrote:
 
  Thanks for the clarification with the returns.  I made the changes
  however and it still doesn't work.  This code comes pretty 
 much straight
  off the presses from http://www.onlamp.com/lpt/a/832
 
  What I have is quite modified from what is on there as it 
 is quite buggy
  to begin with.  Anyway, It still doesn't work.  In perl, 
 this would have
  been done already.  I can't be the first person to try 
 running sessions
  on a database.  Does anyone have a session.inc file that would be
  appropriate for me.  I feel like it should just be in the php base
  files.
 
 
   -Original Message-
   From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
   Sent: Friday, November 15, 2002 4:59 PM
   To: Adam Nelson
   Cc: [EMAIL PROTECTED]
   Subject: Re: [PHP-DB] php sessions using mysql (or any db)
  
  
CREATE TABLE `SessionsTable` (
  `SID` varchar(32) NOT NULL default '',
  
   This doesn't need to be a varchar.  The sid will always be 32
   chars, so
   make it a char(32)
  
 
  This is just

RE: [PHP-DB] php sessions using mysql (or any db)

2002-11-18 Thread Adam Royle
Hi,

Just wondering, which is the better method:

1. Using PHP sessions ($_SESSION['var'] = val;)
2. Using mySQL-based sessions (as described in this thread)

I know if you're using multiple servers, a DB-based session would be handy.

Any comments, anyone?

Adam



[PHP-DB] php sessions using mysql (or any db)

2002-11-15 Thread Adam Nelson
Cannot get code to work for session management on a database.  Does anyone
have tips.  It appears that the data goes into the table, but I can't get it
out.  session_start just initializes the data in the value column.:


SessionsTable definition
---

CREATE TABLE `SessionsTable` (
  `SID` varchar(32) NOT NULL default '',
  `expiration` int(11) NOT NULL default '0',
  `value` text NOT NULL,
  PRIMARY KEY  (`SID`)
) TYPE=MyISAM


mysql_sessions.inc:


?php

// Session Table

$sess_table = SessionsTable;

// Retrieve the session maximum lifetime (found in php.ini)

$lifetime = get_cfg_var(session.gc_maxlifetime);

//=
// function: mysql_session_open()
// purpose: Opens a persistent server connection and selects the
//database.
//=

function mysql_session_open($session_path, $session_name) {

  mysql_pconnect(localhost, root, )
 or die(Can't connect to MySQL server! );

  mysql_select_db(globalDB)
 or die(Can't select MySQL sessions database);

} // end mysql_session_open()

//=
// function: mysql_session_close()
// purpose: Doesn't actually do anything since the server connection is
//persistent. Keep in mind that although this function
//doesn't do anything in my particular implementation, I
//still must define it.
//=

function mysql_session_close() {

  return 1;

} // end mysql_session_close()

//=
// function: mysql_session_select()
// purpose: Reads the session data from the database
//=

function mysql_session_select($SID) {

  GLOBAL $sess_db;
  GLOBAL $sess_table;

  $query = SELECT value FROM $sess_table
  WHERE SID = '$SID' AND
  expiration  . time();

  $result = mysql_query($query);

} // end mysql_session_select()

//=
// function: mysql_session_write()
// purpose: This function writes the session data to the database. If that
SID
// already exists, then the existing data will be updated.
//=

function mysql_session_write($SID,$value) {

  GLOBAL $sess_db;
  GLOBAL $sess_table;
  GLOBAL $lifetime;

  $expiration = time() + $lifetime;

  $query = INSERT INTO $sess_table
  VALUES('$SID', '$expiration', '$value');

  $result = mysql_query($query);

  if (! $result) :

   $query = UPDATE $sess_table SET
   expiration = '$expiration',
   value = '$value' WHERE
   SID = '$SID' AND expiration . time();
   $result = mysql_query($query);

  endif;

} // end mysql_session_write()

//=
// function: mysql_session_destroy()
// purpose: deletes all session information having input SID (only one row)
//=

function mysql_session_destroy($sessionID) {

  GLOBAL $sess_table;

  $query = DELETE FROM $sess_table
  WHERE SID = '$sessionID';
  $result = mysql_query($query);

} // end mysql_session_destroy()

//=
// function: mysql_session_garbage_collect()
// purpose: deletes all sessions that have expired.
//=

function mysql_session_garbage_collect($lifetime) {

  GLOBAL $sess_table;

  $query = DELETE FROM $sess_table
  WHERE sess_expiration  .time() - $lifetime;
  $result = mysql_query($query);

  return mysql_affected_rows($result);

} // end mysql_session_garbage_collect()

?

End of mysql_sessions.inc


---
1-1.php - The first page
---

?
INCLUDE(mysql_sessions.inc);

session_set_save_handler(mysql_session_open, mysql_session_close,
  mysql_session_select, mysql_session_write,
  mysql_session_destroy,
  mysql_session_garbage_collect);

// create a new session
session_start();

// register a session-variable
session_register(bgcolor);

// Assign a value to the session-variable
$_SESSION['bgcolor'] = #8080ff;
?
html
head
titleSession Example #1/title
/head

body bgcolor=?=$_SESSION['bgcolor']? text=#00 link=#00
vlink=#00 alink=#00

Welcome to a session-enabled page! The background color on the next page
will be set to a stylish blue.p
a href = 1-2.phpGo to another session-enabled page/a.
/body
/html

---
End of 1-1.php
---

---
1-2.php - To confirm that the session worked
---
?
INCLUDE(mysql_sessions.inc);

session_set_save_handler(mysql_session_open, mysql_session_close,
  mysql_session_select, mysql_session_write,
  mysql_session_destroy,
  mysql_session_garbage_collect);

// Resume session created in Listing 1-2
session_start();

?

html
head
titleSession Example #1/title
/head

body bgcolor=?=$_SESSION['bgcolor']? text=#00 link=#808040
vlink=#606060 alink=#808000

?

// Display the value of the $bgcolor variable.
printf (The persistent background color is: %s br\n,
$_SESSION['bgcolor']);
?

/body
/html





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

Re: [PHP-DB] Multiple Inserts with mySQL

2002-11-14 Thread Adam Voigt
10 Seconds searching in the MySQL Manual:

http://www.mysql.com/doc/en/ANSI_diff_Transactions.html

You have to use InnoDB tables, but this will work.

On Thu, 2002-11-14 at 11:26, Anthony wrote:
 hmm, I guess that would work.  There is no way to have mySQL check for 
 integrity for me is there?  I read in a SQL book a while ago about 
 wrapping multiple inserts in a select statement, that way if any part of 
 the statement failed the whole thing would be rolled back.  From my 
 research though, it doesn't look like mySQL supports this.  Am I right 
 here?  So far it looks like your idea could be the most reliable 
 suggestions I've gotten, so I'll start working on that for now.  Thanks.
 
 - Anthony
 
 Peter Beckman wrote:
  Try this:
  
  $stack is an array of hashes:
  
  $stack[0] = array(0=tablename, 1=insertid());
  
  For each insert you do, push an anonymous array on $stack which includes
  the tablename and insertid of the insert.
  
  Then as you continue your inserts, if any of them fail, call a function
  which takes that array $stack, and iterate through it, deleting the rows
  you just inserted. (see mysql_insert_id() function to get the insert ID)
  
  If none of them do fail, then you are in the clear.  Either unset $stack or
  ignore it.
  
  Peter
  
  On Wed, 13 Nov 2002, Anthony wrote:
  
  
 I have to drop a lot of data into mySQL from PHP.  It will go into quite
 a few different tables.  How can I maintain integrity of the entire
 insert?  I need to do about a dozen inserts on four tables and I need to
 insure that all the inserts are successful or that none of them get
 done.  I'm sort of new at this, so please help me out.  Thanks.
 
 - Anthony
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
  
  
  ---
  Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
  [EMAIL PROTECTED] http://www.purplecow.com/
  ---
  
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


[PHP-DB] Re: how to put all rows into an array

2002-11-13 Thread Adam Royle
No built-in function, but this can be handy (i have it inside a getData() function, 
which also lets me output data in a number of ways)

HTH, Adam

$sql = SELECT * FROM .;
$DB_RESULT = mysql_query($sql);

$arrData = array();
$rowCount = 0;

while ($r = mysql_fetch_array($DB_RESULT,MYSQL_ASSOC)){
 foreach ($r as $key = $value){
  $arrData[$rowCount++][$key] = $value;
 }
}





Re: [PHP-DB] sql select

2002-11-12 Thread Adam Williams
Have you ran it by hand in MySQL from the command prompt with some test
data and gotten an error?

Adam

On Tue, 12 Nov 2002, Steve Dodkins wrote:

 if i have a statement

 $result = mysql_query(SELECT
 labor_id,labor_ord_no,labor_wkyr,works_orders_part_no,works_orders_qty,works
 _orders_customer_id,labor_qty,labor_time,labor_qty*parts_time+parts_setup AS
 timea FROM labor,works_orders,parts WHERE labor_ord_no=works_orders_ord_no
 AND works_orders_part_no=parts_no AND time2 = labor_wkyr ORDER BY
 labor_wkyr,works_orders_ord_no,$link);

 This works fine but if i add AND timea  labor_time it fails



 Regards

 Steve Dodkins

 IMPORTANT NOTICE The information in this e-mail is confidential and should
 only be read by those persons to whom it is addressed and is not intended to
 be relied upon by any person without subsequent written confirmation of its
 contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the
 accuracy or completeness of this message as it has been transmitted over a
 public network.   Furthermore, the content of this e-mail is the personal
 view of the sender and does not represent the advice, views or opinion of
 our company. Accordingly, our company disclaim all responsibility and accept
 no liability (including in negligence) for the consequences of any person
 acting, or refraining from acting, on such information prior to the receipt
 by those persons of subsequent written confirmation. In particular (but not
 by way of limitation) our company disclaims all responsibility and accepts
 no liability for any e-mails which are defamatory, offensive, racist or in
 any other way are in breach of any third party's rights, including breach of
 confidence, privacy or other rights. If you have received this e-mail
 message in error, please notify me immediately by telephone. Please also
 destroy and delete the message from your computer. Any form of reproduction,
 dissemination, copying, disclosure, modification, distribution and/or
 publication of this e-mail message is strictly prohibited.  If you have
 received this E-mail in error, or suspect that the message may have been
 intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245
 468555.
 ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ







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




Re: [PHP-DB] MySql Update.

2002-11-12 Thread Adam Voigt
$query = UPDATE tablename SET ;
foreach($_POST AS $key = $value)
$query .= $key = '$value',;
$query[strlen($query)-1] = ;
$query .=  WHERE id = '$_GET[id]';

Or something?

On Tue, 2002-11-12 at 13:58, David Rice wrote:
 
 
 Making an update query that adapts to the number of fields that are to be 
 updated
 
 Is there anyway to do like a for loop to create the values part of the query 
 then combine it with the first part of the string.
 
 something like what i have below... although something that works correctly 
 as this doesn't.
 ==
 
 $table is the table name
 $num_headers is the number of headers (fieldnames) for that table
 $table_headers is an array with the names of the headers
 $values is an array with the names of the input boxes on the previous page
 
 ==
 $query1 = UPDATE .$table. SET  ;
 
 $query2 = ( for ($x=0; $x =$num_headers; $x++){
. $table_headers[$x] . = . $values[$x] .  , 
}) ;
 
 $query = $query1.$query2 ;
 
 $result = mysql_query ($query) ;
 etc...
 
 
 
 _
 Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
 http://join.msn.com/?page=features/junkmail
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


[PHP-DB] Re: Displaying a single picture...

2002-11-12 Thread Adam Royle
You could do something as simple as this:

a href=displayPic.php?image=/path/to/image.jpgtitle=This is my titleimg 
src=/thumb.jpg border=0/a

I think most browsers will convert the spaces in the link (when clicked) to '+' or 
'%20', but this may not be true with some less popular browsers (i don't know).

Then displayPic.php might be something like this (if you have latest PHP version):

displayPic.php 

?php

$image = isset($_GET['image']) ? $_GET['image'] : /unknown_pic.jpg;
$title = isset($_GET['title]) ? $_GET['title] : /lost_title.jpg;

?
img src=?= $image ?br
?= $title %

--

Hope this helps
Adam

--- Original Message ---
I have several thumbnail images spread out in my website.  I thought it
would be cool to write a single PHP script so that when they click on the
thumbnail, the name of the larger pic would be passed to a PHP script that
displays it on its own page...I don't even care about a link back, they can
just click the browser's back arrow.

How do I get the name stored when they click on the thumbnail?

My confusion is, I'm seeing this one dimensionally.  You click on an image,
it calls a link.  But I need to click on the image, store the name of the
pic I want to display, then call the PHP link.

I've looked at some of the free Image Lib PHP scripts out thereand they
all go wy overboard on what I'm looking to do.

Any suggestions?

Thanks




[PHP-DB] Re: Having more than one id in the same field

2002-11-10 Thread Adam Atlas
Perhaps you could store all of the IDs in a varchar type (I'm assuming 
you're using some SQL database or another) separated by spaces or 
colons or anything else that wouldn't be in an ID. Then you can get the 
separate IDs by Exploding the result in PHP. That's probably not the 
best way to do this, but it's the first way I can think of.

Hi. I have a database designing question to ask.
I want to build a table of events. Among the other fields there must 
be a
field that holds the 'responsible organization' of the event. This
organization of course will be responsible for other events as well so 
I
have to create another table that holds the organizations (id, name, 
phones,
director etc) and then just pull the organization id to the events 
table.
The problem is that it happens too often to have 2 organizations 
responsible
for the same event so I'll have to add them both to the events table 
in the
same record.

How do you advice me to do that?
I thought that I could use a text field to hold the ids and then when
searching the database just change the MySQL command from
...where events.id='$id'... (As it would be if only one id was going 
to be
used) to
...where '$id' in (events.ids)... or maybe something using LIKE.

Do you think it can be done this way? Apart from the responsible
organization I may have other fields in the same table having the same
problem (for example: the event visitors are staying in one hotel and 
I want
to hold control of the hotels as well. Maybe 2 hotels are used instead 
of
one). If I solve my problem this way, do you think that it will be too
difficult or 'heavy' to have more than one condition like this in my
queries?
Do you think of any other way?

Thanx in advance
Achilles

--
Adam Atlas

Your mouse has moved. Windows has to reboot for changes to take effect. 
[ OK ]


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



Re: [PHP-DB] MySQL password protection?

2002-11-07 Thread Adam Voigt
Make the include file (or wherever your page with the pass is)
encrypted, see ioncube.com they charge by the amount of code you
incrypt, for a simple database include file, I think it would
be $1 or less.

On Wed, 2002-11-06 at 16:04, William Trappeniers wrote:
 Hi all
 
 I was wondering if it is possible to protect my password to the MySQL-server
 from being in a PHP-script.  Now I can't do that, so everybody who gets to
 see my php-sourcecode also can see my (not protected/not encrypted)
 password.
 How can I change this?
 
 Thanks,
 
 William
 
 ---
 William Trappeniers
 mail at: [EMAIL PROTECTED]
 
 
 
 -- 
 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] first Array value duplicating..

2002-11-07 Thread Adam Voigt
Ok, here's how I do it: =)

Delete checkbox's (assuming this is being called recursively, once
for each row in the db):

input type=checkbox name=delete[] value=$row[id]

And on submition:

foreach($_POST[delete] AS $row)
mysql_query(DELETE FROM tablename WHERE id = '$row';);

Adam Voigt
[EMAIL PROTECTED]

  Hi All,
 
 
  In a form I have checkboxes associated with order records. The
  checkboxes are for deleting order records (should a client choose to do
  so).
 
  It looks like this:
 
  form name=form action=process_bank.php method=POST
  input type=hidden name=order_index[0] value=1
  td class=cartlink align=centerinput type=checkbox
  name=delete[0] value=1/td
  input type=hidden name=order_index[1] value=3
  td class=cartlink align=centerinput type=checkbox
  name=delete[1] value=1/td
  input type=hidden name=order_index[2] value=8
  td class=cartlink align=centerinput type=checkbox
  name=delete[2] value=1/td
  input type=hidden name=order_index[3] value=12
  td class=cartlink align=centerinput type=checkbox
  name=delete[3] value=1/td
  /form
 
  Now.. when the process button is pressed the information is carried off
  to the process_bank.php script.
 
  Lets assume for this example.. I selected the checkbox delete[0] (which
  equals value 1) and delete[3] (which equals value 12).
 
  In the script I have this code:
 
  for ($i=0;$isizeof($order_index);$i++) {
 
 $orderQuery = db_query(SELECT id FROM TestOrderTable WHERE
  id=.$order_index[$i]);
 $orderResult = db_fetch($orderQuery);
 
 if ($delete[$i] == 1) {
 
  $ids .= $orderResult[id];
 
  echo $ids;
 
 
 }
  }
 
  The echo'd value that I get is 1,1,12 when it should be 1,12.
 
  When only ONE checkbox is selected I just get the one value displayed
  (i.e. if I selected the first checkbox the echo'd value would be 1).
 
  Does anyone know why the first value is being duplicated on a multiple
  select but not on a single select?
 
  Sorry if this sounds confusing :(
 
  Aaron
 
 
 -- 
 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: [PHP] problem with informix

2002-10-21 Thread Adam Williams
I'd go back to apache 1.3.27 and php-4.2.3 if I were you and see if that
fixes your problem.

I run Informix, PHP, and Apache on a server and have had no problems.

Adam

On Mon, 21 Oct 2002, Erwin Speybroeck wrote:

 Hi,

 I'm struggling with a problem for quite some time.
 I have a webserver with apache-1.3.22, php 4.0.6 (patched for some security issues), 
informix ESQL 9.30 and a databaseserver with Informix IDS 7.31. This construction 
works very fine.

 As soon as i go to newer versions -- last try : httpd-2.0.43, php-4.2.3, with the 
same informix configuration the problem appears. Everything went well for about a 
week -- so it lloks ok, but ...

 On the databaseserver shared memory gets taken by the php-actions on the webserver 
and at a certain moment this memory is all used and the server (database) crashes.

 Is there somebody who has experienced a similar problem or is there somebody who can 
give some hints in the direction to look for ???

 Thanks in advance,

 Erwin Speybroeck
 [EMAIL PROTECTED]
 Neem eens een kijkje op onze website -- www.vrv.be



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




[PHP-DB] Re: Accessing data from next row? (mysql)

2002-10-14 Thread Adam Royle

Create an array and go through the array as needed.

Here is some code from one of my db functions:

$DB_RESULT = mysql_query($sql) or die(Error executing query:  . 
mysql_error());

// create an empty array to fill with data
$arrData = array();

$rowCount = 0;
while ($r = mysql_fetch_array($DB_RESULT, MYSQL_ASSOC)){
foreach ($r as $key = $value){
$arrData[$rowCount][$key] = $value;
}
$rowCount++;
}

then simply instead of your code:
while($array = mysql_fetch_array($result)){

use this:
for ($i=0;$icount($arrData);$i++){
$arrThisRow = $arrData[$i];
$arrNextRow = $arrData[$i+1];
}

obviously, if you are trying to access a variable which index does not 
exist, you will need to implement some sort of error checking, etc

adam


 Using mysql, how do I access the data of the next row using code
 something like this:
 $result = mysql_query(select column from table where 
 whatever='whatever');
 while($array = mysql_fetch_array($result)){
 //Whatever
 }


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




[PHP-DB] Re: Accessing data from next row? (mysql)

2002-10-14 Thread Adam Royle

Also, if you're not sure how to get the values from $arrThisRow / 
$arrNextRow:

echo $arrThisRow['columnName'];

or $arrData[$i]['columnName'] if you want to access it manually without 
the other two arrays

adam

On Monday, October 14, 2002, at 06:05  PM, Adam Royle wrote:

 Create an array and go through the array as needed.

 Here is some code from one of my db functions:

   $DB_RESULT = mysql_query($sql) or die(Error executing query:  . 
 mysql_error());

   // create an empty array to fill with data
   $arrData = array();

   $rowCount = 0;
   while ($r = mysql_fetch_array($DB_RESULT, MYSQL_ASSOC)){
   foreach ($r as $key = $value){
   $arrData[$rowCount][$key] = $value;
   }
   $rowCount++;
   }

 then simply instead of your code:
 while($array = mysql_fetch_array($result)){

 use this:
 for ($i=0;$icount($arrData);$i++){
   $arrThisRow = $arrData[$i];
   $arrNextRow = $arrData[$i+1];
 }

 obviously, if you are trying to access a variable which index does not 
 exist, you will need to implement some sort of error checking, etc

 adam


 Using mysql, how do I access the data of the next row using code
 something like this:
 $result = mysql_query(select column from table where 
 whatever='whatever');
 while($array = mysql_fetch_array($result)){
 //Whatever
 }



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




[PHP-DB] .htaccess and db authentication

2002-10-14 Thread Adam Royle

I was wondering about people's thoughts on file security through php 
using database authentication.

Take the following example:

I have a folder (in webroot) called /videos/ which contains a heap of 
files like so:

video_1_14-06-2002.mpg
video_2_15-06-2002.mpg
video_3_16-06-2002.mpg
video_4_17-06-2002.mpg

Now, in a database I have table with a heap of users, with some sort of 
security identifier which allows them to access only the files they are 
given access to. Now, doing this in PHP is no problem, but I want to be 
able to stop them from 'predicting' what the next filename would be and 
just typing that in.

I thought about using .htaccess, where if they try to access one of the 
files, it sends it off to a php page which authenticates and displays a 
list of files they are allowed to view, although I would like it if 
they had the opportunity to type in the url of the file if they are 
actually authorized to do so.

I would prefer not to keep a file listing of allowed usernames and 
passwords using .htaccess, as this information could potentially be 
updated frequently with a large amount of users (or would this not be a 
problem).

Has anyone implemented this type of system before? are there any good 
resources people know of for this type of thing?

Thanks,
Adam.


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




Re: [PHP-DB] Advanced search scripts

2002-10-09 Thread Adam Royle

Well, for this example, you could use mySQL, but really, I would be 
looking to utilise this on any database. Personally, I don't think this 
would be database dependent (unless you have other ideas).

Adam

On Wednesday, October 9, 2002, at 08:46  PM, John W. Holmes wrote:

 What database are you using?

 ---John Holmes...

 -Original Message-
 From: Adam Royle [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 2:09 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Advanced search scripts

 I was wondering if anyone has some resources (links or scripts) on
 'advanced site searches'. Something that is similar to the way regular
 search engines process requests.

 ie.   phrase or two word +required -not included

 Also, returning details of that search, say for example returning 10
 words
 before and 10 words after and displaying it in search results. The
 ability
 to search similar words (eg. ignoring punctuation) would be cool
 aswell.

 I am interested in this for database (all text fields), and also
 searching
 text files on filesystem.

 Now, I'm not trying to recreate Google or anything, and this is just
 for
 my own research (at this time), but I eventually would like to be able
 to
 create a smarter site searching engine.

 Can anyone give suggestions? or any links to tutorials (or books)

 I have used regex a little bit before, but not in PHP (only ASP and
 JavaScript).

 Adam





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




[PHP-DB] Advanced search scripts

2002-10-08 Thread Adam Royle

I was wondering if anyone has some resources (links or scripts) on 'advanced site 
searches'. Something that is similar to the way regular search engines process 
requests. 

ie.   phrase or two word +required -not included

Also, returning details of that search, say for example returning 10 words before and 
10 words after and displaying it in search results. The ability to search similar 
words (eg. ignoring punctuation) would be cool aswell.

I am interested in this for database (all text fields), and also searching text files 
on filesystem.

Now, I'm not trying to recreate Google or anything, and this is just for my own 
research (at this time), but I eventually would like to be able to create a smarter 
site searching engine.

Can anyone give suggestions? or any links to tutorials (or books)

I have used regex a little bit before, but not in PHP (only ASP and JavaScript).

Adam



Re: [PHP-DB] Noob questions...

2002-10-02 Thread Adam Williams

search around for phpmyadmin on google

Adam

On Wed, 2 Oct 2002, Brett Lathrope wrote:


 Ok, here's my scenario...

 My Web Host has all Root Admin control over MySQL and PHP configs (but they
 are setup well no complaints there)...I simply have access to 1 DB (already
 created) that I can do what I want with (create/delete/update tables).

 I'm VERY comfortable in Windows, C/C++, Delphi and SQL.  But I'm a noob to
 Unix/Linux, as well as both MySQL and PHP.

 I have two books and the online manuals and I'm reading them...unfortunately
 almost ALL of them assume you have Root Admin (as well as build) privileges.

 Can someone recommend a MySQL Front End, that a) is free and b) a noob can
 set up and finally c) allows me to work from a client on MySQL DB on my Web
 Host?

 Thanks Brett







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




Re: [PHP-DB] I need Microsoft SQL Library: mssql70.so

2002-10-02 Thread Adam Voigt

You need the FreeTDS connection library (it works wonders for us):

Goto www.freetds.org
Download it
Configure, make, make install it
Edit your freetds config file to your needs
Add the --with-sybase=/path/to/freetds to your PHP configure line

yes, I know that says sybase, but trust me, it works.

Adam Voigt
[EMAIL PROTECTED]

On Wed, 2002-10-02 at 12:48, Leo Hotmail wrote:
 
 
 I've installed Linux Red Hat 7.1  with php 4 and have the this libraries in 
/usr/lib/php4
 
  pgsql.so
  ldap.so
  imap.so
 
 but I need Microsoft SQL Library: mssql70.so
 
 how can I install it?
 
 Leo
 



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




Re: [PHP-DB] Current row of query

2002-09-26 Thread Adam Williams

why not

if (!($1%2))
{
echo even!;
}
else
{
echo odd!;
}

Adam

On Thu, 26 Sep 2002, Brad Bonkoski wrote:

 oops...

 I meant:
 (if $i is odd)
 ...

 because $i would be the current index in the array.


 Brad Bonkoski wrote:

  why not this?
 
  $result = mysql_query(Select * from table');
  $num_rows = mysql_num_rows($rows);
 
  for ($i=0; $i$num_rows, $i++)
  {
  $row = mysql_fetch_array($result);
  if ($num_rows is odd)
  {
  print $row with BG color of red;
  }
  else
  {
  printf $row with BG color of purple;
  }
  }
 
  HTH
  -Brad
 
  Patrick Lebon wrote:
 
   Is there a mysql or array variable for the current row of a query array?
   I want to alternate background colours for each row of the query output so i
   need to know the current row number.
  
   Thanks
  
   --
   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] Re: password function

2002-09-24 Thread Adam Royle

When using aggregate functions in sql, it is good to name that expression
using the AS keyword.

Try this:

$result = mysql_query(select password(.$_POST['password'].) AS pword);
while ($p = mysql_fetch_array($result, MYSQL_ASSOC)){
$pswrd=$p['pword'];
}


Also, like David said, you should also have exception handlers (need not be
advanced). If you're like me and hate having to type too much, chuck your db
stuff in a function. A very simple one would be doing this (this is not
tested, by the way):

function query($sql){
return mysql_query($sql) or die(Error: . mysql_error());
}

Then to call it, simply

$sql = select password(.$_POST['password'].) AS pword;
$result = query($sql);

Adam


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




Re: [PHP-DB] Mysql vs postgresql

2002-09-24 Thread Adam Alkins

 Hi peoples,

 The company I'm about to partner with for hosting my websites is using
 postgresql for their database server.  I currently use mysql for all of
 mine.

 What I'm trying to find out is peoples experiences using postgresql, any
 plusses or minusses, is it worth using these guys or finding another
company
 that will use mysql instead?

 Most of the sites are being rewritten at the moment anyway so changing the
 code isn't really a factor for me.

 Thanks in advance,

 -gav.

This comparation is a bit old but I think a lot still applies

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

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



Re: [PHP-DB] to determine how much server space left on the webserver?

2002-09-17 Thread Adam Williams

?php

exec(df -h);

?

On Tue, 17 Sep 2002, Bo wrote:

 Any ideas of how to write a php script to determine the disk space left in
 my account at my web server?






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




Re: [PHP-DB] to determine how much server space left on the webserver?

2002-09-17 Thread Adam Williams

actually make that system(df -h);



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




Re: [PHP-DB] Re: onnecting to MSSQL database from Linux?

2002-09-17 Thread Adam Williams

He's using microsoft sql server, not mysql.

try --with-mssql

maybe?
Adam

On Wed, 18 Sep 2002, Jason Morehouse wrote:

 It means you haven't compiled mysql support into php.  Recompile it using
 --with-mysql

 --

 Jason Morehouse (jm[@]netconcepts[.]com)
 Auckland, New Zealand

 Linux: Because rebooting is for adding hardware.

 On Tue, 17 Sep 2002 15:30:29 +, Avi Schwartz wrote:

  I have PHP4 and freetds installed and I am trying to connect to a mssql
  server.  The problem I am having is that the mssql_connect() call generates
  the following error:
 
  Fatal error: Call to undefined function: mssql_connect()
 
  Is there something I need to require?
 
  Thanks,
  Avi





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




Re: [PHP-DB] php start-stop howto?

2002-09-12 Thread Adam Williams

look in /etc/httpd/conf/httpd.conf

when you restart apache (/etc/rc.d/init.d/httpd restart) it restarts php
because php is called by apache.

Adam

On Thu, 12 Sep 2002, Warren Massengill wrote:

 RedHat Linux 7.2 RPM installation included:
 PostgreSQL 7.1.3
 PHP 4.0.6

 Had no problem creating a database using pg but can't find the on/off button
 for php.

 PHP is installed in /usr/bin/php; /etc/php.ini; /usr/share/php

 I edited the php.ini file to specify a location for;
 usr_dir =

 The manual for PHP 4.2 (I have 4.0) suggested uncommenting  extra module
 lines in http.conf. I don't know if that is an Apache, Linux or PHP file,
 but I can't find it in any of them.

 If I just start typing the hello world script linux wants to execute it
 after the first line. Put the entire script in an executable file and it
 doesn't like that either.

 What do I do next?

 Thanks,
 Warren



 _
 MSN Photos is the easiest way to share and print your photos:
 http://photos.msn.com/support/worldwide.aspx





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




[PHP-DB] Re: assist with SORT array

2002-09-10 Thread Adam Royle

Bartosz was correct in saying that you should use your query to sort, 
rather than sorting array. And the array is actually sorted, although 
it keeps its index. See the manual reference on arrays to see how they 
work. To iterate over sorted arrays, use the foreach() construct.

Anyway, the better way to do it (using only 1 sql query), would be 
using the following code.

$rest_IDs = implode(',', $restaurants);
$sql = SELECT name FROM restaurants WHERE id IN ('$rest_IDs') ORDER BY 
name;
$result = mysql_query($sql) or die($sql . mysql_error());
while($row=mysql_fetch_object($result)) {
  $rest_array[] = ucwords(stripslashes($row-name));
}



And its sorted!!! If you want to check what values an array holds, use 
a combination of header(Content-Type: text/plain); and 
print_r($rest_array);

Have fun!

Adam


 I  have a head scratcher.. prob just a glitch on my side, but somehow 
 I am confused with the results.

 I have a php script pulling from a mysql database for id/names which 
 is getting choices through a check box form. All of that works just 
 fine, but I wanted to display the results sorted by title. My snippet 
 of code is:

 // $restaurants = array() of ids back from form
 for($i=0;$isizeof($restaurants);$i++) {
 $rest_id = $restaurants[$i];
 $sql=select name from restaurants where id=$rest_id;
 $result=mysql_query($sql) or die($sql . mysql_error());
 while($row=mysql_fetch_object($result)) {
 $rest_name .= ucwords(stripslashes($row-name)) . ;;
 }
 }
 $rest_array=explode(;,$rest_name);

 $rest_sort=sort($rest_array); // -- the problem line

 die(checking: $rest_namebrbr size = .sizeof($rest_array) 
 .  sorted:  . sizeof($rest_sort));

 the results come back with 6 in the $rest_array but only 1 in the 
 $rest_sort array! How is that??

   checking: Hi-Ho Tavern;Village Inn;Speak Easy;Duane's House Of 
 Pizza;Atomic Coffee;
   size = 6 sorted: 1

 What I am trying to accomplish is an array('Atomic Coffee', 'Duane's 
 House Of Pizza','Hi-Ho Tavern','Speak Easy','Village Inn')

 Help??


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




Re: [PHP-DB] PHP in a javascript function with DB calls.

2002-09-10 Thread Adam Voigt

Umm, the body tag in HTML has an onLoad parameter.
So:

body bgcolor=black onload=javascript:window.new('url');

That code for the window.new is probably wrong, but that will do it.

Adam Voigt
[EMAIL PROTECTED]

On Tue, 2002-09-10 at 11:20, Aaron Wolski wrote:
 Hi All,
 
 I HOPE this is the right place for this.. if not I am sorry!!!
 
 
 
 I'm hoping someone can put me on a clear path of how to do what I am
 asking here.
 
 I Have a shopping cart... and in this shopping cart I want to feature
 some items in a pop_up window when the user is ready to check out - if
 they are not already selected.
 
 For example.. Someone buy a Hockey Stick but don't buy hockey tape..
 
 when when they go to check out.. I want a pop_up to be launched asking
 the user if they want to add Hockey tape to their order for onlu $$$.
 
 For this to happen I need to have an onLoad on the checkout page that
 calls a javascript function that has PHP code to find out IF a
 paritcular product is selected to see if the other has been selected
 too, if it's NOT selected then launch the pop_up.
 
 Does ANYONE have any idea's as to how this can be accomplished??
 
 Anyhelp is appreciated
 
 thanks all.
 
 Aaron
 



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




Re: [PHP-DB] Apache 2.X and PHP

2002-09-07 Thread Adam Williams

Yes but support is experimental so you may notice strange behavior.

Adam

On Sat, 7 Sep 2002 [EMAIL PROTECTED] wrote:

 Is it possible to run Apache 2.X with PHP?



 Julio Cuz, Jr.

 [EMAIL PROTECTED]

 Information Services

 Riverside Community College

 mailto:[EMAIL PROTECTED]






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




Re: [PHP-DB] PHP Editor?

2002-09-06 Thread Adam Williams

1:

http://quanta.sourceforge.net/

2:

yes

Adam
On Fri, 6 Sep 2002, Bryan McLemore wrote:

 First off, What html/php editor do you guys think is better?

 Secondly, perhaps a little more relevant to the database part of this.  I just want 
to clarify that with mysql_query() I can send any valid sql expression and it will do 
that?

 -Bryan



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




Re: [PHP-DB] SQL Query

2002-09-06 Thread Adam Williams

id INT NOT NULL AUTO_INCREMENT PRIMARY KEY

Adam

On Sat, 7 Sep 2002, Bryan McLemore wrote:

 Hi Guys I have written this SQL Query :

 CREATE TABLE tasks (id INT AUTO_INCREMENT, name VARCHAR(50), desc TEXT, address 
VARCHAR(50), startDate DATE, lastWork DATE, progress INT(3))

 I'm sending it in through php and I can't get it to work correctly.  Please help.  
Also, I would like to make id the primary key/index

 -Bryan



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




[PHP-DB] Re: [mysql] freeing resources

2002-09-02 Thread Adam Royle

Yes, PHP is very cool, and handles memory management for you.

mySQL resultsets and connections are cleaned up once the page has finished executing 
(is in manual).

The reason why you would want to use these functions is if you have a script that does 
not finish (such as one that handles port access from the command line).

Adam



Re: [PHP-DB] Script to control mysql users?

2002-08-29 Thread Adam Williams

read mysql.com's documentation on the GRANT command.  Or install
phpmyadmin and use that.

Adam

On Thu, 29 Aug 2002, Leif K-Brooks wrote:

 I need to add mysql users to some databases, but my dumb control panel
 (ensim) doesn't seem to have a feature to do that, and I'm nothing in
 the mysql database.  Does anyone have a script to let me add them
 automaticly if I supply it with the root password?





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




Re: [PHP-DB] This is driving me insane!

2002-08-29 Thread Adam Williams

restart apache

Adam

On Thu, 29 Aug 2002, James Hatridge wrote:

 HI all...

 I'm at my end, would some kind soul please help? I'm working on a database
 using SuSE 8.0, mysql, and PHP. All the standard installs.

 I need to use exec, unlink, etc. BUT the durn PHP is stuck in safe_mode and
 I can't get it out. I've looked in /etc/php.ini and it shows safe_mode as
 off, but when I use phpinfo() it is show on.

 Can anyone help?

 Thanks

 JIM






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




Re: [PHP-DB] how to hide source code??

2002-08-29 Thread Adam Williams

set you to owner of the script and then chmod 700 it

Adam

On Thu, 29 Aug 2002, Smita Manohar wrote:

 hii
 im using php script with mysql. i want to hide the script from the admin or
 from the person who has privileges to access all the data. bcos i use ftp to
 upload the files. and i don't want anyone should be able to view the source.

 is it possible to do so?

 thnx and regds,
 smita.



 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com





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




RE: [PHP-DB] how to hide source code??

2002-08-29 Thread Adam Williams

oh yeah duh me, set it 701

Adam

On Thu, 29 Aug 2002, Ryan Jameson (USA) wrote:

 Wouldn't that make php unable to read it as well? Then it is useless as well.
  Ryan

 -Original Message-
 From: Adam Williams [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 29, 2002 1:00 PM
 To: Smita Manohar
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] how to hide source code??


 set you to owner of the script and then chmod 700 it

   Adam

 On Thu, 29 Aug 2002, Smita Manohar wrote:

  hii
  im using php script with mysql. i want to hide the script from the admin or
  from the person who has privileges to access all the data. bcos i use ftp to
  upload the files. and i don't want anyone should be able to view the source.
 
  is it possible to do so?
 
  thnx and regds,
  smita.
 
 
 
  _
  Send and receive Hotmail on your mobile device: http://mobile.msn.com
 
 
 





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




RE: [PHP-DB] how to hide source code??

2002-08-29 Thread Adam Williams

Apache can execute a file without reading it.  Don't believe me?  Make a
file 701 and then open it in apache.

Adam

On 29 Aug 2002, Mateus Cordeiro Inssa wrote:

 Em Qui, 2002-08-29 às 16:05, Adam Williams escreveu:
  oh yeah duh me, set it 701
 
  Adam
 
  On Thu, 29 Aug 2002, Ryan Jameson (USA) wrote:
 
   Wouldn't that make php unable to read it as well? Then it is useless as well.

   Oh, please, setting x bit will permit what ? PHP has to READ the
 file to execute it.

   And, if the admin has root privileges, what you can do to prevent him
 to view the file (a plain text php file) ?

   One simple thing to do is to make the source so difficult to
 understand that people would consider it unreadable. I think the right
 term is to obfuscate the code. There is programs to do this to C, Perl,
 Tcl, etc., but I don't know if there is one for PHP.

   Encryption is not enough because PHP would need to decrypt it.

   Hmm, and if you make a PHP module (binary) and use its functions from
 the PHP plain text file ?




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




RE: [PHP-DB] how to hide source code??

2002-08-29 Thread Adam Williams

I encourage you to create a file whatever.html and set it 701 and then
look at it with a browsing by connecting to your webserver.

http://server.com/~user/whatever.html will be displayed even though it is
701.  I've done it many times.

Adam

On 29 Aug 2002, Mateus Cordeiro Inssa wrote:

 Em Qui, 2002-08-29 às 17:48, Adam Williams escreveu:
  Apache can execute a file without reading it.  Don't believe me?  Make a
  file 701 and then open it in apache.

   Oh, yes, so can apache bypass the kernel ? I don't think so, unless it
 is running as root  or the file gets owned by the same user apache
 runs.

   The x bit means the O.S. will try to execute that file. Your
 argument it's like to say setting the x bit in .doc documents permit
 or not its reading.

   The x could do something usefull to cgi's, they are really executed
 (by execve system call).




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




Re: [PHP-DB] AUTO_INCREMENT problemos

2002-08-27 Thread Adam Williams

Thats how its supposed to work.  It won't reuse old numbers even after you
delete the entire row.

Adam

On Tue, 27 Aug 2002, simon wrote:

 Hi

 Wondering if anybody can help with this:

 My table has an INT column named 'member_id' which is set to AUTO_INCREMENT.
 It works very well but I have inserted and deleted some test rows during the
 development stage and now my incremented numbers have jumped ahead.
 The deleted rows (their member_id values) have not been forgotten it seems
 and the DB is using them still to evaluate the next number.

 Any ideas?

 Simon






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




Re: [PHP-DB] Create database

2002-08-27 Thread Adam Williams

?php
$conn = mysql_connect(localhost,username,password) or die(Couldn't
connect to mysql);

$query = (CREATE DATABASE db_name);

if (mysql_query($query))
{
echo pThe database was created successfully/p;
}
else
{
echo pThe database was not created .mysql_error()./p;
}
?

If it still gives you the same error, try connecting to mysql from the
console with mysql -u user -ppasswd

Adam

On Tue, 5 Aug 2003, Russell Griechen wrote:

 Newbie here,
 With PhpMyAdmin, What is the syntax for create database?

 I have:

 $link = mysql_pconnect(hostname, username, password)
 or exit(Could not connect);

 if (mysql_create_db(Sportsmen)) {
 print (Database created successfully\n);
 } else {
 printf (Error creating database: %s\n, mysql_error ());
 }
   /*error
 Error
 MySQL said:


 You have an error in your SQL syntax near '$link =
 mysql_pconnect(\64.177.44.120\, \russgri\, \sportsme\)
 or' at line 1

 Russell Griechen





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




Re: [PHP-DB] login won't work for Internet Explorer

2002-08-27 Thread Adam Williams

View the source in mozilla, it might just be suppressing the output
for whatever reason.

Adam

On Wed, 28 Aug 2002 [EMAIL PROTECTED] wrote:



 Hi there,

 I am experiencing a peculiar problem. I have recently moved a PHP / MySQL driven
 website I have been developing from my linux box on to a live host. Everything
 seemed to go smoothly apart from one peculiar problem. When I access the site
 using Internet Explorer (so far I have tried 5.0 and 5.5), I am unable to log
 into the members' section of the site. Instead I receive the following error:

 Warning: Unable to jump to row 0 on MySQL result index 2 in
 [pathdir]/member_login_check.php on line 12

 Warning: Unable to jump to row 0 on MySQL result index 2 in
 [pathdir]/member_login_check.php on line 13

 Warning: Unable to jump to row 0 on MySQL result index 2 in
 [pathdir]/member_login_check.php on line 14

 The peculiarity is that when I log in using Mozilla, I have no problem. Why
 should the choice of browser have any effect on a set of processes which are all
 server-side? Or am I completely wrong about that? All suggestions and help
 appreciated.

 Thanks, Ben







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




Re: [PHP-DB] connectivity problem

2002-08-27 Thread Adam Williams

look at http://www.php.net/manual/en/function.pg-connect.php

do you have postgresql starting with the -i paramater so that it is
listening on a TCP port?  PHP needs this to be able to connect to
postgresql.

Adam

On Tue, 27 Aug 2002, Brian Noecker wrote:

 Hey everyone, got a problem here.  I'm using php4.2.1, postgres 7.2.  I'm
 trying to do a simple database connect with the following small php script:
 --
 htmlheadtitlePHP Test/title/head
 body
 ?php

 //connect to postgres database
 $conn=pg_connect(user=bnoecker dbname=brian);

 //see if our connection was successful
 if ($conn==false) {
 //connection failed - exit the page with an error
 echo pg_errormessage($conn);
 exit;
 }
 else if($conn) {
 echo I did it;
 }
 $sql=SELECT * FROM employee;
 $sql_result=pg_exec($conn.$sql) or die (Couldn't Execute Query.);
 

 I can manually run the SELECT * FROM employee string and get results with
 user bnoecker.  I've granted all to bnoecker and as well added the postgres
 admin to the user=.  In test, no password has been assigned.  I do not get a
 connection failed message, in fact I do the the I did it message.  I do
 however get the following as it tries to do the query:

 I did it
 Warning: pg_exec() query failed: ERROR: parser: parse error at or near
 resource in /home/bnoecker/public_html/hello.php on line 19
 Couldn't Execute Query.
 Now, others use the same postgres instance with other databases from php
 scripts without issue, mostly using includes.  Can someone show me what I
 may be overlooking.  I'm new to php but I found examples where things are
 basically layed out like what I've got?

 Thanks,
 Brian




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




Re: [PHP-DB] connectivity problem

2002-08-27 Thread Adam Williams

In your connect statement, you aren't selecting a password and TCP port to
connect to.  You made need to specify those.

Adam

On Tue, 27 Aug 2002, Brian Noecker wrote:

 Hey everyone, got a problem here.  I'm using php4.2.1, postgres 7.2.  I'm
 trying to do a simple database connect with the following small php script:
 --
 htmlheadtitlePHP Test/title/head
 body
 ?php

 //connect to postgres database
 $conn=pg_connect(user=bnoecker dbname=brian);

 //see if our connection was successful
 if ($conn==false) {
 //connection failed - exit the page with an error
 echo pg_errormessage($conn);
 exit;
 }
 else if($conn) {
 echo I did it;
 }
 $sql=SELECT * FROM employee;
 $sql_result=pg_exec($conn.$sql) or die (Couldn't Execute Query.);
 

 I can manually run the SELECT * FROM employee string and get results with
 user bnoecker.  I've granted all to bnoecker and as well added the postgres
 admin to the user=.  In test, no password has been assigned.  I do not get a
 connection failed message, in fact I do the the I did it message.  I do
 however get the following as it tries to do the query:

 I did it
 Warning: pg_exec() query failed: ERROR: parser: parse error at or near
 resource in /home/bnoecker/public_html/hello.php on line 19
 Couldn't Execute Query.
 Now, others use the same postgres instance with other databases from php
 scripts without issue, mostly using includes.  Can someone show me what I
 may be overlooking.  I'm new to php but I found examples where things are
 basically layed out like what I've got?

 Thanks,
 Brian




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




[PHP-DB] is the following query legal?

2002-08-26 Thread Adam Williams

I have an informix database with a table called phptesttable.  It has a
SERIAL field (for mysql users that can help, its the same as INT NOT NULL
PRIMARY KEY AUTO_INCREMENT) and a CHAR field (CHAR in Informix is the
same as VARCHAR in mysql).

In my PHP script if I submit an array and then insert all the data by
looping through with for loop to INSERT all the data from the array my the
value it inserts is empty.  For example I have:

INSERT INTO phptesttable (textname) VALUES ('$statement[$counter]')

but when I echo $querya it shows:

INSERT INTO phptesttable (textname) VALUES ('')

It should show the value of the $statement[$counter] that I am looping
through.  But as above you can see the value is empty, but when I echo
$statement[$counter] and $counter, they are shown correctly:

the counter is set to 1
the statement is testing this field

So it should echo INSERT INTO phptesttable (textname) VALUES ('testing
this field' but obviously it is not.

When I change the query to not use an array and only insert one variable:

INSERT INTO phptesttable (textname) VALUES ('$statement')

it echos and inserts correctly.  So my question is, is it legal to loop
through an array and insert the array $statement[$counter]?  I am at a
loss as to what is happening, because if I change the form to submit one
variable instead of an array, it works fine.  Any idea as to what is
happening?

Adam




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




Re: [PHP-DB] is the following query legal?

2002-08-26 Thread Adam Williams

I got it to work.  I have to put the statement in ifx_prepare right before
I call it in the loop.  I think its because when I define the statement at
the start of the code, $statement[$counter] has not been asigned yet so it
sets its value to nothing.

Adam


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




Re: [PHP-DB] How do I submit data AND send user to other page?

2002-08-26 Thread Adam Williams

use an HTML form.

Adam


On Mon, 26 Aug 2002, Gerd Ulrich wrote:

 Hello, I want to build a questionaire where the user is guided through five
 pages of questions. How can I program PHP that the user gets to the second
 page after pushing the Submit-Button?
 My solution printed here doesn't work.
 Any hints are greatly apreciated!

 S. Maier

 ?php
 if ($submit) {
  // process form
 require ('.htmypasswd');
 $verbnr = mysql_connect ($dbhost,$dbuser,$dbpasswd);
 $db = mysql_connect($dbhost,$dbuser,$dbpasswd);
 mysql_select_db(pretest,$db);
 $sql = INSERT INTO frage3 (a1,a2,a3,be_fe01,be_fe02) VALUES
 ('$a1','$a2','$a3','$be_fe01','$be_fe02');
 $result = mysql_query($sql);
 header (Location: http://www.example.com;);
 exit;
 } else{
   // display form
 ?






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




Re: [PHP-DB] full text search and how to underline keyword in results

2002-08-25 Thread Adam Royle

The first argument passed to eregi_replace is

 .$keywords[$i]. 

You are concatenating the string and a space on the end and front. This was
obviously used as a hack to make sure only full words were highlighted. A
fix for this? A simple hack would be to take out the spaces, so it is simply
$keywords[$i], although you could figure out a proper regex if you don't
want partial words higlighted.

Adam


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




[PHP-DB] Re: Date Subtraction

2002-08-21 Thread Adam Royle

Use getdate() with mktime() and this is your solution.

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

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

Adam



Re: [PHP-DB] default value for date.

2002-08-19 Thread Adam Williams

set a default value that isn't possible (like -99-99 99:99:99) and
then have an if statement saying if ( $row[date] == '-99-99 99:99:99'
) { $row[date] = '';}

Adam

On Mon, 19 Aug 2002, Smita Manohar wrote:

 i'm using php with mysql. some tables in database have date fields for which
 i have not set any default value. while displaying the values from tables,
 if any record has null value for date field then it displays 0-00-00.
 what i need to do to display null value or spaces instead of zeros.

 suggestions are welcome.

 thnx and regds,
 smita.



 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com





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




Re: [PHP-DB] Return Results in Categories - like CNET

2002-08-16 Thread Adam Williams

If your articles are in an SQL database uses the LIMIT clause on your SQL
statement.

Adam

On Fri, 16 Aug 2002, olinux wrote:

 I would like to allow articles to be searched and
 returned in grouped categories - similar to cnet.com

 See example here:
 http://cnet.search.com/search?timeout=3q=php

 Grouping is not a problem - but it becomes a problem
 when there are thousands of results and I only want to
 display the first few - similar to the way cnet does.

 Thanks much,
 olinux




 __
 Do You Yahoo!?
 HotJobs - Search Thousands of New Jobs
 http://www.hotjobs.com




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




Re: [PHP-DB] PHP File for adding to database

2002-08-15 Thread Adam Williams

what is the structure of the table that this info will be going into?
Paste me the CREATE TABLE command you used to create it.

Adam

On Thu, 15 Aug 2002, Shoulder to Shoulder Farm wrote:

 Hi all,
 How can I make a PHP4 page that will add information to a MySQL database
 when the person (me) clicks the Submit button. The following fields to
 be added are:

 SKU
 Name
 About
 PriceOZ
 PriceLB

 Thanks all, Taj





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




Re: [PHP-DB] Connecting Linux (PHP) to MS Access database

2002-08-15 Thread Adam Williams

See if this message posted earlier helps you out:

http://marc.theaimsgroup.com/?l=php-dbm=102938139730405w=2

Adam

On 16 Aug 2002, Osman Omar wrote:

 Hi,

 Can I connect/access MS access database from linux ?
 if can, what software/driver that I need?

 Now I'm using iodbc without any success

 thanks







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




<    1   2   3   >