RE: [PHP-DB] PHP 4 to 5 Upgrade Issue

2005-06-23 Thread Gary Every
I need to compare PHP 4 code with PHP 5 interpreter on same machine.

I am following the examples in Adam Trachtenberg's Upgrading to PHP 5
(O'Reilly 2004) listed in Appendix C: Installing PHP 5 Alongside PHP 4
with regard to using virtual hosting and relative ports on Apache httpd.
I have also read the Apache docs online regarding virtual hosting.  And
I cannot get it to work.

I have the following relevant entries in Apache httpd.conf:

Listen 8181
Listen 80

VirtualHost *:80
LoadModule php4_module modules/libphp4.so
DocumentRoot /srv/www/htdocs
/VirtualHost

VirtualHost *:8181
DocumentRoot /srv/www/htdocs
ScriptAlias /* /srv/www/htdocs

Directory /usr/local/php-5.0.4/bin

/Directory
/VirtualHost

When I browse http://localhost:8181/ I always get the root (/index.html)
instead of the alias (/php5/index.php).  Any clues?

tia,
~mark


Mark,
Change your DocumentRoot on *:8181 to:
DocumentRoot /srv/www/htdocs/php5

Your ScriptAlias isn't really affecting that portion of the site. 
Your PHP5 index.php resides in /srv/www/htdocs/php5 directory, right?

G.~





This email and any file transmitted with it may be confidential and is
intended solely for the use of the individual or entity to whom it is
addressed.  If you received this email in error please notify the DBM
Service Desk by forwarding this message to [EMAIL PROTECTED]


This email has been scanned by networkMaryland Antivirus Service for the
presence of computer viruses.

-- 
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] adodb is slow

2005-05-23 Thread Gary Every
You can always strip out the support for the DB's you're not going to
use. This should improve performance some. Also, ADODb is a great
abstraction layer, but we've found that we use less than half of its
fuctionality. It's great that the functionality is there, so you can
pare it down to your needs, but it's really a cure-all when what you
need is an abstraction layer that works for YOUR needs!
 Don't be afraid to try slimming it down, but I'd keep an original copy
somewhere in case you find that your paring knife was a little too
sharp!!
G.~


Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!


-Original Message-
From: Micah Stevens [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 22, 2005 5:35 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] adodb is slow



Any sort of abstraction library is going to be slower than directly
using the 
API.. I don't see how you can get around that. 

-Micah 

On Thursday 19 May 2005 07:01 am, Oriol wrote:
 hi all,
 I'm proud to install adodb library in my framework. I succesfully got 
 it. But, surprise! My scripts became slower than ever! Exactly the 33%

 of the time is spent by adodb So, I know the advantages of this 
 library, and I understand the reason is so slow...but, well, I 
 wondered if somebody has reached a better results with adodb doing 
 something with the library in performance. Well, thanks in advance.

 See you!

-- 
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] What wrong with my Query??

2005-03-25 Thread Gary Every
Actually, your sql syntax is wrong. The SET keyword if for UPDATE not
INSERT 

Use 
$sql = INSERT INTO mfadmin
(id,account,planlimit,name,email,password,lastlogin,datecreated,expiry,l
astip) VALUES
('','$accname_lc','$plans','$yourname','$email','$password','$datetoday'
,'$datetoday','$expirydate','123.123.123.123');


Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!


-Original Message-
From: HarryG [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 24, 2005 11:27 PM
To: php-db@lists.php.net
Subject: [PHP-DB] What wrong with my Query??


What the hell is wrong with this MYSQL query?? PHP keeps giving me the
error message:

You have an error in your SQL syntax. Check the manual that corresponds
to your MySQL server version for the right syntax to use near
'limit=2, name='test1', email='[EMAIL PROTECTED]', password='t 

$query = INSERT INTO mfadmin SET id='', account='$accname_lc',
limit=$plans, name='$yourname', email='$email', password='$password',
lastlogin='$datetoday', datecreated='$datetoday', expiry='$expirydate',
lastip=123.123.123.123;
   
This is my table structure
CREATE TABLE `admin` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `account` varchar(50) NOT NULL default '',
  `limit` int(10) unsigned NOT NULL default '0',
  `name` varchar(50) NOT NULL default '',
  `email` varchar(50) NOT NULL default '',
  `password` varchar(50) NOT NULL default '',
  `lastlogin` varchar(50) NOT NULL default '',
  `datecreated` varchar(50) NOT NULL default '',
  `expiry` varchar(50) NOT NULL default '',
  `lastip` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;

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



RE: [PHP-DB] Help needed

2004-10-04 Thread Gary Every
Check to see if your register_globals is set to off in php.ini. If so
(likely, since it defaults to that value) you'll need to access your
POST and GET variables like this:
GET vars:
$var = $_GET['var'];

POST vars:
$var = $_POST['var'];



Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!


-Original Message-
From: Manoj Japher [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 04, 2004 9:29 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Help needed


hi,
 I am new to PHP and I am not sure if this is the right forum.

 I am trying to run PHP thro webmin using CGI scripts. PHP runs fine
except that when I am trying to read variables coming thro' a form after
hitting the submit button, I get NULL values.

 I can read and write to the database without any trouble. The problem
is reading the form values.

Any help would be greatly appreciated.

Many Thanks,

Manoj


Life,it is not a problem to be solved, but 
a process to be managed.

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



RE: [PHP-DB] PHP 5 Error Handling

2004-09-15 Thread Gary Every
Good question. I've tried the __LINE__ and __FILE__ in my
error-handling, but it does the same thing you're experiencing, getting
the line in the function/method as opposed to the actual error line. The
only way I've gone around it is whenever there may be an exception, such
as a sql statement, etc I assign $line_no = __LINE__ and if an exception
gets thrown, the $line_no is captured, and I can use the info to print
to the logs or the screen or ... 

G.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!


-Original Message-
From: Joseph Crawford [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 14, 2004 5:55 AM
To: [PHP-DB] Mailing List
Subject: [PHP-DB] PHP 5 Error Handling


Guys,

i have been working with custom exception classes that extend the
general exception.  Here is some code i have

   public function command($cmd) {
   if($cmd) {
   $res = fputs($this-connection, $cmd);
   $this-response = fgets($this-connection, 128);
   switch($this-getCode()) {
   case 500:
   throw new CommandException($cmd);
   break;
   }
   }
   }

   public function selectGroup($group) {
   $this-group = $group;
   if(substr($this-response,0,3) == 200) {

   THIS IS THE LINE THAT THROWS THE ERROR
   $this-command(NoSuchCommand\n);

   $this-response = fgets($this-connection, 1024);
   }
   $info = split( , $this-response);

   $this-first = $info[2];
   $this-last = $info[3];
   }

now when the error is thrown and i do $e-getLine(); it shows the line
of the file where the throw statement is.  Is there a way to make it
show the actual line number of the line that is the error? the
$this-command(NoSuchCommand\n); line.

-- 
Joseph Crawford Jr.
Codebowl Solutions
[EMAIL PROTECTED]
802-558-5247

For a GMail account
contact me OFF-LIST

-- 
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] Please help

2004-09-08 Thread Gary Every
What exactly is in the $sql and $sql_ext??

Try to put it into a variable so you can print out what you're sending
to the DB

Such as:
$query = $sql .   . $sql_ext .  limit 0,1;
Echo $query . BR;

If your $sql and $sql_ext combine to make a valid sql query, the   is
just putting a space inside the query, and it is valid

Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!


-Original Message-
From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 08, 2004 2:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Please help


I'm using a product called dbqwiksite pro.  PHP
generator for PHP - MySQL 

The code seems to be working fine except in my search
page where I receive an invalid query

$result = mysql_query($sql .   . $sql_ext .  limit
0,1)
or die(Invalid query);

This is the place I where the code is taking the die
path.
I'm guessing something belongs between the quotation
marks , just not sure.

Anyone ?

Thank you
Stuart

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

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



RE: [PHP-DB] Search page

2004-09-08 Thread Gary Every




K, first off I'm brand new to PHP and databases.  So I
hope my question isn't stupid or unfitting to the
list.  

Welcome! Only those that don't ask are unfitting


I am creating a search and results page of, right
now 3 fields with more to add. 
Perhaps not necessary to my question, I have created a
working SQL statement which involved one main
transactional table and a number of joins to static
tables where the id codes inserted into the main table
are referenced.  All is fine.  
I thought I could use AND / OR statements, but both
don't allow for any number of fields unusued or force
a return if the first condition is met.  I have a
variable in the SQL statment , like LocationCity =
'resset1', LocationState = 'resset2', etc.

Just sure how to get the code to see if it was passed
a value or not.  Also to treat each field
independently, so if the user leaves the first 2
unchanged , and only enters the 3rd it will search for
that particular condition.  

Try this, which is assuming that you are sending variables through POST
// Start the query off right
$query = Select * FROM table_name WHERE (;

Foreach($_POST as $key-$value) {
if($value != '') {
// Add the query part
$query_frag .=  $key = '$value' AND ;
}
}

// Now you have something that looks like
// $query_frag =  first_var = 'Value1' AND second_var = 'Value2' AND
third_var = 'Value3' AND 

// Get rid of that last AND, plus close out your parentheses
$query_frag_trimmed = rtrim($query_frag,AND ) . ')';

// Now $query_frag_trimmed =  first_var = 'Value1' AND second_var =
'Value2' AND third_var = 'Value3'
// If you want to limit your query, tack on a limit clause on the end
$offset = 0;
$rows = 50;
$query_frag_trimmed .=  LIMIT $offset,$rows;

// Now put it all together
$completed_query = $query . $query_frag_trimmed;

// You've got:
// $completed_query = Select * FROM table_name WHERE ( first_var =
'Value1' AND second_var = 'Value2' AND third_var = 'Value3') LIMIT
0,50;

// And send that to mysql




Also I should mention, that when the Search form comes
up, all the drop down menus say Please Select, that
label actually has a value, which I assume is common. 
Regardless on submit that value is going.   

I was looking at the following code but the !='' tells
me that it's looking for an empty string.  So if my
dead Please Select value is sent , do I need to put
the value in there, i.e. !='XXX' ?

?php
if (isset($HTTP_GET_VARS['states'])  $HTTP_GET_VARS['states']!=''){
  if (!isset($isNotFirst) OR $isNotFirst==false){
   $isNotfirst = true;
   $KT_search = '1=1 AND ';
  }else{
   $KT_search .=' AND ';
  }
  $KT_search .='LocationState = \''.$HTTP_GET_VARS['states'].'\' '; } ?

Well I hope I don't get flamed since I'm obviously
clueless and seeking some advice when perhaps I should
be finding it on my own. 

Thank you ,
Stuart

-- 
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] Text area

2004-08-24 Thread Gary Every
You need to add slashes to your return:

Return input type=textarea rows=\5\ cols=\70\ name=\\;

Or use single quotes:
Return 'input type=textarea rows=5 cols=70 name=';

Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!


-Original Message-
From: Hafidz Abdullah [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 24, 2004 3:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Text area


Hi again, everyone.

I also have a problem creating my text area.  I meant to do a text area
(measuring 5 rows by 70 columns) which accompanies the words: First 50
words are free. Subsequent 50 words or part thereof, $50 will be
charged:

function write_textarea()
 {
  return input type=textarea rows=5 cols=70 name=;
 }
 
Doesn't work. How can I make it work?

Thanks  regards,
Hafidz

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



RE: [PHP-DB] Re: LAMP

2004-08-03 Thread Gary Every
The answer to that is SPEED. Nothing short of Oracle comes even
close


Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!


-Original Message-
From: Lester Caine [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 03, 2004 1:15 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: LAMP


Gavin Amm wrote:

 I'd really like to find a Linux distro that is a LAMP system right out

 of the box. (Linux, Apache, MySQL, PHP)
 Are there any out there?

Thankfully not ;)
I want LAFP but LAPP seems still to be more popular on Linux.

WHY does everybody run lemming like after MySQL. It STILL has to catch 
up with the better FREE database engines ;)

-- 
Lester Caine
-
L.S.Caine Electronic Services

-- 
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] Turning off Save Password

2004-07-01 Thread Gary Every
I'm trying to turn off the save password function so that I can do an
auth page that refuses to save passwords on the client side. I've tried
some JS but it works only in IE, not Netscape.
So, I'm looking for a server-side solution to this.

Any ideas?



Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

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



RE: [PHP-DB] Turning off Save Password

2004-07-01 Thread Gary Every
Fixed my own problem.

Within the tag, you can use autocomplete=off
To turn off the prompting or the autocompletion of any field. Apologize
for this off-topic post, but I was searching for a non-javascript
server-side solution


Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!


-Original Message-
From: Gary Every 
Sent: Thursday, July 01, 2004 8:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Turning off Save Password


I'm trying to turn off the save password function so that I can do an
auth page that refuses to save passwords on the client side. I've tried
some JS but it works only in IE, not Netscape. So, I'm looking for a
server-side solution to this.

Any ideas?



Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

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

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



RE: [PHP-DB] Re: [PHP] update count

2004-06-16 Thread Gary Every
If you aren't using a unique key, you can always use LIMIT 1 at the
end of your query, but unless your ORDERing correctly to get the exact
data row you want to update, this can have unexpected results.



Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: Bob Lockie [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 16, 2004 9:21 AM
To: PHP-DB Mailing List
Subject: [PHP-DB] Re: [PHP] update count

On 06/16/04 09:53 John Nichel spoke:
 Bob Lockie wrote:
 
 What is the best way to only do an update if it going to update only 
 one row?
 I want to protect my code so that it won't accidentally update more 
 than one row.
 I can do a select first but there must be an easier way. :-)

 
 UPDATE thisDB.thisTable SET thisTable.thisColumn = 'thisValue' WHERE 
 thisTable.uniqueColumn = 'someUniqueValue'

Ok, a primary key is unique, right?

-- 
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] Sample Code

2004-06-15 Thread Gary Every
Here's a quick and easy one though:

SELECT * from your_table WHERE your_date_field BETWEEN '2004-06-01' AND
'2004-06-15';


Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: Mike Koponick [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 15, 2004 11:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Sample Code

Hello all,

I was wondering if anyone had some sample code that I could use for a
small project.

What I would like to do is select data in a date field, like:

From: 6-1-04
To: 6-15-04

Then output to a text file. I have other selections within this data
that I will make, and I think can figure out. The part I'm having
trouble with is exporting the data and selecting between two dates.

I'm running PHP4 and MySQL 4.1.

Thank in advance for your help.

Mike

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

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



RE: [PHP-DB] Re: datetime update

2004-06-10 Thread Gary Every
Actually it would be:
UPDATE table SET dateTime=NOW() WHERE record_id='$the_one_you_want';

Or
INSERT INTO table (record_id,dateTime) VALUES
('$the_one_you_want',NOW());


Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 10, 2004 4:10 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: datetime update

Hi all,

i have a datetime field in a mysql database and it's defined with a
default
of '-00-00 00:00:00:'

now, when i add a record to the database, i want to fill that field
with the date and current time.

can anyone point me ?

Via PHP:
$dateTime = date('Y-m-d H:i:s');
mysql_query(INSERT INTO table SET dateTime = '$dateTime');

Via MySQL:
mysql_query(INSERT INTO table SET dateTime = NOW());

Take a look here for other useful MySQL date and time functions:
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html

Hope it helps. Regards,

Torsten Roehr

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

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



RE: [PHP-DB] Re: automatic call reference creation

2004-06-10 Thread Gary Every
Here's what you can do:

1. CREATE your table with an autoincrement column as well as a date
column.

2. When the customer service rep logs the call, they click on the submit
button, which will place the data into the DB

3. Right after you do the insert, (in PHP) do:
$suffix = mysql_insert_id($Resource_id);

4. $padded_suffix = str_pad($suffix, 5, 0, STR_PAD_LEFT); // This will

// pad the $suffix with 0's (up to five characters)

5. $dat = dat(Y-m-d);

6. $callcode = $dat . $padded_suffix;

7. // Show them the call code
echo Your call code is $callcode;

You don't need to store the call code, since you can recreate it using
the autoincrement, the date field, and str_pad. Of course, if space is
not an issue, you could always store the concatenated string into
another column.



Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: pete M [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 10, 2004 5:59 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: automatic call reference creation

using the autoincrement you'd have to create the entry first !

otherwise your gonna have problems with concurrent users

Gawie Marais wrote:

 thanx for the replys guys... basically i need a PHP formula to
generate a
 'call refenrence code' that is unique to give out to clients whenever
they
 log a call. this unique 'call reference code should be inserted into a
mysql
 field within a table.
 
 all i need is a formula to get the last entered code and increment it
by
 one - the intended code should be forumated by php by using the
current date
 i.e. 20040101 + a numerical value i.e. 001 for the first 'call
reference
 code' for the day. when the next call is logged, the next unique
available
 numerical should be assigned and combined with the date to form the
call
 reference number.
 
 hope this makes it a bit clearer.
 
 
 
 
 Pete M [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
not sure what u want here but
have you looked at the identiry field ??
its called auto_increment in mysql and this gives it record in a
database a unique number

eg
Insert into table (date_call)values(now() )

then after the insert do
select last_insert_id()

pedro

Gawie Marais wrote:

hi all,

i need to create an automatic call reference. i though it would work
 
 using
 
the date as ccyymmdd and by adding a '001', '002', etc to the end.

now, i know how to format the date but how would i increment the 001,
 
 002 at
 
the end... ? i understand that i would have to check back to the
 
 database to
 
check the last one used. but how... ?

alternatively is to just generate a random number, check it against
the
database to see if it's not already used. if not use it. if its used
already, just create another one... ?

OR

do you guys have any laternative suggestions ?


Regards,

Gawie.

-- 
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] Display mysql query results divided in dynamic numbered pages

2004-05-20 Thread Gary Every
Look at:
http://www.phpclasses.org/browse/package/92.html

It's a pager class that does:
 Previous 1 2 3 4 5 6 7 8 9 10 Next 



Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: Kpromos [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 20, 2004 8:35 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Display mysql query results divided in dynamic
numbered pages
Importance: High

Dears, I'm new to php, so I'm not able to solve the following problem. I
have a function with a while loop that generates the results of a mysql
query. I'd need to generate a flow of the results, divided in pages as
... Previous 1 2 3 4 Next ...

The function I'm using follows .. and also the script that should
generate the numbered pages. Someone could help me in incorporating the
script that follows too?

= function displaying the results ==

function display($show_what) {
switch ($show_what) {
case :
$sql = select * from news2 ORDER BY date DESC, time
DESC;
break;
}
display_posts($sql);
}

function display_posts($sql) {
connect();
$result = mysql_query($sql) or die(mysql_error()); 

?
  table width=100% border=0 cellpadding=5 align=CENTER
tr
  td hr align=RIGHT size=1 width=100% noshade /td
/tr
?
while($row = mysql_fetch_array($result)) {
?  trtd ?
if($last_date == $row[date]):?
p class=dateb?echo $row[time]?/b
?else:?
p class=date?echo $row[time]? - b?echo
$row[date]?/b
?endif;
$cat_num = $row[category_id];
$cat_result = mysql_query(select categories.category from
news2, categories where news2.category_id = categories.category_id and
news2.category_id = '$cat_num');
$cat = mysql_fetch_array($cat_result);
?

  br

..
 /tr
?
}
?
  /table
  ?
}

=== script for generating the pages ===

$table = 'news2'; // The name of your table in the database
$limit = '2'; // How many results should be shown at a time
$scroll = '10'; // How many elements to the navigation bar are shown at
a time

// Get the total number of rows in a database
$query1 = mysql_query (SELECT * FROM news2);
$numrows = mysql_num_rows ($query1);
//

if (!isset ($_GET[show])) {
$display = 1; // Change to $NUMROWS if DESCENDING order is
required
} else {
$display = $_GET[show];
}

// Return results from START to LIMIT
$start = (($display * $limit) - $limit);
$query2 = mysql_query (SELECT * FROM $table LIMIT $start,$limit);

while ($myrow = mysql_fetch_array ($query2)) {
echo p.$myrow[ROW]./p; // EDIT TO REFLECT YOUR RESULTS
}
//

$paging = ceil ($numrows / $limit);

// Display the navigation
if ($display  1) {
$previous = $display - 1;
echo a href=\$_SERVER[PHP_SELF]?show=1\ First/a | ;
echo a href=\$_SERVER[PHP_SELF]?show=$previous\
Previous/a | ;

}

if ($numrows != $limit) {
if ($paging  $scroll) {
$first = $_GET[show];
$last = ($scroll - 1) + $_GET[show];
} else {
$first = 1;
$last = $paging;
}
if ($last  $paging ) {
$first = $paging - ($scroll - 1);
$last = $paging;
}
for ($i = $first;$i = $last;$i++){
if ($display == $i) {
echo b$i/b ;
} else {
echo a
href=\$_SERVER[PHP_SELF]?show=$i\$i/a ;
}
}
}

if ($display  $paging) {
$next = $display + 1;
echo | a href=\$_SERVER[PHP_SELF]?show=$next\Next /a |
;
echo a href=\$_SERVER[PHP_SELF]?show=$numrows\Last /a;
}
//
?

Thanks for all,
Alessandro Folghera

-- 
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] Testing - no emails since 11:45 AM 3/23/04

2004-03-23 Thread Gary Every
Testing, have received no emails since 11:45

Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

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



RE: [PHP-DB] Re: How to simplify DB creation?

2004-03-23 Thread Gary Every
Hans Lellelid offered this bit:

After a long period of quite intense development, the Propel team is pleased to 
announce the release of Propel 1.0.0-alpha1.

Propel is an object persistence layer for PHP5 based on Apache Torque. In practical 
terms, Propel allows you to use objects instead of SQL to read and write rows in your 
database tables. Propel provides (1) a generator that creates SQL definition files 
(DDL) and PHP classes for your datamodel, and (2) a runtime engine that transparently 
handles object persistence and retrieval. Propel makes it easy to customize generated 
classes; additionally, the use of XML, PHP classes, and the Phing build tool make it 
easy to integrate Propel with an existing application framework.

Visit http://propel.phpdb.org to learn more about Propel.

Some of Propel's features include:

   * Use of simple XML schema for datamodel definition
   * Generation of PEAR-style compliant, phpdoc commented, PHP5 classes.
   * Easy to customize object model ( changes won't get overwritten).
   * Generation of SQL definition files (DDL) for your RDBMS
   * Several popular databases supported: MSSQL, MySQL, PostgreSQL, SQLite.
   * Support for reverse-engineering XML schema from database
   * Use Criteria OO query system instead of writing SQL queries
   * Generated methods to easily  efficiently work with (foreign key) relationships

Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: Thierry B. [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 22, 2004 3:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: How to simplify DB creation?

You have also this IDE : http://www.codecharge.com


-- 
Click below to answer / cliquez ci dessous pour me repondre
http://cerbermail.com/?MQkxTL4vUP

Michal Masa [EMAIL PROTECTED] a écrit dans le message de
news:[EMAIL PROTECTED]
 Hi,
 We plan to write a simple DB with app. 10 tables. Are there any tools that
 simplify and automatize the creation of PHP scripts for the database?
 Like automatic generation of PHP scripts that produce HTML input forms,
 generation of value lists, validation, sorting and searching?
 Well documented PHP library could be also useful.

 Regards,
 Mike

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

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



RE: [PHP-DB] output formatting question

2004-03-09 Thread Gary Every
1. Get the result set in an array: $result

Now, do this:

?php
foreach($result as $row) {
  $first = $row['first_name'];
  $last = $row['last_name'];
  $phone = $row['phone'];
/*
 I'm assuming, perhaps incorrectly, that your phone is stored in the
database without any dashes, e.g. 2135551212, which is the most
efficient way. You'll need to assure that the area code is always
entered, though.
*/
echo '
  TRTD' . $first . ' ' . $last . '/td
  TD(' . substr($phone,0,3) . ') ' . substr($phone,3,3) . '-'
. substr($phone,6,4) . '/td/TR';

}

?

That will give you in HTML:
TRTDJohn Smith/TDTD(213) 555-1212/TD/TR


Some other formatting hints for this:

$first = ucfirst(strtolower($first));

will give you John even if the DB has JOHN or john 

Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: redhat [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 09, 2004 9:24 AM
To: phplist
Subject: [PHP-DB] output formatting question

I have a small database of employee names and phone extensions that I
have put together.  I have also put together a very simple php page that
enables endusers to pull up this directory listing.  My question is
simple, the output right now is in one long column (actually, three,
first name, last name, extension) and I would like to break the page
down into two columns (consisting of the three database columns each). 
I am not a php programmer and would appreciate any help.  If there is a
good article out there that someone could point me to that would be
great - that is how I figured out how to do the other.
thanks,
DF

-- 
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] How do you make an IN span multiple tables?

2004-03-04 Thread Gary Every
Select * from table1 t1, table2 t2, table3 t3 
WHERE ((t1.thread_ref IN (1,2,3,4,5,6,7,8,9,10)) or (t2.thread_ref IN
(1,2,3,4,5,6,7,8,9,10)) or (t3.thread_ref IN (1,2,3,4,5,6,7,8,9,10)))

Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: Richard Davey [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 04, 2004 8:36 AM
To: php-db
Subject: [PHP-DB] How do you make an IN span multiple tables?

Hi,

I'm a bit stuck with the following: I need to select data from 3
different tables and want to do it via a SELECT ... IN query. Each
table has a primary key called thread_ref. I would like to do
something like this:

SELECT
  *
FROM
   table1,
   table2,
   table3
WHERE
 thread_ref IN (1,2,3,4,5,6,7,8,9,10)

Now the problem is that MySQL complains about the thread_ref being
ambiguous - which I know that it is. But putting a table name in-front
of it will limit the IN query to that specific table and cause no
results to be returned.

It is possible that not all of the tables will contain all of the
thread_ref's in question.

Does anyone have any ideas or is it just not possible using this
method? I'm not using MySQL 4 otherwise I would have looked at using a
UNION.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
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] Accessing my variables

2004-02-11 Thread Gary Every
You're missing a ' in your include statement, after .php

Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: J. Kevin C. Burton [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 11, 2004 11:29 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Accessing my variables

Hey all.. I am using PHP5 and apache 2.0 on windows xp pro.
 
My problem is: 
 
I have an include file: global.inc.php
Inside that file I have:
 
$myVariable = xankjndckjnskncd;
 
now I have a index.php that has:
 
?
Include('global.inc.php);
Print $myVariable;
?
 
Anyone got a clue on this one?
 
Kevin

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



RE: [PHP-DB] Results with ledger stripes?

2004-01-27 Thread Gary Every
Haven't been following this thread, but here's how we do it:

If($bgc == '') {
$bgc = #DD;
} elseif($bgc == #FF) {
$bgc = #DD;
} else {
$bgc = #FF;
}



Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 26, 2004 12:00 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Results with ledger stripes?

$bg1 = #dd;
$bg2 = #ff;
While ...
$bg3 = $bg2;
$bg2 = $bg1;
$bg1 = $bg3;
echo tr bgcolor='$bg1' 

Makes sense?

 Ryan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 25, 2004 6:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Results with ledger stripes?

Hello all,

I'm in the midst of creating an internet speed test system thingamabob
for my website.  It's basically finished...but ugly as sin.  What I'd
like to do is have the results (an average of each domain tested) listed
in a nice pretty table with alternating background colors, kinda like a
ledger.  How on earth do I do this?

Here's what I've got thus far:

?php
echo Average speeds of each domain tested:br; $mongo = @mysql_query
(SELECT
substring_index(name,'.',-2),ROUND(AVG(speed),1) FROM `readings` GROUP
BY
substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2)
ASC); echo tabletrtdDomain/tdtdAverage Speed/td/tr\n;
while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo
trtd$mongorow[0]/tdtd$mongorow[1]/td/tr\n;}
echo /table;
?

And I'd like it to spit out something along these lines:
table
tr bgcolor=#ddtddomain1.com/tdtd666.6 kbps/td/tr tr
bgcolor=#fftddomain2.com/tdtd3000.0 kbps/td/tr repeat
until done /table

The gizmo is up and running at
http://www.dibcomputers.com/bandwidthmeter/index.php if you care to have
a gander.
Thanks a bunch,
Dan

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

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



RE: [PHP-DB] PHP export to CSV

2003-12-29 Thread Gary Every
You should try this:

Header(Content-Type: text/plain);
Header(Content-Disposition: attachment; filename=file.csv);

Then output the text you want to send. Make sure you double-quote it so that the 
newlines work!
$eol = \n;
echo Field 1,Field 2,$field_variable,$eol

..

This sends a stream of info WHEN THE USER DECIDES what to do with it.

That means if they click cancel, the file is not created, and you have no cleanup

Works great!




-Original Message-
From: John Greco [mailto:[EMAIL PROTECTED]
Sent: Monday, December 22, 2003 9:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP export to CSV


Anyone ever get some code to select from the DB and drop into a CSV file?

-- 
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] CREATE TABLE LIKE, error

2003-12-15 Thread Gary Every
Try:
CREATE table new_table SELECT * from old_table limit 1;

delete from new_table;

This will give you the same structure in both tables, and the deletion will make the 
new_table empty.



-Original Message-
From: Adam i Agnieszka Gasiorowski FNORD [mailto:[EMAIL PROTECTED]
Sent: Monday, December 15, 2003 10:28 AM
To: Lista PHP DB
Subject: [PHP-DB] CREATE TABLE LIKE, error



I cannot use this query

CREATE TABLE table LIKE other_table;

, which is supposed to create an
 empty clone of the other_table named
 table.
Was it added in some later MySQL version?
 It's in the manual on mysql.com, bo no version info
 available.

-- 
Seks, seksi, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne ksztaty... http://www.opera.com 007

-- 
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] Fake BDD

2003-12-02 Thread Gary Every
Check out SQLite

BENARD Jean-philippe wrote:

Hi,

We use ORACLE DataBase for all our projects and we can't install
mysql/postgresql on our server. A new project needs a little database (only
1 table). I heard about something like an API in order to use text files in
place of real database system and that we could use SQL query to return
results. Does someone know this tool and could help us?
Many thanks in advance.

   (o_   BENARD Jean-Philippe - Consultant STERIA Infogérance
(o_   (o_   //\ RENAULT DTSI/ODPS/[EMAIL PROTECTED] * ALO * API : MLB 02C 1 14
(/)_  (\)_  V_/_   2 Av du vieil étang * 78181 MONTIGNY-LE-BRETONNEUX
  Tél : +33 1-30-03-47-83 * Fax : +33 1-30-03-42-10
 

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


Re: [PHP-DB] multiple queries

2003-12-02 Thread Gary Every
Or do the same with the BETWEEN keyword:

SELECT * FROM dates WHERE store='$store' AND date BETWEEN DATE_SUB(now(),
interval 3 day) AND DATE_ADD(now(), interval 3 day)


Richard Davey wrote:

Hello Cameron,

Tuesday, December 2, 2003, 1:08:19 AM, you wrote:

CS $sql = SELECT * from dates where store=$store and date=$date;

CS ultimately I would like to display data for 3 days on either side of
CS this.   

The following is un-tested, but a quick look over the MySQL manual
should firm this up for you:
SELECT * FROM dates WHERE store='$store' AND date  DATE_SUB(now(),
interval 3 day) AND date  DATE_ADD(now(), interval 3 day)
 

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


RE: [PHP-DB] form not working...

2003-11-10 Thread Gary Every
Don't you need to start your form BEFORE your input type's

-Original Message-
From: jas [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 11:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] form not working...


For some reason my form to edit selected items is not working, I think I
need a new set of eyes.
Any help is appreciated...
Jas

// inc.php
function db_retrieve() {
 require 'dbase.inc.php';
 $tble = $_SESSION['table'];
 $show = @mysql_query(SELECT * FROM $tble LIMIT 0, 15,$db)or
die(mysql_error());
   while ($row = @mysql_fetch_array($show)) {
@list($nItemSKU, $bActive, $nUserID, $nItemConfig, $tItemType,
$tDepartment, $blSerialNumber, $nPropertyNumber, $blHostName, $nIPID,
$tRoomNumber, $tNotes) = $row;
 $_SESSION['table'] .= tr class=fntMAINtd valign=top
align=left$nItemSKU/td
 td valign=top align=left$bActive/td
 td valign=top align=left$nUserID/td
 td valign=top align=left$nItemConfig/td
 td valign=top align=left$tItemType/td
 td valign=top align=left$tDepartment/td
 td valign=top align=left$blSerialNumber/td
 td valign=top align=left$nPropertyNumber/td
 td valign=top align=left$blHostName/td
 td valign=top align=left$nIPID/td
 td valign=top align=left$tRoomNumber/td
 td valign=top align=left$tNotes/td
 td valign=top align=leftinput name=edit type=checkbox
value=$blSerialNumber/td
/tr; }
 $_SESSION['number'] = mysql_num_rows($show); }

?php
session_start();
require 'scripts/inc.php';
if ((!isset($_POST['edit'])) or ($_POST = )) {
 $_SESSION['table'] = t_items;
 call_user_func(db_retrieve);
} elseif ((isset($_POST['edit'])) or (!$_POST = )) {
 require 'scripts/dbase.inc.php';
  $tble = $_SESSION['table'];
  $edt = mysql_query(SELECT * FROM $tble WHERE
blSerialNumber=\$edit\,$db)or die(mysql_error());
   while ($row = mysql_fetch_array($edt)) {
list($nItemSKU, $bActive, $nUserID, $nItemConfig, $tItemType,
$tDepartment, $blSerialNumber, $nPropertyNumber, $blHostName, $nIPID,
$tRoomNumber, $tNotes) = $row;
$_SESSION['table'] .= tr class=fntMAIN
   td valign=top align=leftinput name=nItemSKU type=text size=30
value=$nItemSKU/td
   td valign=top align=leftinput name=bActive type=text size=30
value=$bActive$bActive/td
   td valign=top align=leftinput name=nUserID type=text size=30
value=$nUserID$nUserID/td
   td valign=top align=leftinput name=nItemConfig type=text
size=30 value=$nItemConfig$nItemConfig/td
   td valign=top align=leftinput name=tItemType type=text size=30
value=$tItemType$tItemType/td
   td valign=top align=leftinput name=tDepartment type=text
size=30 value=$tDepartment$tDepartment/td
   td valign=top align=leftinput name=blSerialNumber type=text
size=30 value=$blSerialNumber$blSerialNumber/td
   td valign=top align=leftinput name=nPropertyNumber type=text
size=30 value=$nPropertyNumber$nPropertyNumber/td
   td valign=top align=leftinput name=blHostName type=text
size=30 value=$blHostName$blHostName/td
   td valign=top align=leftinput name=nIPID type=text size=30
value=$nIPID$nIPID/td
   td valign=top align=leftinput name=tRoomNumber type=text
size=30 value=$tRoomNumber$tRoomNumber/td
   td valign=top align=leftinput name=tNotes type=text size=30
value=$tNotes$tNotes/td
   td valign=top align=leftinput name=save type=button value=Save
class=frmBTNS/td
  /tr; }
}
?
form action=?php echo $_SERVER['PHP_SELF']; ? method=post
?php echo $_SESSION['table']; ?
input name=edit type=button value=edit selected items
class=frmBTNS
/form

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

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



RE: [PHP-DB] Re: Page counter from a query ?

2003-11-04 Thread Gary Every
Just do an extract on your $_GET var (if security concerns are negligible)

Say you get line is:
?sid=123form=12
// Execute this
extract($_GET)

// You end up with:
$sid == 123;
$form == 12;


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 04, 2003 9:01 AM
 To: pete M
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Re: Page counter from a query ?
 
 
 
 question/comment...
 
 i don't use PEAR currently.  but i noticed this class expects
 register_globals=on and would therefore not to work on my system.
 
 Or does another parent class take care of the translation 
 between $form and
 $_GET['form']?
 
 
 Jeff
 
 
 
 
   
   
 
   pete M  
   
 
   [EMAIL PROTECTED]To:   
 [EMAIL PROTECTED]  
  
   cc:
   
 
Subject:  
 [PHP-DB] Re: Page counter from a query ?  
  
   11/04/2003 09:53
   
 
   AM  
   
 
   
   
 
   
   
 
 
 
 
 
 I use PEAR db to make my life easy..
 here's their pager class
 http://vulcanonet.com/soft/index.php?pack=pager
 
 
 pete
 
 Larry Sandwick wrote:
  Is there a way to limit the number of pictures being display from a
  query?
 
 
 
  Example.
 
 
 
  Let say I have 100 pictures and I would like to display only 20. How
  would I put the numbers at the bottom of the page?
 
 
 
  1 2 3 4 5
 
 
 
  When you click on 1 you get 1 - 20, and when you click on 2 
 you get 21 -
  40. I believe I can use the limit command for the query, I 
 just do not
  understand how to put the query on the number.
 
 
 
  Any help would greatly be appreciated!!!
 
 
 
  TIA
 
 
 
 
 
  Larry Sandwick
 
  Sarreid, Ltd.
 
  Network/System Administrator
 
  phone: (252) 291-1414 x223
 
  fax  : (252) 237-1592
 
 
 
 
 
 --
 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] Page counter from a query ?

2003-11-03 Thread Gary Every
There are a lot of paging scripts out there, you could look on hotscripts.com for 
some, but the query could be simple, such as this

// The setup
$page[1] = 0,10;
$page[2] = 10,10;
$page[3] = 20,10;
...
// The link
echo 
a href=\$PHP_SELF?pagid=1\1/a
;

// At the top of the script
$lim = $page[$pagid] // which would equal 0,10

$sql = SELECT columns from table limit $lim;

and so on .  .. 

Does that help?



Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Larry Sandwick [mailto:[EMAIL PROTECTED]
 Sent: Monday, November 03, 2003 1:35 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Page counter from a query ?
 
 
 Is there a way to limit the number of pictures being display from a
 query?
 
  
 
 Example.
 
  
 
 Let say I have 100 pictures and I would like to display only 20. How
 would I put the numbers at the bottom of the page?
 
 
 
 1 2 3 4 5
 
  
 
 When you click on 1 you get 1 - 20, and when you click on 2 
 you get 21 -
 40. I believe I can use the limit command for the query, I just do not
 understand how to put the query on the number.
 
  
 
 Any help would greatly be appreciated!!!
 
  
 
 TIA
 
  
 
  
 
 Larry Sandwick
 
 Sarreid, Ltd.
 
 Network/System Administrator
 
 phone: (252) 291-1414 x223
 
 fax  : (252) 237-1592
 
  
 
 

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



RE: [PHP-DB] Help installing phpmysearch

2003-10-29 Thread Gary Every
But do you have php compiled --with-curl?
check phpinfo();


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Joseph Allard [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 28, 2003 3:59 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Help installing phpmysearch
 
 
 I was trying to install phpmysearch but I get this error instead :
 
 On your system must have Curl compiled in PHP! - Please 
 check www.php.net
 how you can do this.
 Set in your php.ini allow_call_time_pass_reference to On.
 
 Well, the problem is that it already says, ON! So, what is 
 the actual
 problem?
 
 I have attached a copy of the php.ini file, so that you can see for
 yourself. Thanks.
 
 
 

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



RE: [PHP-DB] Round a number

2003-10-03 Thread Gary . Every
Try the rtrim function in php


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Shaun [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 03, 2003 10:12 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Round a number
 
 
 Hi,
 
 I have a query that returns a number from  culculation in my table. It
 returns say 4.00, 8.75, 0.00, 12.50 etc. How can I get MySQL 
 to return the
 number without any zeros, i.e. 4, 8.75, 0, 12.5 etc?
 
 Thanks for your help
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] show list of values and new values

2003-10-01 Thread Gary . Every
Create a table (items) with selectable items with these columns

select_id   | selection | description
+---+
1   | #00   | White
1   | #FF   | Black
2   | other | Another type
2   | second| Second Type


use select * from items where select_id='1';
into a variable, say $colors

then
?php
echo select name=color;
foreach($colors as $color) {
  $selection = $color['selection'];
  $description = $color['description'];
echo option value=\$selection\$description/option;
}
echo /select;

/* That will build a dropdown with the available colors (select_id='1')
*/
form
Then build an input type=text 3 times to do an add to the db, with
select_id,selection, and description. That will add a row to the table, and
each time you run the script above, it will be populated with all the rows
that have select_id='1'. You can use the same table with different
select_id's for different dropdowns.



Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Hull, Douglas D [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 01, 2003 2:52 PM
 To: Note To php mysql List (E-mail)
 Subject: [PHP-DB] show list of values and new values
 
 
 Just for example, in php how can I show a list of colors so 
 the user can
 select one?  Also if needed the user could add a new color.  
 This could be a
 drop down or whatever.
 
 How can I make this dynamic so when the user adds the new color that
 anywhere I show the list of colors in my web pages the new 
 color would be
 available for selection for this user and all users following?
 
 Kind of confusing, let me know if you need more detail.
 
 Thanks,
 Doug.  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] mySQL vs pgSQL | php vs others

2003-09-24 Thread Gary . Every

 
 
 El Mié 24 Sep 2003 07:24, nabil escribió:
  Dear all;
 
  I have been using Mysql for a long time, but I have a benchmark Q.
 
  Is pgsql , better ? faster ? more reliable than mysql ?
 
 Maybe not faster in FTS, but surely MORE reliable!!!
 
  any comment ?
  Some people say that php is not for a very big enterprise, banking ,
  application !! they said that java or even .NET is better 
 ... I m against
  that but what do you all think ?
 
 I'm not that sure. But one thing I am sure of is that I woud 
 never put a bank 
 account aplication using MySQL!

And why is that? MySQL is as secure as the application that accesses it. We
use it extensively for sensitive data, and it crunches numbers just fine. It
ranks up with Oracle in speed, lacking some features, which will be
available soon, such as stored procedures and triggers, and sub-selects
which are very soon to be available. 

Think .NET, think swiss cheese! Think Java, think long load times, think
PHP,  think quick SSI and security as long as you pass it through ssl



 
 -- 
  16:22:01 up 33 days,  8:04,  1 user,  load average: 0.26, 0.37, 0.38
 -
 Martín Marqués  |[EMAIL PROTECTED]
 Programador, Administrador, DBA |   Centro de Telematica
Universidad Nacional
 del Litoral
 -
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] Re: UPDATE part of a column

2003-09-23 Thread Gary . Every
The best way to do this is a text field, NOT a textarea, and if need be, use
multiple fields. A textarea, by look and definition is inviting carriage
returns to be used. Limit the users to the input you want, and remember,
GIGO (garbage in, garbage out)


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: João Cândido de Souza Neto [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 23, 2003 9:15 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: UPDATE part of a column
 
 
 Can you use strip_tags(nl2br($textarea))
 
 Shaun [EMAIL PROTECTED] escreveu na mensagem
 news:[EMAIL PROTECTED]
  Hi,
 
  I have a column in my table called address. When users add 
 an address with
 a
  textarea they sometimes press return for a new line and 
 this seems to be
  putting line breaks into the database, so I have 2 questions:
 
  1. How can I clean the table, so for example changing:
  Ashfield Business CentreBR The Idlewells PrecinctBR
  Sutton-in-AshfieldBR
  to:
  Ashfield Business Centre, The Idlewells Precinct, 
 Sutton-in-Ashfield,
 
  2, Is there a way to make sure the data is 'clean' before 
 entering into
 the
  table?
 
  Thanks for your help
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] Selection problem

2003-09-08 Thread Gary . Every
Try unset after the if statement

if ($nameb == ){
 
  $query = SELECT * FROM recipes WHERE points $pointsb;
 
 } else {
 
  $query = SELECT * FROM recipes WHERE name = '$nameb';
$new_nameb = $nameb;
unset($nameb);

}

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Chris Payne [mailto:[EMAIL PROTECTED]
 Sent: Sunday, September 07, 2003 5:43 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Selection problem
 
 
 Hi there everyone,
 
 I'm having a strange problem, I have a form with 2 fields, 1 
 is for points
 (Weightwatcher points) and one is for recipe names.  If you 
 select points
 (IE: 1-3, 3-6,6-9,9 and above) it works perfectly, displays 
 the recipes and
 allows you to select a new points range from the dropdown.
 
 Next to it, on the same form, you can also select by recipe 
 name and ignore
 the points instead selecting by the recipe name - this works 
 fine, you can
 select 1, view it and then select another.
 
 The problem comes when you select a recipe from the dropdown 
 and view it,
 then decide you want to select points instead - the points 
 won't work once
 you have selected a recipe.  Can anyone see anything below 
 that is wrong?  I
 am sure it's the if statement, i'm not sure how to handle it 
 as you can
 select either option to get the result.
 
 Any help would really be appreciated, if I haven't confused 
 you all to death
 :-)
 
 Regards
 
 Chris
 
 ?
 
 if ($nameb == ){
 
  $query = SELECT * FROM recipes WHERE points $pointsb;
 
 } else {
 
  $query = SELECT * FROM recipes WHERE name = '$nameb';
 
 };
 
  $sql_result = mysql_query($query,$connection)
  or die(Couldn't execute query.);
 
  while ($row = mysql_fetch_array($sql_result)) {
  $id = $row[id];
  $name = $row[name];
  $points = $row[points];
  $ingredients = $row[ingredients];
  $instructions = $row[instructions];
 
 };
 
 ?
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] determining if a query returns no value

2003-08-14 Thread Gary . Every
Youy could use:
if(!$result) {
// Don't display
} else {
echo Title;
}

You fill in the blanks


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Wendall Williams [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 07, 2003 12:34 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] determining if a query returns no value
 
 
 I'm building a resume page and I am having a problem. I need 
 to query a 
 table to determine if the client has any entries in that 
 table. If they do, 
 it needs to display the category title once then display the 
 entries in 
 rows. If the client has no entries for that category, it 
 needs to move on 
 to the next category.
 
 
 Here is a sample of the code as it is now:
 
 $result = mysql_query(SELECT showname, role, network FROM 
 tbltv where id = 
 $_GET[clientID]);
 if (!$result) {
   echo(pError performing query:  . mysql_error() . /p);
   exit();
 } 
 // Display the title of category
 echo(tr bgcolor='#66');
 echo(td colspan='3'font 
 color='#FF'bTELEVISION/b/font/td/tr);
 // set column vars
 $cols = array('#CC','#99');
 $i = 0;
 // generate table row
 while ( $row = mysql_fetch_array($result) ) {
 
   echo(tr bgcolor= . $cols[$i++%2] . td . 
 $row[showname] . 
 /tdtd . $row[role] . /tdtd . $row[network] . 
 /td/tr);
   
   }
 
 You can see that the Category Title (in this case 
 TELEVISION) is printed 
 before the array is fetched. This was done to avoid 
 displaying the Title 
 above every row. However, if the client does not have any 
 entries in this 
 category, it (obviously) prints the title anyway and then 
 moves on to the 
 next category.
 
 What statement would say  if $result returned no value move on ??
 
 Thanks for your help.
 
 Wendall Williams
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] Condition for Adding data

2003-07-22 Thread Gary . Every
Well, you're initializing $food to ; then testing to see if it has a
value, which it never will.

If you're getting the $food variable from a POST or a GET op, you'll need to
grab it from the appropriate array,

$food = $_POST['food'];

echo $food;

to see what is being passed.



Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: gatimu [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 22, 2003 7:34 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Condition for Adding data
 
 
 Hi
 I need help!, I am quite new to php and I am trying to create 
 a condition 
 that will load a specific page after a form has been 
 submitted to enter 
 data in my database, I have tried using this code (I created 
 it) but it 
 wont work, all I get is a messege on the browser that says the page 
 address incorrect
 
 Here is how i have scripted the code
 ?php
   $food=;
   if($food==milk)
   {
   $pgload=milk.php;
   }
   if ($food==eggs)
   {
   $pgload=egg.php;
   }
   if ($food==ham)
   {
   $pgload=ham.php;
   }
 echo  form name=appForm method=post action=.$pgload.
 ?
 
 any ideas on how i can go around this problem?
 
 Gatimu
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] commas

2003-07-17 Thread Gary . Every
Check out the php function number_format($field,0)

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Chris Mach [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 17, 2003 7:43 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] commas
 
 
 Is there a function that will strip or add commas?
 
 I'm trying to do calculations with attendance numbers of 
 football games...
 for example:  33,153
 
 right now I don't have a comma for the numbers in the 
 database. So the above
 example is 33153 in my database. If I put the comma in, when 
 I try to do
 calculations with php it sees it as 33 instead of 33,153.
 
 So is there a way to add that comma afterwards? Perhaps a 
 string function at
 will put the comma in after the first 3 characters?
 
 Thanks
 
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] Date problem

2003-07-14 Thread Gary . Every
snip
 // Do some number crunching here //
 
 $newnow = $now-$numweeks;
 
 echo $now;
 
 $converted_date = date(d-m-y,$now);
 
 echo br$converted_date;

/snip

You should be running your $convewrted_date on $newnow, not $now




Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Chris Payne [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 14, 2003 3:45 AM
 To: php
 Subject: [PHP-DB] Date problem
 
 
 Hi there everyone,
 
 I use the below code to grab the current date, convert it to 
 a unix timestamp to do some bits then it's supposed to change 
 the date back with the new values (IE: current date - x 
 amount of seconds) but it's not doing it correctly, it's 
 probably DEAD obvious to everyone as my brain has probably 
 fried :-)  But here's the code, when I convert it back to 
 d,m,Y it says it's 2004 which it shouldn't.
 
 Thanks
 
 Chris
 
 ---
 
 $secsinweek = 604800;
 
 $numweeks = $secsinweek * 7;
 
 $curdate = date(d-m-Y);
 
 // Split the strings into day, month, year
 list($cd, $cm, $cy) = split(-, $curdate);
 
 // Create unix time stamps for the start and end date
  $now = mktime(0,0,0,$cd,$cm,$cy);
 
 // Do some number crunching here //
 
 $newnow = $now-$numweeks;
 
 echo $now;
 
 $converted_date = date(d-m-y,$now);
 
 echo br$converted_date;
 


RE: [PHP-DB] mysql_fetch_array issues.

2003-07-09 Thread Gary . Every
Do you have select permissions on that DB/table?

If you have GRANT permissions, try
GRANS SELECT, INSERT, UPDATE, DELETE ON db.tablename to
'youruser'@'your.ip.address' IDENTIFIED BY 'yourpassword';

your.ip.address can be substituted with localhost if you're on the same box.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Greg Hetrick [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 09, 2003 12:31 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] mysql_fetch_array issues.
 
 
 I do not have the die statment -- the DB is the same except 
 the name and I
 have double checked that I just did a back up of the previous 
 db and moved
 it to the new server. I have done some more digging, my query 
 appears to
 work, but I almost appears that I have a problem with selecting the
 database --
 if I comment out the mysql_select -- statment I get the same 
 error, perhaps
 I just can't get to that DB.
 intresting.
 
 I guess I can assume at this point there is something flaky with my DB
 
 
 Jeffrey N Dyke [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
  Do you have an 'or die(mysql_error())'  statement following your
  mysql_query($result) line.  99% of the time, this error 
 means your query
  failed.  if it works on another serverare the fields 
 the same, the
  dbname, the tablename?
 
  hth
  jeff
 
 
 
Greg Hetrick
[EMAIL PROTECTED]To:
 [EMAIL PROTECTED]
net cc:
 Subject:  [PHP-DB]
 mysql_fetch_array issues.
07/09/2003 12:04
PM
 
 
 
 
 
 
  I am getting the following error when attempting to pull 
 data out of a
  mysql
  DB
 
  Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
 result
  resource in 
 /home/pffl/public_html/pffl/webpage/html/dataentry.php on line
  125
 
  I can take this same code to a different web server and it 
 is pulling
  correctly!
 
  I am currently running Apache 2.0.46 with PHP 4.3.2 I was 
 running Apache
  1.3.x with PHP 4.3.1 and getting the same thing, any ideas? 
 here is the
  chunk of code where I use the function.
 
  while ($myrow=mysql_fetch_array($result))
  {
  ?
  option value=?print $myrow['name'];?, ?print
  $myrow['team'];? ? echo $myrow[name]; ?/option
  ?
  }
 
  Any Ideas.
 
 
 
  --
  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] Reading from a file

2003-07-01 Thread Gary . Every
Looks like the first question was answered correctly, for the second one
look at the ltrim and rtrim functions.
$var = ;
$var = rtrim($var);
echo :$var:;
output is
::


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Rick Dahl [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 01, 2003 11:11 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Reading from a file
 
 
 I need to read from a file that is tab delimited.  Is there 
 anyway to specify that it reads between each tab and that is 
 it.  I know fread() uses bytes to figure out what to read but 
 that isn't very practical in my case.  
 
 Also, how do I get rid of any white space at the end of a 
 variable if there is some once it is read in?
 
 - Rick
 


RE: [PHP-DB] Splitting Product Catalogue Over Multiple Pages?

2003-06-27 Thread Gary . Every
If you're trying to do paging, it's quite simple (there are tons of examples
out there, search google for paging php)

$sql = select count(*) from table_name

$number_of_records = mysql_query($sql);
$pointer=0;
$recs_per_page=20;

if($number_of_records  $recs_per_page) {
// do a limit and keep the pointer
$sql = select * from other_table limit $pointer,$recs_per_page;

$pointer += $recs_per_page;


This isn't complete by any means but the point should be clear. You limit
the query by LIMIT starting_point,number_of_records_to_return at the end
of the sql statement.

Don't worry about the values in the column, just the amount of records you
want to return



Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Boa Constructor [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 26, 2003 10:25 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Splitting Product Catalogue Over Multiple Pages?
 
 
 Greetings all, I'm not sure if this has been discussed 
 recently, I've read
 bits and pieces and I can't remember where I read everything 
 so if it has
 been brought up recently - sorry.
 
 If I do an SQL (MySQL) query on the first example to get the 
 min and max IDs
 then I will get 1 and 6 respectively.  I will then be able to 
 loop from 1 to
 6 and return all 6 products from the database.  If however I 
 wanted to split
 this in to two pages with 3 items in each page then using the 
 first example
 below I could grab the min ID and add 2 to it to make 3.  I 
 could not do
 this using the second example because if I grab the min ID I 
 would get 3, if
 I add 2 to it then I would get 5.  5 does not exit in this 
 table so that
 wouldn't work.  How in example 2 would I be able to split 
 this over two
 pages?
 
 //example 1
 
 ID   Product_Name
 1  Hoover
 2  Kettle
 3  Fridge
 4  Cooker
 5  Food Mixer
 6  TV
 
 //example 2
 
 ID   Product_Name
 3 Fridge
 4 Cooker
 7 Microwave Oven
 8 Freezer
 9 DVD Player
 10   Computer
 
 
 Any ideas?
 
 Anything is much appreciated.
 
 Graeme :)
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] Splitting Product Catalogue Over Multiple Pages?

2003-06-27 Thread Gary . Every
LIMIT 0,10 will return the first ten records of a result set. To make more
sense, you should do an ORDER BY of some field to get the info sorted
correctly. 
LIMIT takes 1 or two arguments
If there is only one argument, say 10, it will return the first ten records.
If there are two arguments, LIMIT 20,10 it will return 10 records starting
at record 20.

More info at
http://www.mysql.com/doc/en/SELECT.html
Search for limit on that page.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Boa Constructor [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 27, 2003 9:20 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Splitting Product Catalogue Over Multiple Pages?
 
 
 Gary, thanks for your reply, I think I'll need 2 have a think 
 about this.  I
 didn't totally understand:
 
 You limit
  the query by LIMIT 
 starting_point,number_of_records_to_return at the end
  of the sql statement.
 
 I've never used LIMIT before, could you explain this a bit 
 more or point me
 to some info?
 
 
 Cheers,
 
 Graeme :)
 
 
 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, June 27, 2003 2:39 PM
 Subject: RE: [PHP-DB] Splitting Product Catalogue Over Multiple Pages?
 
 
  If you're trying to do paging, it's quite simple (there are tons of
 examples
  out there, search google for paging php)
 
  $sql = select count(*) from table_name
 
  $number_of_records = mysql_query($sql);
  $pointer=0;
  $recs_per_page=20;
 
  if($number_of_records  $recs_per_page) {
  // do a limit and keep the pointer
  $sql = select * from other_table limit $pointer,$recs_per_page;
 
  $pointer += $recs_per_page;
 
 
  This isn't complete by any means but the point should be 
 clear. You limit
  the query by LIMIT 
 starting_point,number_of_records_to_return at the end
  of the sql statement.
 
  Don't worry about the values in the column, just the amount 
 of records you
  want to return
 
 
 
  Gary Every
  Sr. UNIX Administrator
  Ingram Entertainment
  (615) 287-4876
  Pay It Forward
  mailto:[EMAIL PROTECTED]
  http://accessingram.com
 
 
   -Original Message-
   From: Boa Constructor [mailto:[EMAIL PROTECTED]
   Sent: Thursday, June 26, 2003 10:25 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP-DB] Splitting Product Catalogue Over Multiple Pages?
  
  
   Greetings all, I'm not sure if this has been discussed
   recently, I've read
   bits and pieces and I can't remember where I read everything
   so if it has
   been brought up recently - sorry.
  
   If I do an SQL (MySQL) query on the first example to get the
   min and max IDs
   then I will get 1 and 6 respectively.  I will then be able to
   loop from 1 to
   6 and return all 6 products from the database.  If however I
   wanted to split
   this in to two pages with 3 items in each page then using the
   first example
   below I could grab the min ID and add 2 to it to make 3.  I
   could not do
   this using the second example because if I grab the min ID I
   would get 3, if
   I add 2 to it then I would get 5.  5 does not exit in this
   table so that
   wouldn't work.  How in example 2 would I be able to split
   this over two
   pages?
  
   //example 1
  
   ID   Product_Name
   1  Hoover
   2  Kettle
   3  Fridge
   4  Cooker
   5  Food Mixer
   6  TV
  
   //example 2
  
   ID   Product_Name
   3 Fridge
   4 Cooker
   7 Microwave Oven
   8 Freezer
   9 DVD Player
   10   Computer
  
  
   Any ideas?
  
   Anything is much appreciated.
  
   Graeme :)
  
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 


RE: [PHP-DB] md5 question!

2003-06-24 Thread Gary . Every
It's all dependent on the seed the first two characters of the hash

You take a password, say apass and pass it through md5
Say you get :
dFeRDfss3456fdddsas/..

When the user types in their password, this is what happens
The string above is retrieved, and the password entered, apass is run
through md5 WITH THE KNOWN SEED, dF

The output of md5 will be 
dFeRDfss3456fdddsas/..

and it is compared to what is stored. If they match, hunky-dory, the auth is
granted

Upon creating an md5 hash, the seed is randomly generated, so that two users
with the same password may have completely different hash strings.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 24, 2003 4:47 AM
 To: JeRRy; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] md5 question!
 
 
 They would be the same, they have to be.  If you can de-crypt 
 it, there has to 
 be some method of validation.  So, if someone choose the same 
 password as you 
 did, and you stored those in a DB as encrypted with md5, then 
 they would look 
 identical.  So, you would know the other person's password.
 
 
 
  Hi,
  
  Hmmm okay... So if the passowrd was.
  
  jerry
  
  and the md5 output was
  SKHDJHDJDHJDHSfdfs
  
  and another user sets their passowrd to the same as
  mine does that mean the md5 output would be identical
  to the last as the same password is entered?
  
  e.g.
  
  User 1:
  Username: Fred
  Password: jerry
  
  User 2:
  Username: notfred
  Password: jerry
  
  Or is each entry unique ?
  
  I'm thinking if each entry was unique than reversing
  the md5 action could be inconclusive.  But if the
  output is the same if the same password is entered
  than sure it's reliable.  But I could be barking up
  the wrong tree all together here, so correct me if I
  am wrong.  I have not used md5 before so learning on
  that behalf.
  
  Jerry
  
   --- [EMAIL PROTECTED] wrote:  Just use brute
  force...
   Example:
   md5('password') will ALWAYS produce the same output!
   So, if I intercept a pmd5 encrypted password that
   looks like: SKHGDOIUYFB
   then I could just say:
   if (strcmp (md5('password'), SKHGDOIUYFB) == 0)
 printf(Your password is: %s\n, password);
   
   So, just start a loop going through all possible
   combinations od legal password 
   character and encrypt with md5, then compare.  
   
   Hard?  Not at all, Time consuming, perhaps, but with
   3+ Ghz processors coming 
   out you'd be surprised how quickly one could loop
   through billlions of possible 
   password combinations.  Enter distributed
   environments and it is much fatser.  
   The key is not to rely on passwords but to rely on
   other system security 
   messures, use SSL, so it is hard to intercept in the
   first place, make sure 
   your system is secure so these passwords cannot be
   extracted from your DB 
   without you knowing about it, etc...
   
   
   
Marco,

Thanks, that's what I originally thought that it
   was
one way.  So websites that have the option to
   retrieve
password don't use md5?

I guess technically there MUST be a way to break
   the
barrier where you can reverse it.  If there is a
   way
to make it there is always a way to break it,
   somehow.
   But what I have heard and read it's very
   tight
and probably the best method to handle passwords
   for
now, until something new is released.  Which will
happen when md5 is broken, like everything else
   after
a little bit of time.

Jerry

 --- Marco Tabini [EMAIL PROTECTED] wrote:  Hi
Jerry--
 
 No, md5 is a one-way hash. That's why it's so
 safe--because if someone
 steals the information he still can't tell what
   the
 passwords are.
 
 You may want to reset the passwords upon your
   users'
 request and send it
 to them via e-mail instead.
 
 Cheers,
 
 
 Marco
 
 --
 php|architect -- The Magazine for PHP
   Professionals
 Come try us out at http://www.phparch.com and
   get a
 free trial issue
 
 
 On Tue, 2003-06-24 at 08:35, JeRRy wrote:
  Hi,
  
  If I use md5 to handle passwords to my
   database is
  there a way to reverse the action if someone
 forgets
  their password?  Is there a way for me to
   decode
 the
  32bit to plain text?
  
  Jerry
  
  http://mobile.yahoo.com.au - Yahoo! Mobile
  - Check  compose your email via SMS on your
 Telstra or Vodafone mobile.
 -- 
 
 Marco Tabini
 President
 
 Marco Tabini  Associates, Inc.
 28 Bombay Avenue
 Toronto, ON M3H 1B7
 Canada
 
 Phone: (416) 630-6202
 Fax: (416) 630-5057
 Web: http://www.tabini.ca
 
 
 -- 
 PHP Database Mailing List (http

RE: [PHP-DB] Two-column display of data, second method

2003-06-20 Thread Gary . Every
You could always use the % operand

snip
$cols_wanted = 2;
if(($faculty_found % $cols_wanted) == 0) {
// Then do a TR
echo 'tr';
} else {
// Then it's the first column, and don't end the row
}
/snip

This also simplifies it so that you can decide to use three, four or five
columns, just by changing the $cols_wanted variable




Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 19, 2003 5:01 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Two-column display of data, second method
 
 
 Nice job.  There's a fair bit of room for optimization, but 
 unless your data
 sets are very large, it's probably not necessary.  However, 
 if you're compulsive
 (as I tend to be), you'll optimize every bit of code to the 
 best of your
 abilities.  And yes, I know I'm crazy. ;P
 
 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com
 
 
 - Original Message -
 From: David Shugarts [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, 19 June, 2003 17:43
 Subject: [PHP-DB] Two-column display of data, second method
 
 
 When I went looking for a script that would give me a 
 two-column layout that
 would list my faculty members in two roughly equal columns, 
 alphabetized
 down the first column and then the second, I did not find 
 such a script.
 [There was indeed a two-column script, but it fed the data 
 row-by-row.]
 
 I wrote this one and am glad to share it. The math statements 
 could surely
 be condensed, but I was using them to confirm the results. This script
 either creates two equal columns if the total number of items 
 is even, or it
 makes the first column the longer if the total number of items is odd.
 
 --Dave Shugarts
 
 
 ?php
 
 /* *** Now selects the Faculty names ** */
 
 $sql =SELECT FirstName, Middle, LastName
 FROM $table_name
 ORDER BY LastName, FirstName;
 
 
 /* ** Now passes the result of the search ** */
 
 $faculty_result = @mysql_query($sql, $connection) or die(Error #.
 mysql_errno() . :  . mysql_error());
 
 $faculty_found = @mysql_num_rows($faculty_result);
 $faculty_half = $faculty_found / 2;
 $faculty_round = round($faculty_found / 2);
 $faculty_remain = $faculty_found - $faculty_round;
 
 
 echo table border=0
 
 trtd colspan=2 align=centerb
 Two-Column header
 /bbr/td/tr
 
 trtd width=49%\n;
 
 for ($rownum = 1; $rownum = $faculty_round; $rownum++)
 
 {
 $row = mysql_fetch_array($faculty_result);
 
 
 $FirstName=$row['FirstName'];
 $Middle=$row['Middle'];
 $LastName=$row['LastName'];
 
 $faculty_block = 
 font class=facultydoc
 $FirstName $Middle $LastName
 /font
 br
 ;
 
 echo $faculty_blockbr;
 }
 
 echo /tdtd\n;
 
 
 for ($rownum = 1; $rownum = $faculty_remain; $rownum++)
 
 {
 $row = mysql_fetch_array($faculty_result);
 
 
 $FirstName=$row['FirstName'];
 $Middle=$row['Middle'];
 $LastName=$row['LastName'];
 
 $faculty_block = 
 font class=facultydoc
 $FirstName $Middle $LastName
 /font
 br
 ;
 
 echo $faculty_blockbr;
 }
 
 echo /td/trbr/table;
 
 ?
 
 
 --
 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] Limit return Size

2003-06-20 Thread Gary . Every
Or 
$sql = SELECT concat(LEFT(columnName,255),...) FROM tableName;


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 20, 2003 2:46 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Limit return Size
 
 
 Try:
 
 $sql = SELECT LEFT(columnName,255) FROM tableName;
 
 Using that syntax should return the first 255 characters from 
 the selected
 column, reading LEFT to right. I tested it in the command 
 line and it worked
 just fine.
 
 Hope that helps.
 
 Rich
 
  -Original Message-
  From: Marie Osypian [mailto:[EMAIL PROTECTED]
  Sent: Friday, June 20, 2003 3:06 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Limit return Size
  
  
  I would like to know how I limit my answer from a mysql 
  database query to
  display only a limited size?  Is this done in the query or the php?
  
  i.e.  Our Performance Results area includes First Quarter 
  2003 investment
  returns for virtually every 529 savings programs. See how 
  your 529 plan
  performed...
  
  This question is alot longer but it was stopped and ... 
 added when it
  reached the desired size.
  
  Thanks
  
  MAO
  
  
  
  -- 
  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] Problems with formvalues by using Suse 8.2

2003-06-19 Thread Gary . Every
To protect yourself by keeping register_globals off but still have access to
your GET and POST info, do the following:
snip
foreach($_POST as $key=$value) {
$$key = $value;
}

// Now all the post vars are in their corresponding key names
// You can do the same with $_GET vars

/snip

Using the $$key assigns whatever $key is to a variable with that value, e.g.
$key = sid;
$value = W;

So:
$$key = $value;
will make the following true:
$sid == W;


It's a pretty good way of re-doing pages that were written with
register_globals=on to run with register_globals=off



Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Thorsten Körner [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 19, 2003 2:05 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Problems with formvalues by using Suse 8.2
 
 
 Hi
 Am Donnerstag, 19. Juni 2003 20:07 schrieb Ruprecht Helms:
  Hi,
 
  under using Suse 8.2 I've the problem that the values of 
 formfields will be
  put out or worked withit within a phpscript.
 
  The testscript with   phpinfo()   is working fine.
 
  What have I to set (in the php.ini) that php is handling the
  formfieldvalues properly?
 Seems to be a little bit OT here.
 Your question is not very precise, but I'll give it a try.
 Depending on your form-method, you can request the values by 
 accessing either 
 $_GET['formfieldname'] or $_POST['formfieldname'] where 
 formfieldname has to 
 be replaced by the real names of the fields.
 Hope that's it.
 
 CU
 
 Thorsten
 -- 
 Thorsten Körner   http://www.123tkShop.org
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] Ignoring specific values in an inner join query?

2003-06-10 Thread Gary . Every
$abfrage3=select distinct Anschriften.ID as aid, 
Anschriften.PLZ as aplz,
Anschriften.STRASSE as astrasse, Anschriften.HNR as ahnr from 
Anschriften
inner join Master on Anschriften.ID=Master.A
inner join Master as m on Master.FN=m.FN
inner join Personen on m.NN=Personen.ID
where Personen.Name like '%$name%'
AND whatever_field_you_want IS NOT NULL
AND whatever_other_field IS NOT NULL;




Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Andr Sannerholt [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 10:42 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Ignoring specific values in an inner join query?
 
 
 Hi everybody.
 
 How to let mysql ignore specific values in an inner join 
 query? In this case
 I want it to ignore Null-Values!
 
 $abfrage3=select distinct Anschriften.ID as aid, 
 Anschriften.PLZ as aplz,
 Anschriften.STRASSE as astrasse, Anschriften.HNR as ahnr from 
 Anschriften
 inner join Master on Anschriften.ID=Master.A
 inner join Master as m on Master.FN=m.FN
 inner join Personen on m.NN=Personen.ID
 where Personen.Name like '%$name%';
 
 Regards
 
 André
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] Calling Stored Procedures of Oracle in php

2003-06-06 Thread Gary . Every
If this is a cut-n-paste of the code, check the line below for spelling:

begin prcoedurename('[EMAIL PROTECTED]','3');end;;
  ^^^

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Ketan Parekh [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 06, 2003 9:24 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Calling Stored Procedures of Oracle in php
 
 
 Hi,
 
 I want  to call a oracle stored procedure from php and 
 retrieve the values.
 My procedure has 2 parameters which i have to pass and based 
 on that it will
 return values. I am using the below code. I am getting errors 
 like wrong
 arguements passed. Can anybody tell me the reason?
 
 $conn = ora_logon(abc,xyz);
  $curs = ora_open($conn);
  $query = begin prcoedurename('[EMAIL PROTECTED]','3');end;;
 
  ora_parse($curs, $query);
  ora_exec($curs);
  ora_fetch($curs);
 
   $nrows = ora_numrows($curs);
   echo $nrows;
   exit;
 
 --
 
 Thanks,
 
 Ketan Parekh
 -
 Cybage Software Pvt Ltd.
 6686359 Ext 235
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread Gary . Every
1. Change your field name from date to something like datefield (or backtick
it)

2. Place single quotes within your VALUES parens, e.g. 

$denylog = INSERT INTO deny (account, td, datefield ) VALUES ('$tmp',
'$td', NOW() )

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 2:06 PM
 To: 'Rankin, Randy'; '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] Datetime help in an INSERT...
 
 
   No, the field is a Datetime field rather than a Timestamp field.
 
 -Original Message-
 From: Rankin, Randy [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 1:59 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] Datetime help in an INSERT...
 
 
 Correction ( I typed this in a hurry ) ...
 
 If you are using MySql and the date field is of type 
 timestamp, you should
 _not_
 have to insert anything using the query. It will update 
 automatically when
 the record is inserted and/or updated.
 
 ie; $denylog = INSERT INTO deny (account, td ) VALUES ($tmp, $td );
 
 Randy
 
 -Original Message-
 From: Rankin, Randy [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 1:56 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] Datetime help in an INSERT...
 
 
 If you are using MySql with the date field is of type 
 timestamp, you should
 have to insert anything using the query. It will update 
 automatically when
 the record is inserted and/or updated.
 
 ie; $denylog = INSERT INTO deny (account, td ) VALUES ($tmp, $td );
 
 Randy
 
 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 1:47 PM
 To: '[EMAIL PROTECTED]'
 Cc: '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] Datetime help in an INSERT...
 
 
   The error I am receiving is:
 
 You have an error in your SQL syntax near ' NOW())' at line 1
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 1:45 PM
 To: NIPP, SCOTT V (SBCSI)
 Subject: Re: [PHP-DB] Datetime help in an INSERT...
 
 
 what kind of error are you getting?
 
  I am stumbling across something that I thought I have 
 done before,
  and I am not having any luck finding an example of this.  
 Basically, I am
  wanting to timestamp the date and time into new entries in a simple
 database
  table.  The following section is the actual code for this, 
 and I cannot
  figure out how to get the date/time stamp to populate into 
 the database.
  Thanks in advance for the help.  I suspect this is a very 
 simple fix.
  
  $denylog = INSERT INTO deny (account, td, date) VALUES ($tmp, $td,
 NOW());
  $denylog_result = mysql_query($denylog, $Prod) or 
 die(mysql_error());
  
  Scott Nipp
  Phone:  (214) 858-1289
  E-mail:  [EMAIL PROTECTED]
  Web:  http:\\ldsa.sbcld.sbc.com
  
  
  
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


[PHP-DB] Test

2003-06-04 Thread Gary . Every

 Sorry about the test, but . . . 


RE: [PHP-DB] Array Question

2003-06-03 Thread Gary . Every
CartArray['itemid'] = $itemid;

note
where $qty = CartArray['qty'];
/note


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Boa Constructor [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 02, 2003 2:27 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Array Question
 
 
 Hello everyone.  If I wanted to pass a item ID along with a 
 quantity to an
 associative array called CartArray how would I pass it to 
 the PHP script?
 
 I'll get this shopping cart working yet !!
 
 Cheers,
 
 Graeme :)
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] Permission Denied; Upload

2003-04-04 Thread Gary . Every
Unable to open '' for reading: That means you're not actually sending a
filename to be read!

 
 I get this error during test of the above page:  Warning: 
 Unable to open '' for reading: Permission denied in 
 C:\SammiWWW\entry.php on line 27 Couldn't copy the file!
 
 


[PHP-DB] Anybody out there?

2003-04-03 Thread Gary . Every
Is the list active? I've seen nothing all day.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com
 


RE: [PHP-DB] Login and link back...

2003-03-19 Thread Gary . Every
Have you thought about using BASIC AUTH in Apache? That way, you don't even
need to build a login page, just authenticate each page. Here's what we use:

Note that some of the functions used in this script are not included, and
need to be commented out or a function written for them. It's rather
self-explanatory.

We also create a .htaccess file with all the username/passwords in a central
location. You'll need to modify tour httpd.conf file to look in that central
location for all the pages.


## Function:   check_auth()
## Description:   Checks authentication against the mysql user info database
and
##verifies the password.  This function is absolutely critical.
##If it's not right, you could be letting people into the website
##unintentionally.  Always make sure that login failure occurs
##unless you have a positive ID!!!
## Additionally it determines if the user has read and digitally
accepted
##IEI's liability statement by calling liability_statment_check().
## Arguments:  none
## Returns: success- returns true
##failure- exits via auth_header()
function check_auth() {
global
$conn_id,$PHP_AUTH_USER,$PHP_AUTH_PW,$PHP_AUTH_REALM,$REQUEST_URI,$sid;
global $WEBUSER_TABLE,$WEBAUTH_TABLE;
   global $redirect;
# The only way out of this function is:
# 1) A recursive call to auth_header()
# 2) A TRUE return to the caller

# Is USER and PASS set?
if( !isset($PHP_AUTH_USER) || !isset($PHP_AUTH_PW)) {
  if ($redirect=='y'){
 log_it(LOG_DEBUG,caught redirect);
 auth_header($PHP_AUTH_REALM);
  } else {
 log_it(LOG_DEBUG,redirecting);
 Header(Location: /index.php?redirect=y);
 exit();
  }
}

# Does USER have trailing whitespace? BAD MYSQL!
if (ereg(' +$',$PHP_AUTH_USER)){
auth_header($PHP_AUTH_REALM);
}

# Is USER known to the system?
$sql = SELECT * FROM $WEBUSER_TABLE WHERE
web_user_id='$PHP_AUTH_USER' AND web_password='$PHP_AUTH_PW';
$row = get_row($conn_id,$sql);
if($row  is_array($row)) {

# Yes, so...
  
  # See if they've been disabled
  if($row['web_access_level'] == 'D'){
## Start the Auth over again
## auth_header($PHP_AUTH_REALM);
## include('/error_disabled.php');
Header(Location: /error_disabled.php);
exit();
  }  

# Check logged_in state
$sql = SELECT logged_in FROM $WEBAUTH_TABLE WHERE
web_user_id='$PHP_AUTH_USER';
$row = get_row($conn_id,$sql);
if(!$row  || !is_array($row)) {

# First time login for USER, let him through
authorize_user($PHP_AUTH_USER);
return(TRUE);

} else {

 # RETURN POINT FROM FUNCTION
 # USER's logged_in status is something other than 'N' which is
acceptable 
 # for access
 if ($row['logged_in'] != 'Y'){
update_logged_in_status($PHP_AUTH_USER,'Y');
if ($redirect!='y') auth_header($PHP_AUTH_REALM);
 } else {
log_it(LOG_INFO,checkauth() SUCCESS: user=$PHP_AUTH_USER
pass=NO-SOUP-FOR-YOU-TOO);
# update_logged_in_status($PHP_AUTH_USER,'Y');
 }
  }

  liability_statement_check();
  return(TRUE);

   } else {

# USER NOT KNOWN
auth_header($PHP_AUTH_REALM);

}

}

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 19, 2003 10:39 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] Login and link back...
 
 
   I am curious about what you guys may have along the 
 lines of best
 practices for forwarding from a URL to a login, and then 
 jumping back to the
 original URL automatically.  I have several separate 
 applications that all
 need to utilize the same login mechanism.  I want the user to 
 be able to
 enter the URL for the application and if they are not logged 
 in it redirects
 them to a login screen.  I already have the sessions junk setup and
 understand all of that portion.  I am mainly interested in 
 how people are
 handling the return to a URL after successful login.
   I have done some research on this, and discovered the 
 $HTTP_REFERER
 variable however the PHP site discourages using this.  I have 
 also thought
 of adding code to each page to export an origin variable to 
 be passed to
 the login page such that it can be used to return the user.  
 I thought of
 this method, but I am not real clear on how to manage this.  
 Does anyone
 have any suggestion on implementing this, or another 
 alternative that I have
 not touched on yet?  Thanks in advance.
 
 Scott Nipp
 Phone:  (214) 858

RE: [PHP-DB] SELECT * FROM Command *REVISED*

2003-03-19 Thread Gary . Every
SELECT * FROM tablename WHERE zipcode='$zipcode' ORDER BY entered_date;

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Michelle Whelan [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 19, 2003 1:04 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] SELECT * FROM Command *REVISED*
 
 
 
 -Ok, this is what I have.  I hope this is what you are 
 looking for.   I'm looking to format this search results page 
 so that the results come back with the entire entry that also 
 matches the zipcode that was searched.
 
 ex:  zipcode search = 90210
 
 results for 90210 are:
 
 contactname
 
 phone number
 
 city
 
 date posted
 
 etc. 
 
 AND, somehow ( I'm thinking ordered list) to have a format 
 for multiple results sorted by date.  
 
 Is this possible?
 
 Thanks again in advance
 
 Michael
 
 html
 head
 titlewww..com/title
 /head
 
 body BACKGROUND=images/dirt.gif text=#FF 
 link=#FF vlink=#00 alink=#00 BGPROPERTIES=fixed
 
 ?
 
 /* MySQL details */
 $dbHost = mysql;
 $dbUser = ;
 $dbPass = ;
 $dbName = ;
 $table = havedirt;
 
 /* Attempt connection to MySQL server */
 $link = @mysql_connect($dbHost, $dbUser, $dbPass);
 
 /* If connection wasnt successful... */
 if (!$link)
 {  
   print (bError:/b Could not connect to database.);
   exit;
 }
 
 /* Attempt to select our database */
 if ([EMAIL PROTECTED]($dbName))
 {
   print(bError:/b Could not find $dbName database.);
   exit;
 }
 
 $ZipCode = $_POST[zipcode];
 
 /* Build SQL query to fetch all entries from the table */
 $query = SELECT * FROM $table WHERE zipcode = $ZipCode;
 
 /* Execute query */
 $result = mysql_query($query);
 
 /* If there was a problem with the query... */
 if (!$result || @mysql_num_rows($result)  1)
 {
   print(No entries in table $table.);
   exit;
 }
   print(table);
 
 /* For each table entry returned... */
 while($row = mysql_fetch_array($result))
 {
 
 /* Add details to output variable */
   print(trtd . $row['zipcode'] . /td);
   print(tr);
 
 }
 
 print(/table);
 
 /* Close link to MySQL */
 mysql_close($link);
 
 ?
 
 /body
 /html
 


RE: [PHP-DB] Column Sort Question

2003-03-05 Thread Gary . Every
Shouldn't you be using $_GET or, since register_globals are set to off,
$order_by should contain FIRSTNAME

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Jerry [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 3:40 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Column Sort Question


Hi All,

This is a newbie question. I am using PHP Version 4.2.3 with
register_globals=off. I am trying to creating a simple address book with
mysql as the backend. I have a  form that passes what the user wants to
query from the address book and it returns everything in a table with column
heading just fine. I use $myvar1=$_POST['myvar1']; to pass the info from the
form to the php file.

I am using the following in the header fields of the table:
th nowrap a href=?php echo $PHP_SELF?order_by=FIRSTNAME; ?First
Name/a /th

This doesn't work (I get a bunch of errors) and I think it's because the
variable from $_POST are not staying persistent. I tried playing around with
session with no luck.

What is the best way to resort on a column?

Thanks,

Jerry



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


RE: [PHP-DB] Update errors

2003-02-27 Thread Gary . Every
Shouldn't have a comma after cat_name = '$cat_name'  unless you are updating
multiple fields.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Alawi shekh albaity [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 12:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Update errors


What wrong with this SQL
 $SQLSTATEMENT[UPDATE_CAT] = 
 UPDATE  cats SET 
 cat_name = '$cat_name',
 WHERE cat_id = $catidforedit
 ;
 Error no : 1064
Details : 
 
You have an error in your SQL syntax near 'WHERE cat_id = 2 ' at line 4

Db : mysql

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


RE: [PHP-DB] Processing Page

2003-02-27 Thread Gary . Every
Check out http://www.php.net/manual/en/function.ob-flush.php
the ob_flush command.
You could put an animated gif like an hourglass with a please wait at the
beginning of your html output, perform an ob_flush command to put that info
out to the browser, then perform your sql.
After the sql finishes, output more information, or redirect to another page
that says it's done.

CAVEAT:
Some versions of Microsoft Internet Explorer will only start to display the
page after they have received 256 bytes of output, so you may need to send
extra whitespace before flushing to get those browsers to display the page. 


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Aspire Something [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 1:49 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Processing Page


Hi all,

Permit me to recive your valuable knowledge ,

We are working on a project where the backend churns data for about 1 Minute
(time out limit is  2 min) we would like 
to put a page like
 PROCESSING  
during the database is busy doing its fine job. And also a sucess page
appears when the 
process is sucessfull.

Please if you have any idea how it can be done please let me 
Humble thanks in advance.
We are not using persist connection to postgresql
=== My Sys Looks as ==
Red Hat 7.2 Kernel  2.4.7-10,
PHP 4.3.0,
GCC 3.02,
Apache 1.3.27 ,
Postgresql 7.3.2,
Intel arch i686.



Regards,
Aspire


RE: [PHP-DB] Newbie Question - PHP and MSACCESS

2003-02-17 Thread Gary . Every
//Place your request into a variable:
$result = odbc_do($connection,select * from events where id=$id);
$var = odbc_fetch_row($result);

// Now you have an array to work on
foreach($var as $line){
//Do your formatting thusly:
echo '
trtd' . $line[0] . '?td
td' . $line[1] . '/td
...
/tr
}


Hi,
 
Am using php to open a customer's msaccess file.
 
First time for everything.  It's a very small database of less then 25
rows, and will always be this small.
 
Am needing to return all the rows to a web page using php at all times.
Very simplistic.
 
Am apparently set up correctly on the DSN, and am able to do an
odbc_connect:
 
$connection = odbc_connect(meetings,,);
 
Am able to fetch rows, or so it seems:
 
$result = odbc_do($connection,select * from events where id=$id);
odbc_fetch_row($result);
 
Am not understanding how to print() the fields in the rows, one after
the next, on the same line, and then do the same with the next record,
until all records have been presented.
 
Sorry to be lame.  Any help would be gratefully received.
 
 
-Joe



RE: [PHP-DB] dump data, and save as a file

2003-02-14 Thread Gary . Every
Header(Content-type: text/plain);
Header(Content-Disposition: attachment; filename=topsellers_dvd.csv);


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


Hi everyone,
I want to dump some data from mysql into a file, and use php to force the
browser to pop a download file window.  This seems a simple procedure, but I
am having trouble to make it work with IE.  The following is what I did:


ob_start();
$query = SELECT * FROM table; 
$result=mysql_query($query); 
while($row=mysql_fetch_array($result)) 
{ 
   echo $row['data']; 
} 
header(Cache-control: private); 
header(Content-Type: application/txt); 
header(Content-Disposition: attachment; filename=test.txt);   
//Note: I also tried:  header(Content-Disposition: inline;
filename=test.txt); 

ob_end_flush(); 
*

It seems OK with Netscape, but with IE, all I got is all data displayed on
the screen even with ob_start().  I also tried echo the data after
header(), I have the same result.  I have spent a long time on this, and
searched for information on www.php.net, but can not find an answer.  Your
help is highly appreciated.

Thanks in advance.

Ruth



RE: [PHP-DB] MySQL problem -- new to PHP

2003-02-13 Thread Gary . Every
If you cut and pasted your code, try to put localhost into quotes as well.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 13, 2003 7:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL problem -- new to PHP


Hi all

I am new to PHP (just basically started yesterday). I am currently having a
problem connecting to a MySQL database.

My sample code is:

--
?php
mysql_connect(localhost,username,password) or die (Unable to connect to
MySQL server.);
$db = mysql_select_db(DB_NAME) or die (Unable to select requested
database.);
?
---

This throws the following error:

---
Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to
connect to this MySQL server
---

Now, the mySQL server and the web server reside on the same machine. This
warning is therefore saying that this machine does not have permission to
connect to itself. Hmm. I have put entries in the host table and the user
table, using both hostname and ip address, but no luck. I keep getting the
same error.

What am I doing wrong?

Any and all help appreciated.

Thanks

Evan Morris
[EMAIL PROTECTED]
+27 11 792 2777 (tel)
+27 11 792 2711 (fax)



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



RE: [PHP-DB] Code for drop down lists

2003-02-11 Thread Gary . Every
Always use a DB when you can, makes it much easier to change params.

Here's a snippet you can use:

### SELECT BOX CODE ###
  echo '
   tdSELECT NAME=change SIZE=1';
  $sql = SELECT * from ai.reports order by name;
   $selections = get_rowset($conn_id,$sql);
foreach($selections as $selection){
 echo 'OPTION';
  $reptmp = $selection['name'];
   if ($val == $reptmp){
echo ' SELECTED';
   }
  echo '' . $selection['name'];
}
  echo '/select/td';
  ##

CAVEATS:
The get_rowset is a function we've written for retrieving an array from the
DB
The if $val == $reptmp is to check for whatshould be selected


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Roland Perez [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 11:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Code for drop down lists


I am a novice to PHP and am trying toget a survey with drop down lists.
I am stuck as to if I should connect to the DB (MySQL DB) to get the
values from a table or do I imbed them in the php file?

Thanks for any help in advance.
Roland Perez
[EMAIL PROTECTED]

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



RE: [PHP-DB] Getting array values into a query

2003-02-10 Thread Gary . Every
Try this:
I use it so that I can add variable names to a db table, then access them
throughout the script.

## Get the report_conf variables
   $sql = SELECT *
   FROM report_conf;
$prefs = get_rowset($conn_id,$sql);
  foreach($prefs as $pref){
$foo = $pref['name'];
$$foo = $pref['name_value'];
  }

The array you'd be interested in is $prefs, and it looks like this:
$key[0] = 'var1';
$value[0] = 'blue';
$key[1] = 'var2';
$value[1] = 'green';

After running the above, then
$var1 = 'blue';
$var2 = 'green';

I'm sure you'll need to tweak it a little, but the secret its the $$foo
(with two $ signs)
If $foo = 'aname'
then $$foo = $aname

The get_rowset is a function I've written to symplify my code, it returns
rows in an array from the DB


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Michael Conway [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 07, 2003 4:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Getting array values into a query


I've been attempting to take the values from an array pulled from a
session to supply the variable in a WHERE clause. list() provides only
the first value as expected. implode() the last.  Any suggestions or
should I just load the values I want in the session through a query on
the previous script and call it directly to the function I want to use?

 

Michael Conway

[EMAIL PROTECTED]

(703) 968-8875

 




RE: [PHP-DB] function needed

2003-01-30 Thread Gary . Every
Use str_replace
$FQDN = www.domain.com
$domain_only =
str_replace(array('www.','.com','.mil','.edu','.org','.gov'),'',$FQDN);

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 24, 2003 8:20 PM
To: Shahar Tal
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] function needed


function get_domain($domain){
preg_match('/^(www.)?([A-Za-z_-]+).+$/',$domain,$arr);
return $arr[2];
}

Shahar Tal wrote:

Hey

I'm looking and wondering for a function, as i'm trying to do something,
and
here it is.

I'm using the SSI call :
 !--#echo var=HTTP_HOST --.
to get the domain name I am on. this will output

www.domain.com.

I would like to use PHP in order to take this string, the output, and cut
the www. and the .com from it, so only the domain will remain.
ofcourse we can also have situations whith .org and .net and even where
there's no www. but the main thing I need is to remove whats
after the second dot and before the first dot, along with the dots.

I don't mind writing all the posibilities to the function, ie, all the
possible extenstions that the function may need to cut, I just need it to
take
the text from the SSI, and cut everything but the domain part, which is
the address itself.

what would be the best way to do it?
thank you!!



  


-- 
The above message is encrypted with double rot13 encoding.  Any unauthorized
attempt to decrypt it will be prosecuted to the full extent of the law.




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



RE: [PHP-DB] denying access to folders/files

2003-01-09 Thread Gary . Every


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


This is fine and dandy, but how do I prevent that person from taking the
direct link to the file and giving it to someone else?

I'm sure there is a much better and simpler way. Idea's?

Answer: Use auto_prepend.php to authenticate the user.


Thanks in advance.

-- 
Darren Bentley [EMAIL PROTECTED]


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



RE: [PHP-DB] More linking problems but slightly OT

2002-12-19 Thread Gary . Every
Be sure to add http:// to the beginning of your URL, or the browser thinks
it is a local URL

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 11:12 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] More linking problems but slightly OT


Hi,

Now that I can store - and rebuild my link (URL), I'm having a problem
displaying them.

The links are being displayed into a frame and the link is being prefixed
with the default url for the frameset.

Does anyone know how I can get rid of the prefix?

Cheers

George


===

George Pitcher
HERON Technical Manager
Ingenta plc
23-38 Hythe Bridge Street, Oxford, OX1 2ET
T  +44 (0)1865 799137 direct
T  +44 (0)1865 799000 switchboard
F  +44 (0)1865 799134
E  [EMAIL PROTECTED]

www.ingenta.com
Ingenta: Empowering the exchange of academic and professional content
online.


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



RE: [PHP-DB] real time output

2002-12-17 Thread Gary . Every
Check out the flush() and ob_flush commands on www.php.net


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Art Chevalier [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 8:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] real time output


Hello,

I want to start a native process and capture the output while it is being
generated and display it to the screen.  I dont want to output to be
displayed on the screen all at once after the process completes.  As the
process returns output I would like it dynamically displayed to the screen.

Any ideas on how I can do this???

Thanks

Art



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



RE: [PHP-DB] Calendar

2002-10-18 Thread Gary . Every
Check out http://www.hotscripts.com and click on PHP, then Calendars


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:gary.every;ingramentertainment.com
http://accessingram.com


-Original Message-
From: Joran [mailto:joran.sorbo;teleweb.no]
Sent: Thursday, October 17, 2002 5:39 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Calendar


Hi!
Im new to PHP programming and need some help,
I want to put an event calendar on my site...
Functions I would like:
Customizeable, so i can make it fit my design

Calendar view:
A small month view on the side with clickabel days to view the event for
that day.

Event view:
Date, time, event

Admin site with login:
Add events

I would like this to run with a mySql database.

Is there anyone her who happens to have a script like this??
Anyone wants to make it??
Or anyone got a link for one that maches my request??

Please help...

Joran Sorbo :: Norway



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



RE: [PHP-DB] securing directory tree and allowing PHP to work

2002-08-20 Thread Gary . Every

Look into the PHP_AUTH_USER variable. It is assigned through basic
authentication.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: bmw [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 20, 2002 2:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] securing directory tree and allowing PHP to work


I am trying to find out how I can secure the directory tree of my PHP
scripts from the HTTP server without preventing access to my PHP scripts
once in session. Right now, if I type the URL of a subdirectory of my site,
I get the index of all the files and directories.

Ex:

http://domaine/index.html  has DB access user login and password for my
session authentication to enter into my scripts and run the program.


If I type http://domaine/subfolder/ I can see all the PHP code I want
without logging into my site. How can I protect the server from doing this
without busting access to my scripts through the login from the root level
index.html?

Apache/1.3.26 (Unix)/Linux mod_fastcgi/2.2.12 mod_perl/1.26
PHP 4.2.2

Robert




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002



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



RE: [PHP-DB] fiscal week??

2002-07-31 Thread Gary . Every

Look at the date functions at:
http://www.mysql.com/doc/D/a/Date_and_time_functions.html
and search for the date_format table
Within it you will see the following:


 
%U  Week (00..53), where Sunday is the first day of the week  
%u  Week (00..53), where Monday is the first day of the week  
%V  Week (01..53), where Sunday is the first day of the week. Used with '%X'

%v  Week (01..53), where Monday is the first day of the week. Used with '%x'


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Pierre-Alain Joye [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 8:25 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] fiscal week??


On Wed, 31 Jul 2002 21:19:00 +0800
Jason Wong [EMAIL PROTECTED] wrote:

 On Wednesday 31 July 2002 20:56, Dib, Walid (MED, Stagiaire GEMS) wrote:
  How can i print the fiscal week number on a web page??
 
 1) Work out an algorithm to calculate the fiscal week
 2) Implement algorithm in php

or simply use the pear::Date package :)

Do not be so rude with newcomers :)

pa

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



RE: [PHP-DB] encode/decode

2002-07-24 Thread Gary . Every

Try this syntax, it works for me

INSERT INTO users (name, password) VALUES ('$_POST[username]',
ENCRYPT('$_POST[password]','encrypt')

Explanation:
After VALUES, use
('variable', ENCRYPT('variable','key')

You've got it
('variable','ENCODE(variable,variable')
which makes the second entry actually a variable that contains
ENCODE($_POST[password], encrypt)

When you try to decode that, you'll get gobble-di-gook!


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Lisi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 3:11 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] encode/decode


I am trying to use encode/decode to store passwords in a database and then 
retrieve it to email to a user who has forgotten their password.

I am using the following code to encode the password:
INSERT INTO users (name, password) VALUES ('$_POST[username]', 
'ENCODE($_POST[password], encrypt)')

This does enter a binary entry into the database, presumably the encoded
data.

I then tried to retrieve the password using the following:
SELECT username, DECODE(password, 'encrypt') as password from users

but all I got was gobbledygook characters.

What am I doing wrong?

Thanks,

-Lisi


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



RE: [PHP-DB] header function

2002-07-16 Thread Gary . Every

You'll have to get rid of ALL html, including the BR in your code below.

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Mohammad Forouhar-Fard [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 15, 2002 4:51 PM
To: 'Steve Cayford'
Cc: [EMAIL PROTECTED]
Subject: AW: [PHP-DB] header function


Nothing it is only header function.
No I don't have anything outside.
In this case  I am connected to the DB.

if($v_action ==delete){
$DBquery($cfgDB[data],UPDATE $cfgTbl[accounts] SET acc_service='' WHERE
acc_id='$v_id') or die(cannot
UPDATE$cfgTbl[accounts]:br.mysql_error());
header(Location: list.php?message='T');
}

-Ursprüngliche Nachricht-
Von: Steve Cayford [mailto:[EMAIL PROTECTED]] 
Gesendet: Montag, 15. Juli 2002 23:18
An: Mohammad Forouhar-Fard
Cc: [EMAIL PROTECTED]
Betreff: Re: [PHP-DB] header function

What's on line 3 of Auth_user.php ?

If you have anything outside of the ?php ... ? tags it will start the 
html output. Even just an empty line.

-steve

On Monday, July 15, 2002, at 04:09  PM, Mohammad Forouhar-Fard wrote:


 Hi,
 I have a problem with   function  header(Location:xy.php?var=2).
  I have not any text (print echo or display any text) at all before I
 set a cookie
 If I try to execute this function of Apache server in my Company it is
 all OK. But if I try to run at home I have even the same error
 Cannot add header information - headers already sent by (output
started
 at
 C:\httpd\HTDOCS\Auth_user.php on line 3
 Can somebody help my I have at home  this configuration:
 I have Winxp  OmniHTTPd/2.09 Server.




 --
 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] Select a subset?

2002-07-15 Thread Gary . Every

I think the paging function is what you want

SELECT * from table limit 0,10
for the first ten records
SELECT * from table limit 11,20
for the next ten, etc.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Clive Bruton [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 14, 2002 2:50 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select a subset?


I'm just starting to play with PHP and MySQL, kind of getting my head 
around it, but one thing I'm not getting (right) is delivery of a subset 
of the found records from MySQL. ie if 100 are found how do I get records 
1-10 (or 11-20...).

What I have so far is:

 ?php
  $db = mysql_connect(host, pass);
  mysql_select_db(database,$db);
 ?

 ...

 ?php
  $result = mysql_query(SELECT * FROM table,$db);
  $num_rows = mysql_num_rows($result);

  echo $num_rows Rows\n;
  echo table border=1;
  echo trtdName/tdtdPosition/tr\n;

  while ($myrow = mysql_fetch_row($result)) {

   printf(trtd%s %s/tdtd%s/tr\n, $myrow[1], 
$myrow[2], $myrow[3]);
   }

  echo /table\n;
 ?

However, this delivers all 10,000+ rows on one HTML page.

I have worked out how to use LIMIT as an SQL command:

 $result = mysql_query(SELECT * FROM url LIMIT 10, 10,$db);

ie start at record 10 and show the next 10. But this delivers back 10 
as the $num_rows variable, when I want the total number of rows.

I don't really have to complete two querys to get the appropriate values 
do I?

I'm running PHP 4.2.1 on MacOS X 10.1.4.

TIA


-- Clive

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



RE: [PHP-DB] Populating multi-select list from mysql

2002-06-21 Thread Gary . Every



Hi all,

I'm having problems getting my multi-select list populated from a mysql
table. There is a table called categories with 2 columns (id and category).
I want to get all the items (category) and list them in the multi-select
list box.

This is the code I have so far:

$sql = SELECT category FROM categories;

$result = mysql_query($sql, $connection);

//Try This instead of the while statement
foreach($result as $row) {
echo 'OPTION VALUE=' . $row['category'] . '' . $row['category'];
}
echo '/select';





while ($row = mysql_fetch_array($result)) {
   $id = $row['id'];
   $category = $row['category'];
   $category_list .= $category;
   }
?


select name=category_list_array[] multiple size=10
?
for ($i=0; $icount($category_list); $i++) {
?
  option value=?=$category_list[$i]??=$category_list[$i]?/option

?}?
/select


Now, if I echo $category_list to the page I can see I have the correct data,
I just can't get it into the list box. I've seem to hit a wall on any
different ways to try and make this work. What am I doing wrong?

Thanks.

Rob.


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



RE: [PHP-DB] E-mail address verification

2002-06-20 Thread Gary . Every




I do it like this:


if (eregi(^[a-z0-9]+([\.%!][_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$,
$email))
{
  list($user, $host) = explode(, $email);
  if ( !checkdnsrr($host, MX) )
  return TRUE;
}
else
{
  return FALSE;
}
  }

As you can see, the email can look right, but domain isn't valid. So you
can check DNS record for MX domain.
Next step is to connect to mail server and verify user, but usualy that
takes time and it's better to send some kind of auth code to that mail and
if user conforms it, you can use it...

This worked very well. For any of you out there that are looking for a
simple verification with host dns lookup, here it is!!!

For a more comprehensive class check here, thanks to Manuel Lemos

http://www.phpclasses.org/emailvalidation




RE: [PHP-DB] MySQL won't return results to screen.

2002-06-07 Thread Gary . Every

Do you have SELECT permissions for your httpd user on the DB?

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Blaine Dinsmore [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 07, 2002 2:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL won't return results to screen.


Im using PHP 4.2.1, MySQL 4.23.49 and IIS 4.0 on a Windows NT 4.0 Server
machine. I have success when adding data to the database using PHP but
getting it to report to the webpage I have had no luck. I only get a blank
screen despite using error trapping for all mysql functions. Does anyone
know what this could be?

Thanks,

Blaine 


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



RE: [PHP-DB] cookies and Global variables

2002-06-06 Thread Gary . Every

When you get the Header already sent error, that means that you are trying
to send header info, e.g. cookie info AFTER you've already sent some header
info. This is usually seen when your php script has an include in it (above
your cookie stuff) that contains some html. Check your includes, and make
sure that the header info is the first thing sent.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Dib, Walid (MED, Stagiaire GEMS) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 2:06 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] cookies and Global variables


Hello


1) I want to use cookies for my site, how can I do it? My browser warn me
that headers are already sent!!

2) How can I use the same variables on all pages:
for example: $login, I need this variable on all pages to send
requests to a MySQL database.


Thanks 


DIB Walid








RE: [PHP-DB] query

2002-06-04 Thread Gary . Every

Instead of  use !=


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Natividad Castro [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 11:06 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] query


Hi to all,
can anyone please tell me what I'm doing wrong in this query?

This one doesn't work when I use  operator
INSERT INTO record_status(rec_id) select 150bk.ID from 150bk
WHERE PHY_ST'IN' Or PHY_ST'OR' Or PHY_ST'PA' Or PHY_ST'IA' Or
PHY_ST'MN' Or PHY_ST'CO' Or PHY_ST'ME' Or PHY_ST'TN' Or
PHY_ST'GA';

but this one works with = operator
INSERT INTO record_status(rec_id) select 150bk.ID from 150bk
WHERE PHY_ST='IN' Or PHY_ST='OR' Or PHY_ST='PA' Or PHY_ST='IA' Or
PHY_ST='MN' Or PHY_ST='CO' Or PHY_ST='ME' Or PHY_ST='TN' Or PHY_ST='GA';

Thanks in advanced

Nato


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