Re: [PHP-DB] I'm completely lost here

2012-08-24 Thread Gary Chambers
David,

 The database gets updated with a record, but all the fields end up being
 empty in the db. Can anyone see what's out of whack here? I'd appreciate
 the help.  http://pastebin.com/y8kcymnN

There isn't much context to your request and I don't see how your table is 
defined.  How are you assigning the values to the variables that you are trying 
to insert into the database?  Do you have register_globals enabled?

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



Re: [PHP-DB] I'm completely lost here

2012-08-24 Thread Gary Chambers
David,

 Just did that like Richard had suggested also and I do get the expected 
 results. I suspect I need to put the same thing in my query correct? like 
 this:
 
 mysql_query (INSERT INTO inventory(image, year, make, model,
 milage, price)VALUES($_POST['image'], $_POST['year'], $_POST['make'],
 $_POST['model'], $_POST['milage'] , $_POST['price']));

I might be stating the obvious here, but you should really validate your input. 
 If this is just an exercise or a simple test, that will work.  If it's an 
application that, especially, is accessible on the internet, you definitely 
need to validate and ensure that you're receiving sane input.

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



[PHP-DB] Pg Transactional Function

2012-08-22 Thread Gary Chambers
All,

I've written a procedural function to [hopefully] create less cluttered code 
when working with PostgreSQL transactions and I am soliciting criticism and 
suggestions on how to make it better (or to scrap it).

function db_exec_transaction($dbh, $query_and_params, $results_array, 
$error_str)
{
if (!is_array($query_and_params))
die('Queries and parameters variable must be an array type');

pg_query($dbh, 'begin');
foreach ($query_and_params as $i = $qp)
{
if (empty($qp['params']))
$stmt = pg_query($dbh, $qp['query']);
else
$stmt = pg_query_params($dbh, $qp['query'], $qp['params']);

if ($stmt === false)
{
$error_str = pg_last_error($dbh);
pg_query($dbh, 'rollback');
return false;
}
else
$results_array[] = $stmt;
}
pg_query($dbh, 'commit');
$error_str = null;
return true;
}

A lame and mostly useless example of how I intend to call it is as follows:

function foo_bar_handler($dbh)
{
$query_resources = array();
$queries = array();
$queries[] = array('query' = 'select * from foo for update',
   'params' = array());
$queries[] = array('query' = 'delete from foo',
   'params' = array());
$queries[] = array('query' = 'select * from bar where fizz = $1 and buzz = 
$2',
   'params' = array(42, 15));

$stmt = db_exec_transaction($dbh, $queries, $query_resources, $error_str);
if ($stmt === false)
{
echo $error_str . \n;
return false;
}

/* Fetch and do something with the results */
$rows = pg_fetch_all($query_resources[0]);
echo 'Rows retrieved: ' . pg_num_rows($query_resources[0]) . \n;
$the_answers = pg_fetch_all($query_resources[2]);

/* Release the resources */
pg_free_result($query_resources[0]);
pg_free_result($query_resources[1]);
pg_free_result($query_resources[2]);

return true;
}

Any comments, criticisms, or suggestions are very much appreciated.

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



[PHP-DB] UPDATE IF

2011-03-14 Thread Gary
I have a table in a mysql db that has 3 columns that I want to insert 
(update) data if the rowcolumn is empty (IS NULL).  However I want to start 
at the first column, if this column is not null, then move to insert the 
data into column 2, if that is empty, then insert data into column 3.

I have been looking over the manual and boards but am not finding a 
solution.

Can anyone point me in the right direction.

-- 
Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5952 (20110314) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



[PHP-DB] Cant Get Data

2011-02-21 Thread Gary
I have a 3 step form that calls the data from a mysql DB.  First is a 
dropdown to select a state, which then brings up a dynamically created check 
list of the counties in that state, so far all works well.  I am unable to 
get the checkbox choices to appear on the third page.

If someone could take a look at this and tell me where I am going wrong.

This is the code for the page that creates the checkboxes.  There are some 
extra lines in there where I was trying to get it to work. Again this works 
fine, but my guess is that see this may shed light.

   ?php
   $county1=$_SESSION['county$i'];
$counties=$_SESSION['counties'];
$row_name=$_SESSION['name'] = $row[name];
$count_choice=$_SESSION['name'];
$result1=$_SESSION['$result'];
$choice=$_POST['state'];
if ( isset($_POST['submit']) ) { // if form is submitted, process it

for($i=1; $i=$_POST['counties']; $i++) {
if ( isset($_POST[county$i] ) ) {
print $_POST[county$i]. is checked.br/;
}
}

} else { // if form isn't submitted, output the form
$county_choice=$_SESSION['county$1'];
print form action=\phpForm3.php\ method=\POST\\n;

/*$link = mysql_connect(, , );
mysql_select_db();*/
$result = mysql_query(SELECT * FROM `counties` WHERE state_id = '$choice') 
or die(mysql_error());

if ($result) {
print table width=200 border=1\n;

print thnbsp; /th\n;
print th State /th\n; //2 fields in Counties table, State and County
print th County /th\n;

print /tr\n;
//create table
$i = 0;
while ( $row = mysql_fetch_array($result) ) {
$i++;
print tr\n;

print tdinput type=\checkbox\ name=\county$i\ 
value=\$row[name]\/td\n;

echo td{$row['state_id']}/td\n;

echo td{$row['name']}/td\n;

echo /tr\n;

}//end while
print /table\n;
} else {
echo(PError performing query:  .
mysql_error() . /P);

}
print input type=\hidden\ name=\counties\ value=\$i\/\n;
print input type=\submit\ name=\submit\ value=\Go\/\n;
}


This is the page that I am unable to get to call the checkbox selections

?php
$count_choice1=$_SESSION['county$i'];
$count_choice2=$POST['counties'];
$count_choice3=$_POST['name'];
$result1=$_SESSION['$result'];
/*$count_choice=$_SESSION['name'];  */
$count_choice=$_POST['county$i'];
$choice=$_SESSION['name'];
$_POST[county$i];


$result = mysql_query(SELECT * FROM `counties` WHERE name = '$choice') or 
die(mysql_error());
/*$query  = mysql_query(SELECT * FROM counties );
$result = mysql_query($query) or die (Error in query: $query. 
.mysql_error());;
 echo $row['name'];
 echo $query;*/
while($row = mysql_fetch_array($result))
{
echo $row['name'];
 /*{$row['name']}br ;*/


}
echo $choice;
/*echo $_SESSION['county$i'];
echo $_SESSION['counties'];
echo $_SESSION['name'];
echo $count_choice;
echo $row['name'];
echo $county$1;
echo $counties;
echo $row_name; */
?
-- 

Any Suggestions?

Thank you.


Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5893 (20110221) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



[PHP-DB] Any good explanations of pg_send_execute and friends?

2010-04-27 Thread Gary .
Has anyone found anything in their travels around the web?

The manual is okay, but the examples are so simplistic it's difficult
to understand how it should really be used. For example, if I have a
loop of pg_send_execute based INSERT statements inside a transaction*,
and one of them fails, how and when do I check for that (given that
the pg_send_execute is asynchronous)?

* That is:
BEGIN
for (...)
{
  pg_send_execute(...);
}
COMMIT

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



[PHP-DB] PDOException: could not find driver (postgres)

2010-04-22 Thread Gary .
What could be causing this please? Going direct, using pg_connect, is
not a problem.

The code in question looks like
$pdo = new PDO('pgsql:host=localhost;port=5432;dbname=mydb', 'dbuser',
'dbpass');
(I think - I've yet to be able to debug it down to a single line)

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



Re: [PHP-DB] PDOException: could not find driver (postgres)

2010-04-22 Thread Gary .
On 4/22/10, Niel Archer wrote:
 What could be causing this please? Going direct, using pg_connect, is
 not a problem.

 Make sure you have the PDO
 postgres driver enabled in your php.ini, it does not use the same driver
 as the Postgres extension.

Aha! Okay, thanks! It's working now...

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



Re: [PHP-DB] Postgres - how to skip 'sequence' columns

2010-04-13 Thread Gary .
On 4/13/10, Chris wrote:
 Gary . wrote:
 Is it possible to skip column(s) in the target table when using
 pg_copy_from?
...
 It seems not from looking at the php manual.

 You could use http://www.php.net/manual/en/function.pg-put-line.php instead.

Yeah. I was hoping to use pg_copy_from to avoid looping over the array
in php, but I can do that. Thanks.

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



[PHP-DB] Fatal error: Call to undefined function pq_query()

2010-04-13 Thread Gary .
What the...

What is causing this? I can use pg_connect without complaint, why
does pq_query give this problem? PHP 5.3.1 FWIW.

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



Re: [PHP-DB] Fatal error: Call to undefined function pq_query()

2010-04-13 Thread Gary .
On Tue, Apr 13, 2010 at 10:40 AM, Firan Corneliu wrote:
 Are you sure you're not using q instead of g :)

Err. My first thought was What a strange thing to ask. Then I looked...

Thanks. I'd been looking at that for a good hour or so... *embarrassed*

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



[PHP-DB] Postgres - how to skip 'sequence' columns

2010-04-12 Thread Gary .
Is it possible to skip column(s) in the target table when using
pg_copy_from? When I tried to bulk insert some data from a csv
file by way of pg_copy_from I received the error Warning:
pg_copy_from() [function.pg-copy-from]: Copy command failed:
ERROR: permission denied for relation xyz, pretty much as I
expected since things look like:

CREATE SEQUENCE xyz;
CREATE TABLE some_table (
  id int NOT NULL PRIMARY KEY DEFAULT nextval('xyz')
...
(i.e. the first column is automatically populated by the db itself).

The csv file contains only data for the second and subsequent
columns, so anyway needs to hop right one column.

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



[PHP-DB] Injection Attack?

2010-02-25 Thread Gary
I have a DB on a site that is not really up anymore (a redirect because of a 
merger), and it seems to have been attacked.

I always use REMOTE_IP so that I have a record and able to ban IP's of the 
endless form spammers, however on this attack, the IP listed is my local IP 
(actually my old one since I changed ISP's).

I was wondering how they did this and how do I protect on other DB's.

Some of the other injected text inot almost every field is.

1 AND USER_NAME() =

\'; DESC users; --

1\' OR \'1\'=\'1

There is plenty more, however they submitted the form about 12 times per 
second.

Any thoughts?

Gary 



__ Information from ESET Smart Security, version of virus signature 
database 4895 (20100225) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP-DB] PHP- Mysql problem

2009-06-28 Thread Gary
Daniel,

Now that is just funny stuff...

Have you tried

http://lmgtfy.com/?q=access+denied+for+user+odbc+localhost

or the newer

http://www.lmbify.com/search.php?s=access+denied+for+user+odbc+localhost




Daniel Brown danbr...@php.net wrote in message 
news:ab5568160906180636r239f214eh7e4871da7139c...@mail.gmail.com...
 On Thu, Jun 18, 2009 at 06:03, NADARAJAH SIVASUTHAN
 NADARAJAHnsivasut...@live.com wrote:

 Warning: mysql_query() [function.mysql-query]: Access denied for user 
 'ODBC'@'localhost' (using password: NO) in 
 C:\wamp\www\ap_v5\inc\profile.inc.php on line 285

 http://google.com/search?q=Access%20denied%20for%20user%20'ODBC'@'localhost'%20(using%20password:%20NO)

 http://fart.ly/dm6m7

 -- 
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 



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



RE: [PHP-DB] change coldfusion to mysql/php

2008-05-08 Thread Gary Wardell
Hi,

I don't know of a tool, although there may be one.

If the pages are really simple I would think that it wouldn't be that hard to 
redo them by hand.

Gary

 -Original Message-
 From: Koller Michel [mailto:[EMAIL PROTECTED]
 Sent: Thu, May 08, 2008 7:26 AM
 To: php-db@lists.php.net
 Subject: [PHP-DB] change coldfusion to mysql/php
 
 
 Hello
 
 I have 3 simple Homepages, all makes with coldfusion.
 
 Now i must all tre Homepages change from coldfusion to PHP/MySQL.
 My question is, sombody know a tool thats can help me this to 
 realisize?
 (sorry for my bad english)
 
 Thanks
 M.K.
 
 
 
 -- 
 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] Parse error: syntax error, unexpected T_ELSE

2008-04-15 Thread Gary Wardell
Hi,

I suggest you echo $del_str to see exactly what your query is.

There may be something unexpected in $_GET['Id'].

Echo the whole query so you can see everything in context.

Gary

 -Original Message-
 From: Javier Viegas [mailto:[EMAIL PROTECTED]
 Sent: Tue, April 15, 2008 5:56 PM
 To: php-db@lists.php.net
 Subject: Re: [PHP-DB] Parse error: syntax error, unexpected T_ELSE


 Thanks Daniel i ´ve removed the unexpected else secction. Now
 it works but
 it tells me that there might be a syntax error on the query,
 this is good
 news because now i know i´m having connection with the
 database but also
 there must be something wrong with the query.

 $del_str = DELETE FROM libros WHERE bnumero=.$_GET['Id'];

 Is this correct, i´ve checked and the correct syntax to use
 would be delete
 from libros where bnumero='something';
 Given 'something' is taken from a variable called Id it seems
 reasonable to
 me the way it is written. Do you see anything wrong?

 Thanks again.


 On Tue, Apr 15, 2008 at 6:03 PM, Daniel Brown
 [EMAIL PROTECTED] wrote:

  On Tue, Apr 15, 2008 at 4:49 PM, Javier Viegas
 [EMAIL PROTECTED]
  wrote:
   Hi, i have this script wich basically connects to a
 database and delete
  a
record according to the Id parameter given. The problem
 is that when i
  test
it i get this error:
  
*Parse error*: syntax error, unexpected T_ELSE in *
/var/www/biblio/scripts/delete.php* on line *31
 
  Javier,
 
 This block:
 
  } else {
  $r_string = 'errorcode=4';
 
  }
 
   is incorrect.  You call an else condition on line
 21, so PHP
  expects that block to be the last for that if() condition.  Either
  remove the } else { and $r_string = 'errorcode=4'; lines
 or rewrite
  the condition.
 
 And if that's your real database login information, change it and
  update all of your scripts and systems ASAP.
 
 
  
This is the script:
  
*?php
/*
  deletescore.php:  deletes record for passed id from
 highscores table
  and
returns status to Flash
*/
// fill with correct data for your server configuration
$server = localhost;
$username = root;
$password = itsveryeasy;
$database = biblioteca;
  
//connect to database added by calm
mysql_connect($server, $username, $password);
  
if (!mysql_connect($server, $username, $password)) {
  $r_string = 'errorcode=1';
  
} elseif (!mysql_select_db($database)) {
  $r_string = 'errorcode=2';
  
} else {
  
 $del_str = DELETE FROM libros WHERE bnumero=.$_GET['Id'];
  
 if (!mysql_query ($del_str)) {
$msg = mysql_error();
$r_string = 'errorcode=3msg='.$msg;
 } else {
$r_string = 'errorcode=0';
 }
  } else {
 $r_string = 'errorcode=4';
  
}
  
echo $r_string;
?
  
Wha am i doing wrong??
  
Thanks.
  
Javier
  
 
 
 
  --
  /Daniel P. Brown
  Ask me about:
  Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
  and shared hosting starting @ $2.50/mo.
  Unmanaged, managed, and fully-managed!
 




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



Re: [PHP-DB] webserver script to localhost MySQL?

2008-03-22 Thread gary balkam

thanks.  I removed the additional ' at the end
and get this error (adding the echo as suggested)

http://testgbalkam.ipower.com/baddblog/

99.252.22.106
Warning: Cannot modify header information - headers already sent by (output 
started at 
/hermes/bosweb/web250/b2508/ipw.testgbalkam/public_html/baddblog/wp-config.php:11) 
in 
/hermes/bosweb/web250/b2508/ipw.testgbalkam/public_html/baddblog/wp-includes/functions.php 
on line 1438


Error establishing a database connection


- Original Message - 
From: Gary Wardell [EMAIL PROTECTED]

To: 'gary balkam' [EMAIL PROTECTED]
Sent: Saturday, March 22, 2008 4:57 AM
Subject: RE: [PHP-DB] webserver script to localhost MySQL?



Hi,

Usually the line number give is very accurate.


define('DB_HOST', '99.252.22.106:/tmp/mysql.sock'');//


Looks to me like the quote marks aren't matched.

Also, it may be that after you fix the quotes you will get another error.

I suggest displaying DB_HOST:

 echo(DB_HOST);

So you can verify that the ip address and port are picked up correctly.

Gary


-Original Message-
From: gary balkam [mailto:[EMAIL PROTECTED]
Sent: Fri, March 21, 2008 10:15 PM
To:  Subject: [PHP-DB] webserver script to localhost MySQL?


I'm pretty new to php and mysql.  And I just found this news
group about 4
minutes ago.
What I need to know, is how do I connect a wordpress
application, located on
a web server to a database located on my own computer.  The
reason for doing
this instead of syncing the dbs is the Sql server on the web
host is shared
and SLOW.  Mine only runs 1 maybe 2 databases.  wordpress and
maybe gallery
(maybe a forum later)

How can i do this?

URL is http://www.baddblog.info  changed this to

http://testgbalkam.ipower.com/baddblog/


here is the wp_config.php

?php
// ** MySQL settings ** //
define('DB_NAME', 'junior');// The name of the database
define('DB_USER', 'gbalkam'); // Your MySQL username
define('DB_PASSWORD', ''); // ...and password
define('DB_HOST', '99.252.22.106:/tmp/mysql.sock'');//
99% chance you
won't need to change this value define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

// You can have multiple installations in one database if you
give each a
unique prefix
$table_prefix  = 'wp_';   // Only numbers, letters, and
underscores please!

// Change this to localize WordPress.  A corresponding MO file for the
// chosen language must be installed to wp-content/languages.
// For example, install de.mo to wp-content/languages and set
WPLANG to 'de'
// to enable German language support.
define ('WPLANG', '');

/* That's all, stop editing! Happy blogging. */

define('ABSPATH', dirname(__FILE__).'/');
require_once(ABSPATH.'wp-settings.php');
?

This script as above generates this error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in
/home/content/g/b/a/gbalkam/html/wp-config.php on line 6

PHP on LOCALHOST
Apache Version Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8
OpenSSL/0.9.8g
mod_autoindex_color PHP/5.2.5

PHP on WEBSERVER
Activate/Deactivate Languages
 PHP Version PHP 5.x



The wordpress works on localhost under apache.
Any ideas why this isnt working?
Thanks in advance
php noobie
GBalkam









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



RE: [PHP-DB] webserver script to localhost MySQL?

2008-03-22 Thread Gary Wardell
Hi,

Ok, the warning is a warning and can safely be ignored since this debugging 
code.

It looks like your constant doesn't have a port number so questiuons you need 
to find out about:

Is it trying to connect on the proper port by default?  (My guess is no)

Or does the define need to be changed to set the proper port number?  (My guess 
is probably)

Or is the host you're trying to connect to unreachable?

Or is the port being blocked by a firewall?

Once you get the connection working you can remove the echo.

Gary

 -Original Message-
 From: gary balkam [mailto:[EMAIL PROTECTED]
 Sent: Sat, March 22, 2008 4:53 AM
 To: Gary Wardell; php-db@lists.php.net
 Subject: Re: [PHP-DB] webserver script to localhost MySQL?
 
 
 thanks.  I removed the additional ' at the end
 and get this error (adding the echo as suggested)
 
 http://testgbalkam.ipower.com/baddblog/
 
 99.252.22.106
 Warning: Cannot modify header information - headers already 
 sent by (output 
 started at 
 /hermes/bosweb/web250/b2508/ipw.testgbalkam/public_html/baddbl
 og/wp-config.php:11) 
 in 
 /hermes/bosweb/web250/b2508/ipw.testgbalkam/public_html/baddbl
 og/wp-includes/functions.php 
 on line 1438
 
 Error establishing a database connection
 
 
 - Original Message - 
 From: Gary Wardell [EMAIL PROTECTED]
 To: 'gary balkam' [EMAIL PROTECTED]
 Sent: Saturday, March 22, 2008 4:57 AM
 Subject: RE: [PHP-DB] webserver script to localhost MySQL?
 
 
  Hi,
 
  Usually the line number give is very accurate.
 
  define('DB_HOST', '99.252.22.106:/tmp/mysql.sock'');//
 
  Looks to me like the quote marks aren't matched.
 
  Also, it may be that after you fix the quotes you will get 
 another error.
 
  I suggest displaying DB_HOST:
 
   echo(DB_HOST);
 
  So you can verify that the ip address and port are picked 
 up correctly.
 
  Gary
 
  -Original Message-
  From: gary balkam [mailto:[EMAIL PROTECTED]
  Sent: Fri, March 21, 2008 10:15 PM
  To:  Subject: [PHP-DB] webserver script to localhost MySQL?
 
 
  I'm pretty new to php and mysql.  And I just found this news
  group about 4
  minutes ago.
  What I need to know, is how do I connect a wordpress
  application, located on
  a web server to a database located on my own computer.  The
  reason for doing
  this instead of syncing the dbs is the Sql server on the web
  host is shared
  and SLOW.  Mine only runs 1 maybe 2 databases.  wordpress and
  maybe gallery
  (maybe a forum later)
 
  How can i do this?
 
  URL is http://www.baddblog.info  changed this to
 http://testgbalkam.ipower.com/baddblog/
 
  here is the wp_config.php
 
  ?php
  // ** MySQL settings ** //
  define('DB_NAME', 'junior');// The name of the database
  define('DB_USER', 'gbalkam'); // Your MySQL username
  define('DB_PASSWORD', ''); // ...and password
  define('DB_HOST', '99.252.22.106:/tmp/mysql.sock'');//
  99% chance you
  won't need to change this value define('DB_CHARSET', 'utf8');
  define('DB_COLLATE', '');
 
  // You can have multiple installations in one database if you
  give each a
  unique prefix
  $table_prefix  = 'wp_';   // Only numbers, letters, and
  underscores please!
 
  // Change this to localize WordPress.  A corresponding MO 
 file for the
  // chosen language must be installed to wp-content/languages.
  // For example, install de.mo to wp-content/languages and set
  WPLANG to 'de'
  // to enable German language support.
  define ('WPLANG', '');
 
  /* That's all, stop editing! Happy blogging. */
 
  define('ABSPATH', dirname(__FILE__).'/');
  require_once(ABSPATH.'wp-settings.php');
  ?
 
  This script as above generates this error:
  Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in
  /home/content/g/b/a/gbalkam/html/wp-config.php on line 6
 
  PHP on LOCALHOST
  Apache Version Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8
  OpenSSL/0.9.8g
  mod_autoindex_color PHP/5.2.5
 
  PHP on WEBSERVER
  Activate/Deactivate Languages
   PHP Version PHP 5.x
 
 
 
  The wordpress works on localhost under apache.
  Any ideas why this isnt working?
  Thanks in advance
  php noobie
  GBalkam
 
 
 
 
  
 
 
 


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



[PHP-DB] webserver script to localhost MySQL?

2008-03-21 Thread gary balkam
I'm pretty new to php and mysql.  And I just found this news group about 4 
minutes ago.
What I need to know, is how do I connect a wordpress application, located on 
a web server to a database located on my own computer.  The reason for doing 
this instead of syncing the dbs is the Sql server on the web host is shared 
and SLOW.  Mine only runs 1 maybe 2 databases.  wordpress and maybe gallery 
(maybe a forum later)

How can i do this?

URL is http://www.baddblog.info
here is the wp_config.php

?php
// ** MySQL settings ** //
define('DB_NAME', 'junior');// The name of the database
define('DB_USER', 'gbalkam'); // Your MySQL username
define('DB_PASSWORD', ''); // ...and password
define('DB_HOST', '99.252.22.106:/tmp/mysql.sock'');// 99% chance you 
won't need to change this value define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

// You can have multiple installations in one database if you give each a 
unique prefix
$table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!

// Change this to localize WordPress.  A corresponding MO file for the
// chosen language must be installed to wp-content/languages.
// For example, install de.mo to wp-content/languages and set WPLANG to 'de'
// to enable German language support.
define ('WPLANG', '');

/* That's all, stop editing! Happy blogging. */

define('ABSPATH', dirname(__FILE__).'/');
require_once(ABSPATH.'wp-settings.php');
?

This script as above generates this error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in 
/home/content/g/b/a/gbalkam/html/wp-config.php on line 6

PHP on LOCALHOST
Apache Version Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8g 
mod_autoindex_color PHP/5.2.5

PHP on WEBSERVER
Activate/Deactivate Languages
 PHP Version PHP 5.x



The wordpress works on localhost under apache.
Any ideas why this isnt working?
Thanks in advance
php noobie
GBalkam



begin 666 spacer.gif
K1TE.#EA`0`!`( ``/___P```'Y! $`+ `!``$```(1 $`.P``
`
end


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



RE: [PHP-DB] Help with JOIN query

2008-03-06 Thread Gary Wardell
Hi,

The way I think I'd approach it is to use an outer join where table a is joined 
to a subquery where the subquery returns only the
max timestamp from table b.

Gary

 -Original Message-
 From: Graham Cossey [mailto:[EMAIL PROTECTED]
 Sent: Thu, March 06, 2008 5:17 PM
 To: J. Hill; php-db@lists.php.net
 Subject: Re: [PHP-DB] Help with JOIN query


 On Thu, Mar 6, 2008 at 9:54 PM, J. Hill [EMAIL PROTECTED] wrote:
  I may be a little confused: the desire is to return all the
 rows from
   TableA that match the record_id of a row in TableB that has the MAX
   timestamp?
 
   If so, why not something like:
 
   SELECT * FROM TableA a, TableB b WHERE a.record_id=b.record_id 
   timestamp=(SELECT MAX(timestamp) FROM TableB) ORDER BY action;
 
   I'm guessing I'm confused, that it's something more
 complicated you're
   looking for.
 

 Thanks Krister and all for your help thus far.

 Jeff, I'm after all rows from TableA then the latest action from
 TableB for each selected record in TableA.

 I'm starting to think maybe I should build an array of results using 2
 queries then sort the array using PHP functionality, but I'd rather do
 it in MySQL if it's possible.

 Graham

 --
 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] Help with JOIN query

2008-03-06 Thread Gary Wardell
Ahh, to bad, I started using it with 5.0.  I'm also a long time user of SQL 
Server.

Sorry if I caused confusion.

Gary
 


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



RE: [PHP-DB] Help with JOIN query

2008-03-06 Thread Gary Wardell
I know the feeling.

I've been trying to hookup MYSQL as a linked server on MS SQL Server.  There 
are a few articles out there that make mention of it
but no where does anybody say exactly how to do it.

Gary

 -Original Message-
 From: Graham Cossey [mailto:[EMAIL PROTECTED]
 Sent: Thu, March 06, 2008 6:33 PM
 To: Gary Wardell; php-db@lists.php.net
 Subject: Re: [PHP-DB] Help with JOIN query


 On Thu, Mar 6, 2008 at 10:59 PM, Gary Wardell
 [EMAIL PROTECTED] wrote:
  Ahh, to bad, I started using it with 5.0.  I'm also a long
 time user of SQL Server.
 
   Sorry if I caused confusion.
 
   Gary
 

 You were getting my hopes up there Gary :-(


 --
 Graham




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



RE: [PHP-DB] independent session data for multiple browser windows

2008-02-20 Thread Gary Wardell

 They'll be accessing different account records in different windows.
 I keep track of the current account id in the session data, as well
 as a number of other account-specific items. Once I was made
 aware of
 the multiple-window requirement, and started looking more closely at
 sessions, it seemed (from the PHP documentation) that I could
 start a
 new session, with a different name and id, and that would take care
 of it.  In fact I CAN start sessions with independent names and ids,
 but their DATA doesn't seem to be completely independent.


Assuming that they are interacting through forms on the pages in the different 
windows, why not put the UID of the record they are
accessing in a hidden field in the form?

Gary

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



RE: [PHP-DB] Password decryption

2008-02-17 Thread Gary Wardell
Hi,

Note from the manual:

PASSWORD() encryption is one-way (not reversible).

Also note:

===
Note
The PASSWORD() function is used by the authentication system in 
MySQL Server; you should not use it in your own applications.
For that purpose, consider MD5() or SHA1() instead. Also see RFC 2195, section 
2 (Challenge-Response Authentication Mechanism
(CRAM)), for more information about handling passwords and authentication 
securely in your applications.
===

The way to do it is to encrypt the response password from the logon and compare 
the encrypted versions; rather than decrypting for
the compare.

Gary

 -Original Message-
 From: Nasreen Laghari [mailto:[EMAIL PROTECTED]
 Sent: Sat, February 16, 2008 10:18 PM
 To: php-db@lists.php.net
 Subject: [PHP-DB] Password decryption


 Hi,

 I'm junior in PHP and stuck on Encryption.

 I have encrypted password using SQL :

 $query = insert into user (userid,password,) values
 ('$username',Password('$pass'));;

 Which is working perfect. Now I'm working on Login page where
 I have to compare passwords.. As password in database is
 encrypted so I need to decrypt it back for compression. I
 have tried the flowing but not working.

  if ($pwd != Password($info['password']))
   {
echo(-);
//header(Location: abuse.php);
   }

 and

  if ($pwd != $info(Password(['password']))
   {
echo(-);
//header(Location: abuse.php);
   }

 Could any one please help..

 Thank you



 __
 __
 Be a better friend, newshound, and
 know-it-all with Yahoo! Mobile.  Try it now.
 http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


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



RE: [PHP-DB] Importing CSV files to MySql Db issue.

2008-02-17 Thread Gary Wardell
Chris,

 If you're using spaces for enclosing then I'm sure you're not 
 handling 
 something properly.
 
 Chris,Carter,[EMAIL PROTECTED] -- 3 records
 Chris Carter,[EMAIL PROTECTED] -- 2 records
 

Don't you mean:

 Chris,Carter,[EMAIL PROTECTED] -- 3 *fields*
 Chris Carter,[EMAIL PROTECTED] -- 2 *fields*

And both only result in one record for each CSV line?

Or do PHP and MySql handle CSV files different from most other applications?

Gary

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



RE: [PHP-DB] odbc_connect - urgent

2008-01-10 Thread Gary Wardell
Hi,

You didn't mention which OS this is on.

If it's Windows, there is another factor.  The timeout in ODBC and OLEDB refer 
to the time the server on the other end takes to
complete the operation.  This is independent of the timeout set at the socket 
layer.  So, you could set the ODBC timeout to 10
seconds, but that doesn't change the socket timeout.  It will still wait for 
the 30 or 60 seconds, or whatever it is, before
abandoning the socket.

This is a Windows thing and has to do with the way they implemented sockets.

Gary

 -Original Message-
 From: iODBC Maintainer [mailto:[EMAIL PROTECTED]
 Sent: Thu, January 10, 2008 4:09 PM
 To: Gustavo Ramalho
 Cc: php-db@lists.php.net
 Subject: Re: [PHP-DB] odbc_connect - urgent


 HI Gustavo,


  Hi, im in serious problems.
  First sorry for bad english.
 
  Im try to connect with many servers to take some
 information, but when
  one of those is offline my script in php is fails and not proced.
  Did have any way to configure te odbc_connect timeout?? its
 take to many
  time to resolve take site is off or online. Im try to ping
 the server
  but sometimes the server of internet is not same the sql server.


 Unfortunately you cannot set the login timeout using the
 odbc_setoption
 like:

  odbc_setoption ($conn, 1, 103 /*SQL_LOGIN_TIMEOUT*/, 30)

 since the current php odbc layer cannot handle setting connection
 parameters before making an actual connection.

 However most ODBC drivers do have some capabilities to adjust
 timeouts.
 Which driver are you using to connect to sql server?


 Patrick

 --
 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] align

2008-01-01 Thread Gary Wardell

Or even if it's not in a table, put a div around it and use:  style= 
text-align: right  or equivalent css

Of course this assumes he's using html to display it.

Gary

 -Original Message-
 From: Bastien Koert [mailto:[EMAIL PROTECTED]
 Sent: Tue, January 01, 2008 11:21 AM
 To: arafat uddin; php-db
 Subject: RE: [PHP-DB] align
 
 
 
 assuming that the data sits in a table, right align the cell
 
 
 
 or use a css class to do the same thing
 
 
 
 bastien
 
  Date: Tue, 1 Jan 2008 14:56:34 +0600
  From: [EMAIL PROTECTED]
  To: php-db@lists.php.net
  Subject: [PHP-DB] align
  
  hi,
  i hav fall in a problem
  my problem is
  
  in the  table
  digit shows like below
  
   12,000.00
   6,000.00
   3,000.00
   1,00.00
  
  but i have to align from right
  like
   12,000 .00
 6,000 .00
 3,000 .00
   1,00 .00
  
  how it possible?
 
 _
 Read what Santa`s been up to! For all the latest, visit 
 asksantaclaus.spaces.live.com!
 http://asksantaclaus.spaces.live.com/
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



RE: [PHP-DB] Credit Card Encryption

2007-12-19 Thread Gary Wardell
Hmm,

This is kind of throwing a new twist on things.

When it comes to liability, who is liable, the merchant running the system, the 
develper that created the system, or both?

If the develper is included, would that be mitigated in that he created the 
system to the merchant's specifications?

Also, in terms of the developer, would this be covered under errors and 
omissions insurance, or would they take the position that
the developer should have known better and was negligent in creating a 
non-compliant system leaving the developer on the hook for
damages?

Gary

 -Original Message-
 From: Bastien Koert [mailto:[EMAIL PROTECTED]
 Sent: Wed, December 19, 2007 11:02 PM
 To: Daniel Brown
 Cc: Keith Spiller; php-db@lists.php.net
 Subject: RE: [PHP-DB] Credit Card Encryption



 Dan,

 Normally I would completely agree, its our job to find those
 solutions. Unfortunately, the sector that my FT job deals
 with is retail and many of our clients are in this bind with
 PCI data. Hefty fines are charged to those not in compliance.
 The major CC companies are taking this so seriously and the
 ramifications are being felt in many IT shops. Compliance
 failure can lead to loss o privileges to accept CCs.

 Its gonna force us to be more creative in how we handle the
 data and create the applications that allow our clients to
 offer ecommerce, we will have to learn some business skills
 to make this happen. It may mean that its becomes more
 contractual in dealing with third parties, where the ecommece
 shop effects payment on behalf of the vendors. The OP may
 need to help his client work out a better way to manage the
 transactions between the related parties by finding ways to
 automate the various transactions and provide gateway access...

 I, too, like to eat... ;-P

 bastien


  Date: Wed, 19 Dec 2007 17:21:57 -0500 From:
 [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re:
 [PHP-DB] Credit Card Encryption CC: [EMAIL PROTECTED];
 php-db@lists.php.net  On Dec 19, 2007 4:45 PM, Bastien
 Koert [EMAIL PROTECTED] wrote:   Nope, I still
 would not recommmend it. The only place the CC data should
 travel to is the payment gateway. Anything else is a security
 risk. Why does your client process by hand? They should be
 using a payment gateway.  That's true, Bastien, but if for
 whatever reason it's not an option for them, what? Tell them
 it's tough cookies and they're SOL?  Our job as programmers
 - especially freelance - is to make things happen as safely
 and securely as we can, but as a bottom line, make it
 happen. I'm sure we (most of us) take the responsibility to
 discourage a client from making such choices, and to educate
 them on alternatives that are better for their interests,
 but still - at the end of the day, we're still just code
 monkeys. We're expected to build what the client needs, or
 else they'll find someone else to do it for them.  And I
 don't really like to go hungry. ;-)  --  Daniel P. Brown
 [Phone Numbers Go Here!] [They're Hidden From View!]  If
 at first you don't succeed, stick to what you know best so
 that you can make enough money to pay someone else to do it for you.
 _
 Exercise your brain! Try Flexicon!
 http://puzzles.sympatico.msn.ca/chicktionary/index.html?icid=htmlsig

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



RE: [PHP-DB] Credit Card Encryption

2007-12-18 Thread Gary Wardell
And if you do store it, don't store it on the websderver.  Make sure it's on 
another server behind another firewall.

You don't want someone that hacks into your web server to have ready access to 
your database.

I think AES is supposed to be the best, then 3DES is next.  (That's 3DES, or 
triple DES, not DES)

But like Chris said: if you don't have to, dont do it.

But if you must, encrypt all of the personal information data points, not just 
the CC info.

Gary

 -Original Message-
 From: Chris [mailto:[EMAIL PROTECTED]
 Sent: Tue, December 18, 2007 9:30 PM
 To: Keith Spiller
 Cc: php-db@lists.php.net
 Subject: Re: [PHP-DB] Credit Card Encryption
 
 
 Keith Spiller wrote:
  Hi Everyone,
  
  I'm trying to determine the best method to store credit 
 card numbers in 
  a mysql database.  As yet I have been unable to determine whether I 
  should use MySQL AES, DES or a PHP encryption method.  I 
 would greatly 
  appreciate any advice you guys could offer.
 
 Why do you need to store c/c info? If at all possible, don't.
 
 If you're looking for something like recurring payments, use 
 paypal or 
 one of the other payment providers that support it.
 
 
 -- 
 Postgresql  php tutorials
 http://www.designmagick.com/
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



RE: [PHP-DB] UPDATE syntax

2007-12-13 Thread Gary Wardell
Hi,

I'm a beginner at PHP and MySql but a long time MS SQL server user.

Maybe it should be `advertisements`.`displayed` instead?

I just did a test and my Query browser doesn't like `interestcodes.id` but 
likes `interestcodes`.`id`.  Notice the quotes
(accents) on each side to the period.

Gary

 -Original Message-
 From: Ron Piggott [mailto:[EMAIL PROTECTED]
 Sent: Thu, December 13, 2007 7:20 PM
 To: php-db@lists.php.net
 Subject: [PHP-DB] UPDATE syntax


 Can anyone see something wrong with this syntax?

 UPDATE `advertisements` INNER JOIN `advertisements_rate_plans` ON
 `advertisements.rate_plan` = `advertisements_rate_plans.reference` SET
 `advertisements.displayed` = 0 WHERE `advertisements.start_date` =
 '2007-12-13' AND `advertisements.end_date` = '2007-12-13' AND
 `advertisements.approved` =1 AND `advertisements.paid` =1 AND
 `advertisements.displayed` =1 AND `advertisements_rate_plans.type` =2

 I am getting this error message:

 #1054 - Unknown column 'advertisements.displayed' in 'field list'

 There is a column called displayed in table advertisements.

 I am on the
 http://dev.mysql.com/doc/refman/5.0/en/update.html page and
 I am missing something.

 Ron

 --
 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] Form mail() problem

2007-12-09 Thread Gary Wardell
Hi,

This is an SMTP error, not a PHP error.  Since you imply the PHP code hasn't 
changed then something else must have changed.

First verify that the to address, [EMAIL PROTECTED] is still good buy sending 
and e-mail to it.

If that checks out OK, than check with the mail server administrator.  He may 
have tightened the SPAM controls by requiring SMTP
clients, like PHP, to authenticate before sending mail that relays.  Or perhaps 
the authentication credentials in place may have
changed.  Also, some mail server will allow relaying based on IP address.  If 
the mail server does that perhaps the IP address of
the web server has changed.  Either way, whatever authentication is used may 
need to be looked at and corrected.

I can't think of anything else that might be the problem.

Gary


 -Original Message-
 From: Tim Daff [mailto:[EMAIL PROTECTED]
 Sent: Mon, December 10, 2007 1:05 AM
 To: php-db@lists.php.net
 Subject: [PHP-DB] Form mail() problem


 I am just beginning with php, my first effort was a quote
 detail form
 that collects the user inputted data and makes and email out of it,
 which sends to my boss.  It worked fine for about 3 months
 now all of
 a sudden it has stopped, and made my boss angry.

 Any help I could get with this would be greatly appreciated.


 Here is the error code I am getting:

 Warning: mail() [function.mail]: SMTP server response: 550 5.7.1
 Unable to relay for [EMAIL PROTECTED] in
 C:\Domains\logosunlimited.com.au
 \wwwroot\contact\processquote3.php on line 284

 Here is the .php code:

 ?php

$name=$HTTP_POST_VARS['name'];
$email=$HTTP_POST_VARS['email'];
$phone=$HTTP_POST_VARS['phone'];
$catalog=$HTTP_POST_VARS['catalog'];
$notes=$HTTP_POST_VARS['notes'];
$code=$HTTP_POST_VARS['code'];
$qty=$HTTP_POST_VARS['qty'];
$company=$HTTP_POST_VARS['company'];
$postal=$HTTP_POST_VARS['postal'];
$screen=$HTTP_POST_VARS['screen'];
$customdetails=$HTTP_POST_VARS['customdetails'];
$embroidery=$HTTP_POST_VARS['embroidery'];

 // multiple recipients
 $to .= '[EMAIL PROTECTED]';

 // subject
 $subject = 'Online Quote';

 // message
 $message = '
 html
 head
 meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
 titleLogos Unlimited | Contact/title
 style type=text/css
 !--
 #tableLayout #tdMain p {
 }
 #tdFooter {
   text-align: center;
   font-size: 10px;
   vertical-align: middle;
   background-color: #FF;
 }
 .image {
   margin-bottom: 0px;
   padding-bottom: 5px;
   padding-top: 5px;
 }
 #tdBottom {
   text-align: center;
   font-size: 10px;
   vertical-align: middle;
 }
 #tdBottom img {
   text-align: center;
   font-size: 10px;
   vertical-align: middle;
   padding-top: 2px;
   margin-right: 5px;
   margin-left: 5px;
   width: 168px;
 }
 .suppliers {
   text-align: left;
   font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
 }
 h1 {
   font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
   font-size: 14px;
   font-style: normal;
   border-left-width: 7px;
   border-left-style: solid;
   border-left-color: #83ABD2;
   text-indent: 5px;
   font-weight: normal;
   margin-left: 20px;
   padding-bottom: 0px;
 }
 #tdMain p {
   text-align: left;
   padding-left: 30px;
 }
 #tdSpecials {
 }
 #tdSpecials a {
   border-top-width: 0px;
   border-right-width: 0px;
   border-bottom-width: 0px;
   border-left-width: 0px;
   border-top-style: none;
   border-right-style: none;
   border-bottom-style: none;
   border-left-style: none;
 }
 #tdSpecials img {
   border-top-style: none;
   border-right-style: none;
   border-bottom-style: none;
   border-left-style: none;
   padding-top: 30px;
 }
 #tdTest  p {
   text-align: left;
   padding-left: 30px;
 }
 #tdMain {
   font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
   font-size: 12px;
   color: #00;
   padding-top: 20px;
   padding-right: 25px;
 }
 #tdTest {
   font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
   font-size: 12px;
   color: #00;
   padding-top: 20px;
   padding-right: 25px;
   border-right-style: none;
   border-left-style: none;
   border-top-style: none;
   border-bottom-style: none;
 }
 #tdNavbar {
   text-align: left;
   text-indent: 60px;
   vertical-align: middle;
   font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
   padding-top: 0px;
 }
 #tableLayout {
   font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
   border: thin solid #848484;
   padding-top: 3px;
   background-image: url(http://www.logosunlimited.com.au/images/
 chair.gif);
 }
 #tableHome {
   font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
   padding-top: 3px;
   background-image: url(../newstyletest

[PHP-DB] Re: [PHP] RE: the opposite of a join?

2007-10-03 Thread Gary Josack
I agree with this. Never use a subquery when a join will work. The 
optimizer with thank you with performance.


James Ausmus wrote:

On 10/3/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  

Hi J,


Checkout this,


SELECT * FROM tbl_company where id not in (SELECT companyID from
tbl_contacts)

  

Brilliant! This is exactly what I was looking for, and is quite
logical/readable!  Thanks to everyone for the ideas!

J




No, don't do this! It is a very inefficient way to retrieve the
information you are looking for (Use a query analysis tool to check it
out yourself, if you want) - if your tables get to any larger size at
all, it will start having a noticeable performance impact on your
script (not to mention your DB) - let the DB do the hard work and use
a LEFT JOIN syntax, the database can optimize that much more
efficiently. Only if your DB doesn't support the LEFT JOIN syntax
would you want to do the above.

-James



  








Regards,
Lasitha Alawatta
Application Developer
Destinations of the World Holding Establishment
P O Box: 19950
Dubai, United Arab Emirates
( Ph +971 4 295 8510 (Board) / 1464 (Ext.)
7 Fax +971 4 295 8910
+ [EMAIL PROTECTED]

-Original Message-
From: John Pillion [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
  

On Behalf Of


[EMAIL PROTECTED]
Sent: Wednesday, October 03, 2007 2:21 PM
To: [EMAIL PROTECTED]; php-db@lists.php.net
Subject: [PHP-DB] the opposite of a join?

I have a company table and a contacts table.  In the contacts table,
there
is a field called companyID which is a link to a row in the company
table.



What is the easiest way to query the company table for all the company
rows
whose ID is NOT linked to in the contact table? Basically, the opposite
of a
join?



Thanks



J



DOTW DISCLAIMER:

This e-mail and any attachments are strictly confidential and intended
for the addressee only. If you are not the named addressee you must not 
  

disclose, copy or take


any action in reliance of this transmission and you should notify us as
soon as possible. If you have received it in error, please contact the
message sender immediately.
This e-mail and any attachments are believed to be free from viruses but
it is your responsibility to carry out all necessary virus checks and
DOTW accepts no liability
in connection therewith.

This e-mail and all other electronic (including voice) communications
from the sender's company are for informational purposes only.  No such
communication is intended
by the sender to constitute either an electronic record or an electronic
signature or to constitute any agreement by the sender to conduct a
transaction by electronic means.

  



  


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



[PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
I have a problem. I have done this before, but can't find the files. 

I am using the following function to upload files from a form.

foreach ($_FILES[pictures][error] as $key = $error) {
   if ($error == UPLOAD_ERR_OK) {
   echo $error_codes[$error];
   move_uploaded_file(
 $_FILES[pictures][tmp_name][$key],
 images/ .$_FILES[pictures][name][$key]
   ) or die(Problems with upload);
   }
}

I also need to insert the filenames of the uploaded files into a database.

There are three fields in my db for these filenames, image1 image2 and
image3. 

What would be the best way to get those filenames from the array into the
vars $image1 $image2 and $image3?

the first file in the array should be $image1 and so on.

Thanks in advance.




smime.p7s
Description: S/MIME cryptographic signature


RE: [PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
Sorry about that, not CC'ing the list...

the values are not always empty, they should always have something in
them...  

There should be 3 images uploading. But, I am sure just to make life
interesting,
there will be times when there could be as little as one uploaded.

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 30, 2006 10:10 PM
To: Gary E. Terry
Cc: PHP DB
Subject: Re: [PHP-DB] Arrays from forms

Gary E. Terry wrote:
 I don't know if we are on the same page here... Maybe we are and I am just
 an idiot.
 
 The fields in my db are image1 image2 and image3.
 
 There are only three fields in the form that is being passed to the
 php script. But, on the form they are named pictures[].
 
 Here is the full php I am using to process the form output:
 
 ?php
 include db.inc.back.php;
 foreach ($_FILES[pictures][error] as $key = $error) {
if ($error == UPLOAD_ERR_OK) {
echo $error_codes[$error];
move_uploaded_file(
  $_FILES[pictures][tmp_name][$key],
  bikeimages/ .$_FILES[pictures][name][$key]
) or die(Problems with upload);
${image.$key} = $_FILES['pictures']['name'];
}
 }
 
 $make = $_POST['make'];
 $model = $_POST['model'];
 $year = $_POST['year'];
 $color = $_POST['color'];
 $description = $_POST['description'];
 $status = $_POST['status'];
 
 $query = INSERT INTO `inventory` (`make`, `model`, `year`, `color`,
 `description`, `image1`, `image2`, `image3`, `status`)
 VALUES ('$make', '$model', '$year', '$color', '$description',
 '$image1', '$image2', '$image3', '$status');;
 
 $result = mysql_db_query($db, $query) or displayErrorQuery ($query);
 
 echo meta http-equiv='refresh' content='0;URL=inventorylist.php';
 ?
 
 
 $image1 $image2 and $image3 are not getting defined... Not real sure
what's
 going on.

Always cc the list so others can learn or suggest things.

Are you uploading 3 images? Maybe define them first as well:

foreach ($_FILES .. ) {
   ${image.$key} = ;

   if ($error == 


or do you mean the values are always empty?

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



smime.p7s
Description: S/MIME cryptographic signature


RE: [PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
If I print them, there's nothing. all three

Here is the same file, in test mode... 

?php
include db.inc.back.php;


foreach ($_FILES[pictures][error] as $key = $error) {
   if ($error == UPLOAD_ERR_OK) {
   echo $error_codes[$error];
   move_uploaded_file(
 $_FILES[pictures][tmp_name][$key],
 bikeimages/ .$_FILES[pictures][name][$key]
   ) or die(Problems with upload);
   ${image.$key} = $_FILES['pictures']['name'];
   }
}

$make = $_POST['make'];
$model = $_POST['model'];
$year = $_POST['year'];
$color = $_POST['color'];
$description = $_POST['description'];
//$image1 = $_POST['image1'];
//$image2 = $_POST['image2'];
//$image3 = $_POST['image3'];
$status = $_POST['status'];

echo $image1 -- $image2 -- $image3;
/*
$query = INSERT INTO `inventory` (`make`, `model`, `year`, `color`,
`description`, `image1`, `image2`, `image3`, `status`)
VALUES ('$make', '$model', '$year', '$color', '$description',
'$image1', '$image2', '$image3', '$status');;

$result = mysql_db_query($db, $query) or displayErrorQuery ($query);

echo meta http-equiv='refresh' content='0;URL=inventorylist.php';
exit;
*/
?

 I get  -- --  outputted.

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 30, 2006 10:39 PM
To: Gary E. Terry
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Arrays from forms

Gary E. Terry wrote:
 Sorry about that, not CC'ing the list...
 
 the values are not always empty, they should always have something in
 them...  
 
 There should be 3 images uploading. But, I am sure just to make life
 interesting,
 there will be times when there could be as little as one uploaded.

If you print them out what's in them?

echo $image1;
echo $image2;

I just realized that the $key probably starts at 0 instead of 1, so you 
might need to check that and then possibly:

${image.($key+1)} = $_FILES['pictures']['name'];

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



smime.p7s
Description: S/MIME cryptographic signature


RE: [PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
Nope...  here is the output.

-- -- Array ( [error] = )

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 30, 2006 10:56 PM
To: Gary E. Terry
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Arrays from forms

Gary E. Terry wrote:
 If I print them, there's nothing. all three
 
 Here is the same file, in test mode... 
 
 ?php
 include db.inc.back.php;
 
 
 foreach ($_FILES[pictures][error] as $key = $error) {
if ($error == UPLOAD_ERR_OK) {
echo $error_codes[$error];
move_uploaded_file(
  $_FILES[pictures][tmp_name][$key],
  bikeimages/ .$_FILES[pictures][name][$key]
) or die(Problems with upload);
${image.$key} = $_FILES['pictures']['name'];
}
 }

Hmm, looks ok.

If you:

print_r($_FILES[pictures]);

and

print_r($_FILES[pictures]['error']);

do you get stuff there ?

-- 
Postgresql  php tutorials
http://www.designmagick.com/


smime.p7s
Description: S/MIME cryptographic signature


RE: [PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
OK.. I am a moron.. Forgot that I had changed the name of the field in the
form, and got sidetracked and didn't change it in the
php... But, still not working correctly.

Here is the output: Array -- Array -- Array



 from:



?php
include db.inc.back.php;


foreach ($_FILES[pictures][error] as $key = $error) {
   if ($error == UPLOAD_ERR_OK) {
   echo $error_codes[$error];
   move_uploaded_file(
 $_FILES[pictures][tmp_name][$key],
 bikeimages/ .$_FILES[pictures][name][$key]
   ) or die(Problems with upload);
   ${image.($key+1)} = $_FILES['pictures']['name'];
   }
}

$make = $_POST['make'];
$model = $_POST['model'];
$year = $_POST['year'];
$color = $_POST['color'];
$description = $_POST['description'];
//$image1 = $_POST['image1'];
//$image2 = $_POST['image2'];
//$image3 = $_POST['image3'];
$status = $_POST['status'];

echo $image1 -- $image2 -- $image3;

/*
$query = INSERT INTO `inventory` (`make`, `model`, `year`, `color`,
`description`, `image1`, `image2`, `image3`, `status`)
VALUES ('$make', '$model', '$year', '$color', '$description',
'$image1', '$image2', '$image3', '$status');;

$result = mysql_db_query($db, $query) or displayErrorQuery ($query);

echo meta http-equiv='refresh' content='0;URL=inventorylist.php';
exit;
*/
?


smime.p7s
Description: S/MIME cryptographic signature


RE: [PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
I know you really meant :

${image.($key+1)} = $_FILES['pictures']['name'][$key];


And it works!!! 

Thanks oh so very much!

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 30, 2006 11:46 PM
To: Gary E. Terry
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Arrays from forms

Gary E. Terry wrote:
 OK.. I am a moron.. Forgot that I had changed the name of the field in the
 form, and got sidetracked and didn't change it in the
 php... But, still not working correctly.
 
 Here is the output: Array -- Array -- Array

Oops this:

${image.($key+1)} = $_FILES['pictures']['name'];

should be:

${image.($key+1)} = $_FILES['pictures'][$key]['name'];


-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



smime.p7s
Description: S/MIME cryptographic signature


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] Re: Passing url parameters

2004-10-07 Thread Gary Hotko
Got a question can one send a full array to another page with out
having out put each value stored in it manually?


On Sun, 03 Oct 2004 05:54:54 +0530, Amit Arora
[EMAIL PROTECTED] wrote:
 You can set this to anything you want.
 
 http://www.url.com?new_field=value
 
 And you can get the value using the
 $_GET['new_field']
 
 Amit
 www.digitalamit.com
 
 
 
 Stuart Felenstein wrote:
  I swear this is not a repeat of earlier post :)
 
  When passing variables via URL, my understanding is
  that the value passed is the database column name.
  What I don't understand is the name / label part.  It
  seems like the only name I can use is the same name as
  the value.
 
  i.e.
  Database column: Myfield
  Value: _get[Myfield]
  Name: Myfield  (this is the one I want to change, so
  my database column is not identified in the url)
 
  This make sense ?
  I hope this is not off topic.  If it is my apologies.
 
  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] 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] [RESOLVED] RE: Secure MySQL Access md5()

2004-05-14 Thread Theisen, Gary
Thanks for the info Hans!
I've got it working now.

-Original Message-
From: Hans Lellelid [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 13, 2004 7:28 PM
To: Gary Theisen
Cc: '[EMAIL PROTECTED]'
Subject: Re: Secure MySQL Access md5()


Hi,

Passwords in the mysql.users table must be encrypted using MySQL's 
native PASSWORD() function, not MD5().  With newer versions of MySQL, I 
think there is some change in this, but AFAIK for 4.0.18 this is still true.

When connecting to the database you always use the plaintext password, 
and MySQL will do the encrypting (using PASSWORD()) and check it against 
what is in the row of the users table.

HTH,
Hans

Gary Theisen wrote:

  
 Hi all,
  
 I've got:
  
 WinNT
 php 4.3.1
 phpmyadmin 2.5.6
 MySQL 4.0.18-nt
  
 I can connect to my db via my php script using:
  
 [php]
 $connection = mysql_connect (localhost, root, )
 [/php]
  
 That works no problem.
  
 This will not work however:
  
 [php]
 $somePass = md5(somePass);
 $connection = mysql_connect (localhost, someID, $somePass) [/php]
  
 gives me this error:
  
 [quote]
 Access denied for user: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' 
 (Using password: YES) [/quote]
  
 I set someID up in the db using phpmyadmin, with it's password using 
 the
 md5() function.  I can see via phpmyadmin that someID does indeed have a
32
 byte encrypted password stored.
  
 I can then compare the stored md5 password to the md5 password I'm 
 passing to try to connect...via $somePass.  The encrypted passwords 
 match exactly.
  
 Why wouldn't the match be confirmed...allowing me to connect?
  
 Thanks!
 

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



[PHP-DB] Secure MySQL Access md5()

2004-05-13 Thread Theisen, Gary
 
Hi all,
 
I've got:
 
WinNT
php 4.3.1
phpmyadmin 2.5.6
MySQL 4.0.18-nt
 
I can connect to my db via my php script using:
 
[php]
$connection = mysql_connect (localhost, root, )
[/php]
 
That works no problem.
 
This will not work however:
 
[php]
$somePass = md5(somePass);
$connection = mysql_connect (localhost, someID, $somePass)
[/php]
 
gives me this error:
 
[quote]
Access denied for user: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]'
(Using password: YES)
[/quote]
 
I set someID up in the db using phpmyadmin, with it's password using the
md5() function.  I can see via phpmyadmin that someID does indeed have a 32
byte encrypted password stored.
 
I can then compare the stored md5 password to the md5 password I'm passing
to try to connect...via $somePass.  The encrypted passwords match exactly.
 
Why wouldn't the match be confirmed...allowing me to connect?
 
Thanks!


[PHP-DB] No user table access to phpMyAdmin - How?

2004-05-10 Thread Theisen, Gary
Hi all,
 
Installed software/os:
 
Win NT 4.0
IIS 4.0
PHP 4.3.1
MySQL 4.1.1
phpMyAdmin 2.5.6
 
I'm wondering how I can hide phpMyAdmin access via a webpage to the
mysql.mysql tablespecifically the user table.
I don't want anyone using phpMyAdmin to have access to the user table.  I
only want to control that db  table through the command line on the server
itself.
How/What do I need to configure??
 
Thanks,
 
Gary


[PHP-DB] MySQL Password() PHP encryption?

2004-05-06 Thread Theisen, Gary
Hi all, 

I've recently upgraded my mysql to v 4.1.1 (on win nt 4.0) and set the
Passwords in the user table to the mysql Password() function. 

Now, this doesn't work anymore when call from a php web script (which is a
good thing, cause it's plain text): 

mysql_connect (localhost, theID, thePassord);

gives me this error: 

Client does not support authentication protocol requested by server ... 

Since my mysql.mysql user table now has the 41 bit encrypted passwords
stored...how to I connect with my php scripts? 

I've tried md5(), sha1()...but they don't generate the same 41 bit encrypted
password. 

Anyone have a suggestion? 

Thanks!



[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


  1   2   >