Re: [PHP-DB] String manipulation

2009-09-11 Thread boclair

Ron Piggott wrote:

How would I put a space after each letter:

echo str_shuffle(stripslashes(mysql_result($word_result,0,word));

Ron
  

CSS best handles styling

E.G.
   div style=letterspacing:0.5em;php echo $word_result;?/div
OR
   ?php
   print div style='letterspacing:0.5em;'$word_result/div;
   ?

Increase the em value to customize the spacing

Louise

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



[PHP-DB] Could not run query

2008-09-27 Thread boclair

I need help to track down the cause of the error,Could not run query

A typical query is

$laterrecords = mysql_query(SELECT * FROM messages WHERE `logged`  
$timebegin ORDER BY `logged` DESC ) or die (Cannot 
select:br$querybrError:  . mysql_error());


Louise

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



[PHP-DB] Highlighting data selected from one table that appear in another

2005-09-01 Thread boclair
Content-Type: multipart/alternative;
boundary=070700030402040702060708
X-Authentication-Info: Submitted using SMTP AUTH PLAIN at 
omta05ps.mx.bigpond.com from [138.130.220.111] using ID boclair at Thu, 1 Sep 
2005 11:49:59 +

This is a multi-part message in MIME format.
--070700030402040702060708
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

mysql 4.0.25
php 4.3.1

I seem to be unable to solve this problem without some help.

A webpage is to list all the clients in a  mysql  Client table.  Each 
client has an an allocated clid.

Those clients who are listed, identified by their allocated clid, in a 
Transactions are to be highlighted in different ways according to 
progress of the transaction, the progress being determined on whether 
date values have been inserted into various fields.

Since mysql select joining the tables lists only the clients whose 
appear in both tables.

I have been attempting to create a temporary table inserting the data 
from Client and Transactions  and selecting from that but not 
successfully yet. But is this the way to go about it.

The scale is an anticipated 1000 clients per month of which an 
anticipated 800 will involve transactions

Louise



--070700030402040702060708
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
  meta content=text/html;charset=ISO-8859-1 http-equiv=Content-Type
  title/title
/head
body bgcolor=#ff text=#00
font size=-1font face=Comic Sans MSmysql 4.0.25br
php 4.3.1br
br
I seem to be unable to solve this problem without some help.br
br
A webpage is to list all the clients in anbsp; mysql  Client table.nbsp; 
Each
client has an an allocated clid.br
br
Those clients who are listed, identified by their allocated clid, in a
Transactions are to be highlighted in different ways according to
progress of the transaction, the progress being determined on whether
date values have been inserted into various fields.br
br
Since mysql select joining the tables lists only the clients whose
appear in both tables.br
br
I have been attempting to create a temporary table inserting the data
from Client and Transactionsnbsp; and selecting from that but not
successfully yet. But is this the way to go about it.br
br
The scale is an anticipated 1000 clients per month of which an
anticipated 800 will involve transactionsbr
br
Louise br
br
br
/font/font
/body
/html

--070700030402040702060708--

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



Re: [PHP-DB] Highlighting data selected from one table that appear in another

2005-09-01 Thread boclair



Miles Thompson wrote:


At 08:50 AM 9/1/2005, boclair wrote:


Content-Type: multipart/alternative;
boundary=070700030402040702060708
X-Authentication-Info: Submitted using SMTP AUTH PLAIN at 
omta05ps.mx.bigpond.com from [138.130.220.111] using ID boclair at 
Thu, 1 Sep 2005 11:49:59 +


This is a multi-part message in MIME format.
--070700030402040702060708
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

mysql 4.0.25
php 4.3.1

I seem to be unable to solve this problem without some help.

A webpage is to list all the clients in a  mysql  Client table.  Each
client has an an allocated clid.

Those clients who are listed, identified by their allocated clid, in a
Transactions are to be highlighted in different ways according to
progress of the transaction, the progress being determined on whether
date values have been inserted into various fields.

Since mysql select joining the tables lists only the clients whose
appear in both tables.

I have been attempting to create a temporary table inserting the data
from Client and Transactions  and selecting from that but not
successfully yet. But is this the way to go about it.

The scale is an anticipated 1000 clients per month of which an
anticipated 800 will involve transactions

Louise



It sounds like you need an OUTER JOIN, which lets you fetch all the 
records from table A and table B that match, as well as the 
non-matching records from table B. The MySQL documents are a little 
confusing, here's a good article:

http://www.onlamp.com/pub/a/onlamp/2001/06/27/aboutSQL.html


Miles,

Exactly the way to handle this, LEFT OUTER JOIN.  I only thought I 
understood how to do these joins. Good article simply written for a 
simple brain.


Many thanks.
Louise

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



[PHP-DB] Re: Highlighting data selected from one table that appear in another

2005-09-01 Thread boclair



Frank Flynn wrote:




But if you could be more specific - send the schema and precisely what 
you were looking to do I could give you an example of how to make it work.



I am still having difficulties with my workup and more help would be 
appreciated . 


I have two tables


CREATE TABLE `clients` (
 `id` tinyint(4) NOT NULL auto_increment,
 `clid` varchar(5) NOT NULL default '',
 `clfname` varchar(50) NOT NULL default '',
 `cllname` varchar(30) NOT NULL default '',
 PRIMARY KEY  (`id`),
 UNIQUE KEY `clid` (`clid`)
) TYPE=MyISAM COMMENT='workup table for client data';

CREATE TABLE `transactions` (
 `id` tinyint(4) NOT NULL auto_increment,
 `fmid` varchar(5) NOT NULL default '',
 `clid` varchar(5) NOT NULL default '',
 `bdate` date NOT NULL default '-00-00',
 `instr` mediumtext,
 `ecom` decimal(5,2) default NULL,
 `efdate` date default '-00-00',
 `acom` decimal(5,2) default NULL,
 `afdate` date default '-00-00',
 `transid` varchar(10) NOT NULL default '',
 PRIMARY KEY  (`id`,`fmid`),
 UNIQUE KEY `transid` (`transid`),
 KEY `fmid` (`fmid`)
) TYPE=MyISAM;  COMMENT='workup table for transaction data';

What is needed is to display a list of all clients each denoted 
applicably as

1.. No entry in transaction table  (client's clid not in transaction table)
2.. Client not yet interviewed ( instr empty, efdate default value and 
afdate default value)
3.. Client interviewed  ( instr !empty, efdate=default value and 
afdate=default value)
4.. Client's transaction in progress ( instr !empty, efdate!=default 
value and afdate=default value)
5.. Clients transaction finalised ( instr !empty, efdate!=default value 
and afdate!=default value)



What I appear to be getting is
LEFT JOIN only selects those clients with a matching clid in both tables

LEFT OUTER JOIN selects all clients with the appropriate 
transaction.fmid (for example) except when the client.clid is not 
matched by a transaction.clid when a spurious fmid is given.
   SELECT * FROM clients LEFT OUTER JOIN transaction ON 
clients.clid = transactions.clid ORDER BY clients.cllname ASC


I am obviously handling the join incorrectly.

Louise

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



[PHP-DB] Parsing PHP sourced from blob

2005-04-18 Thread boclair
When a php statement is part of a markup snippet in a mysql database
table field, what must be done to have the php parse in the html
A simple demo demonstrating my problem is at
http://www.boclair.com/test/blobvars.php
Louise
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Displaying the time of the Latest Update to an ISAM table

2005-02-20 Thread boclair
PHP 4.3.10
MySql 4.0.20
How do I find and then display on a web page the time that additional 
data added to, or,  existing data amended in an ISAM table?

My latest futile attempt , with connection made and the database already 
selected,

?PHP
$logged = mysql_query(SHOW TABLE TABLE UPDATE_TIME from  members);
if (!$logged) {$logged=not found;}
else {$logged=$logged;}
?
pLast logged: ?PHP =$logged;?/p
With no errors reported, the display is not found.
Louise



Re: [PHP-DB] Displaying the time of the Latest Update to an ISAM table

2005-02-20 Thread boclair
Typo. Sorry.  Should read of course
SHOW TABLE STATUS UPDATE_TIME
Louise
boclair wrote:
PHP 4.3.10
MySql 4.0.20
How do I find and then display on a web page the time that additional 
data added to, or,  existing data amended in an ISAM table?

My latest futile attempt , with connection made and the database 
already selected,

?PHP
$logged = mysql_query(SHOW TABLE TABLE UPDATE_TIME from  members);
if (!$logged) {$logged=not found;}
else {$logged=$logged;}
?
pLast logged: ?PHP =$logged;?/p
With no errors reported, the display is not found.
Louise



Re: [PHP-DB] putting strings together with a linefeed

2004-04-16 Thread boclair
- Original Message - 
From: Hull, Douglas D [EMAIL PROTECTED]

For example, say I have a variable $mytext = 'what up doc'.  Now I want to
add the text 'not much' to the end of this variable.  But I want to place a
return or linefeed after the original text so when I echo $mytext it looks
like:

what up doc
not much

I tried:
$mytext = 'what up doc';
$mytext .= chr(10) . 'not much';I also tried chr(13)

10 is linefeed and 13 is carriage return.


What is missing is the markup interpreted by the browser.  (Check the source
after the script is processed).  Something like this perhaps?

?
$mytext = p style='margin:0'what up doc/p;
$mytext .= chr(10) . p style='margin:0'not much/p;
?
p?=$mytext;?/p

The source of the document received from the server as text/html reads

p style='margin:0'what up doc/p
p style='margin:0'not much/p

and this is interpreted and displayed by the browser as

what up doc

not much



Louise

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



Re: [PHP-DB] Changing colors in table?

2002-09-30 Thread boclair


- Original Message -
From: Blue Tiger [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 01, 2002 10:13 AM
Subject: RE: [PHP-DB] Changing colors in table?


: The blank table column comes from a blank MySQL database field...(I was
: initially going to blob images from there to show status change). If you
: know of a way to eliminate the database field and still show the status
: of the values in a web table, please point me in the right direction.

:  I have a piece of code that displays an array from a MySQL table. One
:  field in the table is blank (and is displayed as an empty column of
:  cells) at the moment. I want to have the blank cells display an
: image,
:  value, or change its background color based on whether the numerical
:  values in the previous 4 fields meet certain criteria or not. Make
:  sense? Maybe?
: 
:  An example of what I want to show:
:  If table 2 has a value that is less than 5, then the last cell
:  displayed
:  changes color to reflect that.
:  If table 2 has a value that is between 5 and 10, then the last cell
:  displayed changes color to reflect that as well.

Ryan,

I understand you want to display the results of a db query in an html
table.  Maybe I misunderstand but it seems that this shouldn't be done by
fiddling with the database table;  fiddle with the html table instead

open mysql server
do select $result
start while loop on mysql-fetch-array($result) {
set
$summedfields = (sum field values);

if ($summedfields  == 2) {
$bgclr=red;
}
else {
$bgclr=blue;
}

if ($blankfield == NULL) {
 $blankfield = img src='image.gif' etc;
}

iterate on table row
use $blankfield and $bgclr as values the html table data cells

eoe

Louise


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




Re: [PHP-DB] Indepth Tutorial... need help.

2002-09-03 Thread boclair

http://www.mysql.com/doc/en/Tutorial.html is a good place to start with the
mysql functions in the php manual.

http://www.devshed.com/Server_Side/  has a number of on line tutes amongst
others.

phpbuilder also is useful.  The normalisation article is a good first step; it
is at
http://www.phpbuilder.com/columns/barry2731.php3

Tim Morris


- Original Message -
From: Matt Zur [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, September 03, 2002 11:08 PM
Subject: Re: [PHP-DB] Indepth Tutorial... need help.


: Right well that's what I'm asking I need a tutorial and haven't found a
: good one.
:
: -Matt
:
: Rasmus Lerdorf wrote:
:  Most of this stuff is actually just SQL and has little to do with PHP.  So
:  look for an SQL tutorial.  From the PHP side all you need to know is
:  mysql_connect(), mysql_select_db(), mysql_query() and mysql_fetch_row().''
: 
:  All queries are sent to the database via mysql_query().  It doesn't matter
:  to PHP if you are adding, deleting, modifying, searching, sorting,
:  filtering, or whatever.  You just put the SQL code in the mysql_query()
:  call.
: 
:  -Rasmus
: 
:  On Tue, 3 Sep 2002, Matt Zur wrote:
: 
: 
: Can someone point me in the direction of an online tutorial for php
: mysql that covers the following:
: 
: - Teaches me how to use php to access mysql
: - Creating a db that is structured to be efficient
: - How to add, modify, and delete records in a database
: - How to search for records
: - How to filter records
: - How to sort records, by a certain field, alphabetical, descending etc.
: - Indexes - how to create them, how to keep the updated with changes in
: the db a beginners look to in-depth approach.
: 
: Yes I've visited PHP.net, and mysql.com.  I need a dumbed down version
: that pretty much holds my hand and is very detailed.  I've searched the
: net for a while now, and all the tutorials I have found... although
: simple... they don't go in-depth and move on to more advanced features.
: 
: Any help at all will be greatly appreciated.
: 
: -Matt
: 
: 
: --
: Matt Zur
: [EMAIL PROTECTED]
: http://www.zurnet.com
: 
: Need a Web Site??? - Visit... www.zurnet.com
: 
: 1997 - 2002 - 5th Anniversary!!!
: 
: 
: --
: PHP Database Mailing List (http://www.php.net/)
: To unsubscribe, visit: http://www.php.net/unsub.php
: 
: 
: 
:
:
: --
: Matt Zur
: [EMAIL PROTECTED]
: http://www.zurnet.com
:
: Need a Web Site??? - Visit... www.zurnet.com
:
: 1997 - 2002 - 5th Anniversary!!!
:
:
: --
: 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] Nothing returned

2001-11-03 Thread boclair


- Original Message - 
From: Martin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, November 04, 2001 8:29 AM
Subject: [PHP-DB] Nothing returned


: Why am I not getting anything returned from this function?
: I have code doing a if user exists and b if user doesn't exist. I'm not 
: getting any numRows result apparently. The query is OK and returns 1 user 
: for $name=admin. I'm not getting any errors from isError.
: 
: Martin
: 
: function exists($name)
: {
: 
: $sql = SELECT * FROM users WHERE (name='$name');

How about 
$name=admin

and 
WHERE name=$name

Tim Morris


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




Re: [PHP-DB] Date_Format Question

2001-08-29 Thread boclair


- Original Message -
From: Jeff Oien [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Thursday, August 30, 2001 11:07 AM
Subject: [PHP-DB] Date_Format Question


 I have a date like this in date format in MySQL
 2001-08-29

 and I want it to say
 August 29, 2001

 I tried this and it didn't work.
 select date_format('creation_date', '%b %D, %Y') from Chart_Users;

Perhaps

$result= SELECT date_format(creation_date,'%b%D,%y') AS created  FROM
db.Chart_Users;

Then from the array $myrow['created']   instead of
$myrow['creation_date']

Tim Morris


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




Re: [PHP-DB] Date_Format Question

2001-08-29 Thread boclair


- Original Message -
From: boclair [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED]
Sent: Thursday, August 30, 2001 1:09 PM
Subject: Re: [PHP-DB] Date_Format Question



 - Original Message -
 From: Jeff Oien [EMAIL PROTECTED]
 To: PHP-DB [EMAIL PROTECTED]
 Sent: Thursday, August 30, 2001 11:07 AM
 Subject: [PHP-DB] Date_Format Question


  I have a date like this in date format in MySQL
  2001-08-29
 
  and I want it to say
  August 29, 2001
 
  I tried this and it didn't work.
  select date_format('creation_date', '%b %D, %Y') from Chart_Users;

 Perhaps

 $result= SELECT date_format(creation_date,'%b%D,%y') AS created
FROM
 db.Chart_Users;

 Then from the array $myrow['created']   instead of
 $myrow['creation_date']


The formatting you need is %M %d, %Y.  Careless of me.

Tim Morris


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




Re: [PHP-DB] MySQL Connect Problem

2001-05-16 Thread boclair


 Here is sample code:
 ?
 $connection = @mysql_connect(localhost, jeff, *)
 or die(Couldn't connect.);
 if ($connection) {
 $msg = success!;
 }
 ?

 This is on my machine only used by me. I also tried connecting to
 IP address and 127.0.0.1 and it still won't work. Thanks.
 Jeff Oien

Are your the 'root' rather than 'jeff'?  Did you alter the grants and
apply the password? If not do you need  a password for connection?

Tim Morris


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




Re: [PHP-DB] Forms : Validating user input is integer

2001-04-08 Thread Boclair

Manuel,

Manuel Lemos [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
| Hello boclair,
|
| On 05-Apr-01 01:58:24, you wrote:
|
| I have a problem with a user input in a form required to be an
| integer, creating a variable for a mysql query.
|
| I have instances where integer, 0, is being typed as letter,o.
|
| You may want to try this PHP form generation and validation class
that does
| exactly what you need and more.
|
| http://phpclasses.UpperDesign.com/browse.html/package/1
|
|
| It does both client and server side validation.  For the client side
it
| uses the isNaN(parseInt(value)) Javascript functions.  For the
server side
| it uses the strcmp($value,strval(intval($value))) PHP functions .
|
|
| Regards,
| Manuel Lemos
|
| Web Programming Components using PHP Classes.
| Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED]
| --
| E-mail: [EMAIL PROTECTED]
| URL: http://www.mlemos.e-na.net/
| PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp

I downloaded the files and am studying them.

Certainly comprehensive.

Many thanks

Tim Morris


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




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




[PHP-DB] RE : [PHP-DB] Forms : Validating user input as integer

2001-04-07 Thread boclair

Manuel,

Manuel Lemos [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
| Hello boclair,
|
| On 05-Apr-01 01:58:24, you wrote:
|
| I have a problem with a user input in a form required to be an
| integer, creating a variable for a mysql query.
|
| I have instances where integer, 0, is being typed as letter,o.
|
| You may want to try this PHP form generation and validation class
that does
| exactly what you need and more.
|
| http://phpclasses.UpperDesign.com/browse.html/package/1
|
|
| It does both client and server side validation.  For the client side
it
| uses the isNaN(parseInt(value)) Javascript functions.  For the
server side
| it uses the strcmp($value,strval(intval($value))) PHP functions .
|
|
| Regards,
| Manuel Lemos
|
| Web Programming Components using PHP Classes.
| Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED]
| --
| E-mail: [EMAIL PROTECTED]
| URL: http://www.mlemos.e-na.net/
| PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp

I downloaded the files and am studying them.

Certainly comprehensive.

Many thanks

Tim Morris


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




Re: [PHP-DB] Forms : Validating user input is integer

2001-04-05 Thread boclair

Thanks Steve,

It is not my choice re javascript in this case

I have tried to use the functions is_int($input_var) and
is_integer($input_var)  and the !versions as you suggest but with
failures.

Example 1_

if ((@!$submit) || (!is_int($input_var)) )
  {
   echo "error";
   include "get_id.php";
   }

else {


_Example 2_

if ((@!$submit))
  {
   echo "error";
   include "get_id.php";
   }

elseif (is_int($num)) {
_

There were no problems before attempting validation with is_int() and
is_integer().  The integer validation was being with a javascript and
the creation of the variable was OK.

Further advise appreciated.

Tim




- Original Message -
From: Steve Farmer [EMAIL PROTECTED]
To: boclair [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, April 05, 2001 3:23 PM
Subject: Re: [PHP-DB] Forms : Validating user input is integer


 Hi tim,

 most certainly it can be done on the server side, it juts requires a
 round trip to the server is all

 i think it is ..

 if(!isinteger($input_var)): (check the exact function in the php
manual)
   echo "this is an error (or whatever), press here to go back and
 correct your inpout";
 exit; /* stops the script executing */
 endif;

 HTH
 Steve

 At 3:05 PM +1000 5/4/01, boclair wrote:
 I have a problem with a user input in a form required to be an
 integer, creating a variable for a mysql query.
 
 I have instances where integer, 0, is being typed as letter,o.
 
 The last discussion of validating the input was
 http://marc.theaimsgroup.com/?l=php-dbm=97207172003983w=2
 
 There it was suggested that the only way to validate the input was
 using javascript.  I have a case where clients have disabled
 javascript.
 
 I tried fiddling with is_int($input) but of cause it does not serve
 this purpose.
 
 Does anybody know if such validation can be done server side or
 definitely must be done client side?
 
 Tim Morris
 
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
[EMAIL PROTECTED]

 --
 ---
 "Minds are like parachutes, they work best when open"
 Support free speech; visit http://www.efa.org.au/

 Heads Together Systems Pty Ltd http://www.hts.com.au
 Email: [EMAIL PROTECTED] Tel: 612 9982 6767 Fax: 612 9981 3081

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




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




Re: [PHP-DB] Forms : Validating user input is integer

2001-04-05 Thread boclair


- Original Message -
From: Matt Williams [EMAIL PROTECTED]
To: boclair [EMAIL PROTECTED]
Sent: Thursday, April 05, 2001 9:03 PM
Subject: RE: [PHP-DB] Forms : Validating user input is integer



  To gain the full benefit of your suggestion I find that I can
validate
  for a wrong entry containing  a mix alphabetical and numerical
  characters  by altering the elseif line to read
 
  elseif (!eregi("[0-9]",$num) || eregi("[a-z]",$num))
 
  Agreed?
 

  yes and no.

 I've done a lot of testing for this and using just the first one has
never
 let any values of $num through unles they've contained only numbers.
 AFAIK (!eregi("[0-9]",$num) should always return false or 0 or
whatever it
 is unless it contains only numbers.


When I used  only  elseif (!eregi("[0-9]",$num) { }
an input 2i passed the variable 2


 You could also use [^a-zA-Z] for letters you don't want.
 so maybe something like  (!eregi("([0-9]||[^a-zA-Z])",$num))
 not tried so don't rely on that.

xx
correcting some typos this does the job elegantly.  Should read

elseif (!eregi(("[0-9]" || "[^a-zA-Z]"),$num)){  }
xx

 Check out the phpbuilder.com regexp tutorial, I find it a good
resource
 http://www.phpbuilder.com/columns/dario19990616.php3

Have read it and got confused.  Will re-read it with my eyes open.

Thanks for holding my hand.

Tim



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




Re: [PHP-DB] Forms : Validating user input is integer

2001-04-05 Thread Boclair


"boclair" [EMAIL PROTECTED] wrote in message
004801c0bdc7$13afbe00$[EMAIL PROTECTED]">news:004801c0bdc7$13afbe00$[EMAIL PROTECTED]...
|
| - Original Message -
| From: Matt Williams [EMAIL PROTECTED]
| To: boclair [EMAIL PROTECTED]
| Sent: Thursday, April 05, 2001 9:03 PM
| Subject: RE: [PHP-DB] Forms : Validating user input is integer
|
|
| 
|   To gain the full benefit of your suggestion I find that I can
| validate
|   for a wrong entry containing  a mix alphabetical and numerical
|   characters  by altering the elseif line to read
|  
|   elseif (!eregi("[0-9]",$num) || eregi("[a-z]",$num))
|  
|   Agreed?
|  
| 
|   yes and no.
| 
|  I've done a lot of testing for this and using just the first one
has
| never
|  let any values of $num through unles they've contained only
numbers.
|  AFAIK (!eregi("[0-9]",$num) should always return false or 0 or
| whatever it
|  is unless it contains only numbers.
|
| 
| When I used  only  elseif (!eregi("[0-9]",$num) { }
| an input 2i passed the variable 2
| 
|
|  You could also use [^a-zA-Z] for letters you don't want.
|  so maybe something like  (!eregi("([0-9]||[^a-zA-Z])",$num))
|  not tried so don't rely on that.
|
| xx
| correcting some typos this does the job elegantly.  Should read
|
| elseif (!eregi(("[0-9]" || "[^a-zA-Z]"),$num)){  }
| xx

or even just
elseif  (!eregi("[^a-zA-Z]"),$num)) { }


Tim Morris



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




Re: [PHP-DB] Forms : Validating user input is integer

2001-04-05 Thread Boclair


"Matt Williams" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
|
|  or even just
|  elseif  (!eregi("[^a-zA-Z]"),$num)) { }
|
| But that would not stop other characters.
|
| M@


Whoops!  Careless of me.  The line should read, and as I tested it,

elseif (eregi("[a-zA-Z]",$num)) { }

Do you see any problem with this?

I have tried with every type and mix of input that I can think of and
was successful in denying all but digit inputs, but I have little
confidence in what I am doing.  With your examples I am at least
coming to some understanding of Dario Gomes article on PHPBuilder.


Tim




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




Re: [PHP-DB] Forms : Validating user input is integer

2001-04-05 Thread boclair


- Original Message -
From: Matt Williams [EMAIL PROTECTED]
To: Boclair [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, April 05, 2001 11:28 PM
Subject: RE: [PHP-DB] Forms : Validating user input is integer


The line should read, and as I tested it,
 
  elseif (eregi("[a-zA-Z]",$num)) { }
 
  Do you see any problem with this?

 Yes, same thing it will accept other character like !*- etc...

 try

 if(!eregi("^[0-9]+[0-9]*$",$num)


   file://error
 }


You are right again.  Stops all further processing of the inserted
variable if it is not entirely composed of digits.

It did  not cross my mind to check for ! (shift 1) and similar entry
errors.

Once again, thanks.

Tim

So here is the final working script

?
if ((@!$submit) || empty($num) )
 {
 echo "div align='center'span class='note'No entry was
made/span/div";
include "get_id.php";
 }
if(!eregi("^[0-9]+[0-9]*$",$num))
 {
  echo "div align='center'span class='note'The ID should have
been a  number./span/div";
  include "get_id.php";
}
else
{
   include "do_form.php";
 }
?


Tim


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




Re: [PHP-DB] Forms : Validating user input is integer

2001-04-05 Thread Boclair


"boclair" [EMAIL PROTECTED] wrote in message
002101c0bd8e$30742e60$[EMAIL PROTECTED]">news:002101c0bd8e$30742e60$[EMAIL PROTECTED]...
| I have a problem with a user input in a form required to be an
| integer, creating a variable for a mysql query.
|
| I have instances where integer, 0, is being typed as letter,o.
| Does anybody know if such validation can be done server side or
| definitely must be done client side?

Brad S Jackson replied suggesting that the php function preg_match()
should be used for this type of server side validation.

^^
Brad,

- Original Message -
From: Brad S. Jackson [EMAIL PROTECTED]
To: boclair [EMAIL PROTECTED]
Sent: Thursday, April 05, 2001 11:54 PM
Subject: Re: [PHP-DB] Forms : Validating user input is integer




 This is probably the most efficient way to check.  The preg
functions are faster
 than the ereg functions so I never use ereg.  I think server side
validation is
 required and client side is optional.

 if(preg_match("/^[0-9]+$/", $var))
echo "Valid";
 else
echo "Invalid";

There you go.  Does the same job as Matt William's  eregi()

I am getting invaluable lessons on this stuff, which I never
understood before.

Using the php preg_match() function the tested script is
_
?
if ((@!$submit) || empty($num) )
 {
   echo "div align='center'span class='note'No entry was
made/span/div";
include "get_id.php";
 }
if(preg_match("/^[0-9]+$/", $num))
 {
   include "do_form.php";
   }
else
   {
   echo "div align='center'span class='note'The ID should have
been a number./span/div";
include "get_id.php";
 }
?
___

Many thanks
^^^
Tim Morris





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




Re: [PHP-DB] Forms : Validating user input is integer

2001-04-05 Thread Boclair


Ben Udall [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
| boclair wrote:
|  I have a problem with a user input in a form required to be an
|  integer, creating a variable for a mysql query.
| 
|  I have instances where integer, 0, is being typed as letter,o.
|  Does anybody know if such validation can be done server side or
|  definitely must be done client side?
|
| A basic client-server rule is to never trust the client.  You should
be
| doing all validation on the server side.  Client side validation is
a
| nice feature, but should be in addition to the sever side checking
and
| never required.
|
| Here's the quickest way I know to validate an integer in php:
|
| if (ereg("^[0-9]+$", $input))
| {
|// $input is a valid non-negative integer
| }
|
| or, if negative numbers are valid, use could use this one:
|
| if (ereg("^-?[0-9]+$", $input))
| {
|// $input is a valid integer
| }


Once again, thanks.  This validates for an all digit variable.  In
this case the tested script reads

?
if ((@!$submit) || empty($num) )
 {
   echo "div align='center'span class='note'No entry was
made/span/div";
include "get_id.php";
 }
if (ereg("^[0-9]+$", $input))
 {
   include "do_form.php";
   }
else
   {
   echo "div align='center'span class='note'The ID should have
been a number./span/div";
include "get_id.php";
 }
?

Will I ever get on the ball and stay there

Tim Morris




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




Re: [PHP-DB] CSS versus Includes

2001-04-01 Thread Boclair


"Matt Braynard" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
| When I asked the question, what I meant was should I use the
includes to
| hold page style details or a CSS file. And someone who understood
that this
| was not an apples and oranges situation but one of approach answered
that
| Netscape was not fully supportive of CSS and suggested includes may
be the
| way to go.

Whether you link to an external stylesheet, embed a style block or
declare the styles in-line is a matter for author management of the
CSS property declarations.  The use of includes or scripting  the
actual link, block or inline styling in the document does not matter a
wit.

Importantly, if the styling is included, the interpretation is still
done by the client browser.  Whether includes or in-document coding
are used, the restrictions and bugs and failure to parse, where
invalid markup or styling is involved, still apply.

What I do notice, however, with some Nav4x browsers, that escaping the
quotes on class names in printf() causes these browsers to sometimes
escape the whole class declaration.
eg.

printf('tr
td class=\'id\' align=\'right\'%s/td
td class=\'lname\'%s/td
td class=\'fname\'%s/td
td class=\'logon\'%s/td
td class=\'logoff\'%s/td
/tr
', $myrow['id'], $myrow['lname'],  $myrow['fname'],$myrow['logon'],
$myrow['logoff']);

The solution for some documents is to write as such
td class=id align=right%s/td

How this will affect xml documents I am not sure

Also with tables, if the data is being extracted from a database, as
above, and the data in a particular field row is null, the td cell
styling background will collapse with Nav4x browsers.  This might be
solved by a conditional statement inserting some content where the
database row/field content is null, or constructing the database table
with pseudo content, such as nbsp; as the default for fields likely
to have null content.

Sorry, but my experience is that oranges are oranges and apples and
apples are apples.  Nice thought!  but I do not think you can get out
of browser non-compliance by using PHP.

Tim Morris



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




Re: [PHP-DB] uploading files.

2001-04-01 Thread Boclair


"olinux" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
| here is the working script on my local windows machine. note that
you will
| need to change $the_path
| Everything is pretty self explanatory. You can read the article that
I took
| this from at http://phpbuilder.com/columns/bealers2904.php3
|
| olinux

Adapted excellently.  Many thanks

Tim Morris



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




[PHP-DB] date_format yet again

2001-03-26 Thread boclair

I realise that CC Zona answered this question earlier but I haven't
understood.

I have attempted to use the date_format in generating the query
variable and applying the result with a while loop to display the date
data in an html table as dd-mmm-

Generating the query variable

include ("inputs/connect.php");

$plantavail = mysql_query("SELECT regno, type, size, drive, mfr,
date_format(online,'%d-%b-%Y'), date_format(offline,'%d-%b-%Y')  FROM
boclair.members where status='heavy' order by type, size");

And later the while loop

while ($myrow = mysql_fetch_array($plantavail)) {
printf('tr
td class=regno align=right%s/td
td class=type align=center%s/td
tdspan class=size%sspan/td
tdspan class=drive%sspan/td
tdspan class=mfr%sspan/td
tdspan class=date%sspan/td
tdspan class=date%sspan/td
/tr
', $myrow['regno'], $myrow['type'], $myrow['size'],
 $myrow['drive'], $myrow['mfr'], $myrow['online'], $myrow['offline']);
}

The date_format function used this way generates no errors or warning
but the variables, $myrow['online'], $myrow['offline']), are empty and
the dates are not displayed in the html table.

Obviously I am missing the boat.  The manual and references are
apparently beyond me.

Can I have some further help?

Tim Morris



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




Re: [PHP-DB] date_format yet again

2001-03-26 Thread Boclair


"boclair" [EMAIL PROTECTED] wrote in message
000e01c0b5d0$720921c0$[EMAIL PROTECTED]">news:000e01c0b5d0$720921c0$[EMAIL PROTECTED]...
| I realise that CC Zona answered this question earlier but I haven't
| understood.
|
| I have attempted to use the date_format in generating the query
| variable and applying the result with a while loop to display the
date
| data in an html table as dd-mmm-
|
| Generating the query variable
|
| include ("inputs/connect.php");
|
| $plantavail = mysql_query("SELECT regno, type, size, drive, mfr,
| date_format(online,'%d-%b-%Y'), date_format(offline,'%d-%b-%Y')
FROM
| boclair.members where status='heavy' order by type, size");
|
| And later the while loop
|
| while ($myrow = mysql_fetch_array($plantavail)) {
| printf('tr
| td class=regno align=right%s/td
| td class=type align=center%s/td
| tdspan class=size%sspan/td
| tdspan class=drive%sspan/td
| tdspan class=mfr%sspan/td
| tdspan class=date%sspan/td
| tdspan class=date%sspan/td
| /tr
| ', $myrow['regno'], $myrow['type'], $myrow['size'],
|  $myrow['drive'], $myrow['mfr'], $myrow['online'],
$myrow['offline']);
| }

Thanks but I found the answer at PHPBuilder Support forum.  CCZona had
already given it to me but I need spoon feeding.

For the few that might also have a problem with reformatting the mysql
date for display in an html document, here is the answer and it works.

| $plantavail = mysql_query("SELECT regno, type, size, drive, mfr,
| date_format(online,'%d-%b-%Y'), date_format(offline,'%d-%b-%Y')
FROM
| boclair.members where status='heavy' order by type, size");

should read

| $plantavail = mysql_query("SELECT regno, type, size, drive, mfr,
| date_format(online,'%d-%b-%Y') AS logon,
date_format(offline,'%d-%b-%Y')  AS logoff FROM
| boclair.members where status='heavy' order by type, size");

and

|  $myrow['drive'], $myrow['mfr'], $myrow['online'],
$myrow['offline']);

should read

|  $myrow['drive'], $myrow['mfr'], $myrow['logon'], $myrow['logoff']);

Reference http://www.phpbuilder.com/forum/archives/2/2001/2/1/122514

Tim Morris




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




Re: [PHP-DB] date_format yet again

2001-03-26 Thread Boclair

It has been pointed out to me that there is an error.  I had failed to
include the two date fields in the select.  The actual scripting is.

The query

include ("inputs/connect.php");

|$plantavail = mysql_query("SELECT * date_format(online,'%d-%b-%Y') AS
logon,
date_format(offline,'%d-%b-%Y') )  AS logoff
FROM
boclair.members where status='heavy' order by type, size");

the while loop

while ($myrow = mysql_fetch_array($plantavail)) {
printf('tr
td class=regno align=right%s/td
td class=type align=center%s/td
tdspan class=size%sspan/td
tdspan class=drive%sspan/td
tdspan class=mfr%sspan/td
tdspan class=date%sspan/td
tdspan class=date%sspan/td
/tr
', $myrow['regno'], $myrow['type'], $myrow['size'],
$myrow['drive'], $myrow['mfr'], $myrow['logon'],
$myrow['logoff']);

Sorry

Tim Morris





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




Re: [PHP-DB] uploading files.

2001-03-24 Thread boclair

Yes please

Tim Morris

- Original Message -
From: olinux [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Sunday, March 25, 2001 11:21 AM
Subject: Re: [PHP-DB] uploading files.


 mmmK,

 i have figured it out,
 anyone want it?
 lemme know

 olinux


 - Original Message -
 From: "olinux" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: "PHP-DB" [EMAIL PROTECTED]
 Sent: Saturday, March 24, 2001 4:27 PM
 Subject: [PHP-DB] uploading files.


 K, I am using a script i found at hotscripts.com
 I need it to upload an image to server.
 I think that my issue is that i need to use the stripslashes();
somewhere,
 but i don't know where

 anyways here tis:

 ?

  function do_upload($filename,$newname) {
   $file = basename($filename);
   $tmp_upload_path = "c:/program files/apache group/apache/htdocs";
   $new_file_name = "c:/program files/apache
group/apache/htdocs".$newname;
  $file = stripslashes($file);
  $tmp_upload_path = stripslashes($tmp_upload_path);
  $new_file_name = stripslashes($new_file_name);
   if (!copy($tmp_upload_path.$file, $new_file_name)) echo "failed to
copy
 filebr\n";
   return;
 }

 ?

 and later i calll the function:

 ? do_upload($userfile,$newname); ?

 here the error i receive:
 Warning: Unable to open 'c:/program files/apache
group/apache/htdocsphp2'
 for reading: No such file or directory in c:\program files\apache
 group\apache\htdocs\uploads\2\upload_go.php on line 9

 and script returns this
   upload tmp file: \\php2


 There is an article at phpbuilder called file uploading made easy
 http://phpbuilder.com/columns/bealers2904.php3

 i am having the same issues with this script and though i found an
answer to
 the file://php2 thing [it was a stripslashes()  solution] I am
getting an
 error with this script that there is an unset variable... It looks
set to me
 :)

 puzzled,
 olinux [who thanks you all greatly]



 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com


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




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




Re: [PHP-DB] Select where date is in period

2001-03-22 Thread Boclair


"boclair" [EMAIL PROTECTED] wrote in message
005101c0b2d2$4e6b3920$[EMAIL PROTECTED]">news:005101c0b2d2$4e6b3920$[EMAIL PROTECTED]...
|
| - Original Message -----
| From: boclair [EMAIL PROTECTED]
| To: [EMAIL PROTECTED]
| Sent: Thursday, March 22, 2001 10:45 PM
| Subject: Re: [PHP-DB] Select where date is in period
|
|
| 
|  ___Morris___
| 
|  The database has a table of equipments with date fields for
|  date_online and date_offline.
| 
|  The requirement is to find which equipments were available on a
date
|  specified by the user, this being a variable created by the user.
| 
|  My attempts at scripting for the condition where the date_online
=
|  'specified variable' and the date_offline = 'specified variable'
|  totally fail for syntax says mySQL (and possibly for method)
| 
|  ___Richard___
| 
|  Have you checked at the BETWEEN (x and y) clause?
| 
|  e.g.
| 
|SELECT * FROM table WHERE searchdate BETWEEN (date_online
AND
|  date_offline)
| 
|  Not tested this on MySQL, but the above is perfectly legal SQL92.
| 
|  ___Morris_
| 
|  Thanks for that.  I searched the Manual, yet again and could not
| find
|  this or like syntax.  I tried it though and got
|  Warning: Supplied argument is not a valid MySQL result resource.
| 
|  My attempt, one of many,
| 
|  $result = mysql_query("select * from plant.eqpt where date_online
=
|  $checkdate AND  where date_offline = $checkdate order by type,
|  size");
| 
|  generated the same warning.
|
| 
|
| Please check this solution for syntax and method. MySQL didn't give
| errors or warnings and results were as required.
|
| $result = mysql_query("select * from plant.eqpt where date_online =
| $checkdate   $checkdate  = date_offline order by type, size");
|
| or can use AND in lieu of 
|
| or can place where conditions in brackets as
|
| where (date_online = $checkdate   $checkdate  = date_offline)

Sorry.  Careless as usual. The variable $checkdate was enclosed in
single quotes as

$result = mysql_query("select * from plant.eqpt where date_online =
'$checkdate'   '$checkdate'  = date_offline order by type, size");

Tim Morris




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




[PHP-DB] Select where date is in period

2001-03-21 Thread boclair



The database has a table of equipments with date fields for
date_online and date_offline.

The requirement is to find which equipments were available on a date
specified by the user, this being a variable created by the user.

My attempts at scripting for the condition where the date_online =
'specified variable' and the date_offline = 'specified variable'
totally fail for syntax says mySQL (and possibly for method)

I would be grateful for help or a pointer to a reference.

Tim Morris


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




Re: [PHP-DB] Select where

2001-03-20 Thread boclair


- Original Message -
From: boclair [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 21, 2001 12:02 AM
Subject: [PHP-DB] Select where


 This is simple but  I cannot see where I am going wrong

 I have a table members with one of the fields
 status, varchar(10)

 The values may be active or retired or deceased or null

 If I run the select

 SELECT * FROM members WHERE status = 'deceased';

 I getMySQL said: You have an error in your SQL syntax near
 '\'deceased\';' at line 1

 Will somebody show me the correct syntax

___

 $query = "SELECT * FROM members where status='deceased'"

 Then just call the $query in your script
___

Thanks, I only gave the mySQL but the php scripting is


$deceased = mysql_query(SELECT * FROM members where
status=\'deceased\'");
 and later
while ($myrow = mysql_fetch_row($deceased))

MySQL now says in relation to the *while* line
Warning: Supplied argument is not a valid MySQL result resource

Tim Morris



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




[PHP-DB] Using include() to specify mysql_connection??

2001-02-16 Thread Boclair

Is it possible to place the mysql_connect and mysql_select_db functions in an include 
file and to open the connection and use the database in a PHP file using include(); ?

All that happens when I attempt it is that the text of the include file is dumped, the 
connection to the mysql server is not opened and the variables are not created.

Is there some other way of achieving this?  I have the databases transferred to 
another host but transferring the php files requires the mysql_connect and 
mysql_select_db amended for each.

Tim Morris



Re: [PHP-DB] Using include() to specify mysql_connection??

2001-02-16 Thread boclair


- Original Message -
From: CC Zona [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, February 17, 2001 12:30 PM
Subject: Re: [PHP-DB] Using include() to specify mysql_connection??



 To be parsed as PHP code, the contents of the included file also
need to be
 in PHP mode ?php ... ?.

Thanks to you and Ron as well.  That was the problem.

Tim Morris


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