RE: [PHP-DB] Corn job anomaly

2016-09-27 Thread Ford, Mike
> -Original Message-
> From: Karl DeSaulniers [mailto:k...@designdrumm.com]
> Sent: 25 September 2016 09:59
> To: PHP List Database <php-db@lists.php.net>
> Subject: Re: [PHP-DB] Corn job anomaly
>
> Now I am getting an error with mysql syntax.
>
> "SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN ".FIELDS_TABLE." cf
> ON cf.Order_ID = otn.Order_ID WHERE cf.Earliest_Pickup >= DATE(NOW()) AND
> cf.Earliest_Pickup <= DATE(NOW() + INTERVAL ".($Num_Days_Away+1)." DAY) AND
> otn.Order_Status != 'Shipping' AND otn.Order_Status != 'Completed'"
>
> is giving me this error:
>   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
> '\"Shipping\" AND otn.Order_Status != \"Completed\"' at line 1

I don't think INTERVAL works like that - you probably need something like:

... cf.Earliest_Pickup <= DATE_ADD(CURDATE(), INTERVAL 
".($Num_Days_Away+1)." DAY) AND ...

Incidentally, as I understand it CURDATE() does exactly the same as 
DATE(NOW()), and is probably more readable.

Cheers!

Mike

--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
110 Queen Square House, 80 Woodhouse Lane,
Leeds Beckett University, Leeds LS2 8NU,  United Kingdom
E & S4B: m.f...@leedsbeckett.ac.uk T: +44 113 812 4730

To view the terms under which this email is distributed, please go to:-
http://disclaimer.leedsbeckett.ac.uk/disclaimer/disclaimer.html

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



Re: [PHP-DB] Newbie Question $2

2014-06-16 Thread Mike Stowe
Oh a few quick things. 

First, you can use substr to break up the phone instead of grabbing characters- 
might be a little easier to read long term. 

Secondly, mysql_real_escape_string will return the cleaned string, but doesn't 
change the original variable. So you'll need $phn = 
mysql_real_escape_string($phn);

Thirdly anytime you use a single quote the strong is interpreted literally. 
You'll want to switch out the single quotes with double quotes, and then wrap 
$phn in single quotes in order to not break your query. 

Select ... Where phn = '$phn'

I'd also really suggest looking at using PDO or even the mysqli extension tho 
instead of just plain mysql (believe this has been deprecated). 

Sorry for the quick reply, on mobile. But feel free to email me directly and 
I'll be happy to help out more. 

- Mike

Sent from my iPhone

 On Jun 16, 2014, at 7:58 PM, Ethan Rosenberg 
 erosenb...@hygeiabiomedical.com wrote:
 
 Dear List -
 
 I have the following code:
 
 The input from the form is a 10 digit string [1234567890] which is converted 
 to phone number format [123-456-7890]
 
 $phn = $_POST[phone];
 $phn = (string)$phn;
 $dsh = '-';
 $Phn = 
 $phn[0].$phn[1].$phn[2].$dsh.$phn[3].$phn[4].$phn[5].$dsh.$phn[6].$phn[7].$phn[8].$phn[9];
  
echo $Phn; // this is folded by Thunderbird.  In the script, it is //all 
 on one line
 
mysql_real_escape_string($Phn);
$sql1 ='select Lname, Fname from Customers where Phone = $Phn ';
echo $sql1; //this always shows $phn as Phn and not as a numerical 
 //string.
$result1 = mysqli_query($cxn, $sql1);
 
 TIA
 
 Ethan
 
 -- 
 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: Formatting

2012-11-26 Thread Ford, Mike
 -Original Message-
 From: Karl DeSaulniers [mailto:k...@designdrumm.com]
 Sent: 26 November 2012 08:48
 To: php-db@lists.php.net
 Subject: Re: [PHP-DB] Re: Formatting
 
 Ethan,
 is this valid PHP? What is the ampersand for? What is it doing? Just
 curious.
 
 $args[] = $_POST[$k]; // Note the addition of the ampersand here

That's a perfectly valid reference assignment. Please see the Fine
Manual at: http://php.net/manual/language.references.whatdo.php


Cheers!

Mike

-- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Portland PD507, City Campus, Leeds Metropolitan University,
Portland Way, LEEDS,  LS1 3HE,  United Kingdom 
E: m.f...@leedsmet.ac.uk T: +44 113 812 4730





To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP-DB] SELECT

2011-10-21 Thread Ford, Mike
 -Original Message-
 From: tamouse mailing lists [mailto:tamouse.li...@gmail.com]
 Sent: 20 October 2011 21:37
 
 On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike m.f...@leedsmet.ac.uk
 wrote:
  -Original Message-
  From: Ron Piggott [mailto:ron.pigg...@actsministries.org]
  Sent: 17 October 2011 18:38
 
  What I am storing in the table is the start month # (1 to 12) and
  day # (1 to 31) and then the finishing month # (1 to 12) and the
  finishing day # (1 to 31)
 
 
  This is a little bit of a tricky one, as you have to consider both
  start_month and end_month as special cases - so you need a three-
 part
  conditional, for the start month, the end month, and the months in
  between. Something like this:
 
  SELECT * FROM `introduction_messages`
   WHERE (month`start_month` AND month`end_month`)
        OR (month=`start_month AND day=`start_day`)
        OR (month=`end_month` AND day=`end_day`);
 
 This still suffers from the problem in Jim's offer -- wrap of year
 and
 wrap of month

Look again. Month wrap *is* handled by the specific tests for start_month
and end_month.

As to year-wrap, Ron's original post said:

  ... The reason I didn’t use ‘DATE’ is because the same message
  will be displayed year after year, depending on the date range.

so I didn't bother about year-wrap, assuming he would include a range
with start_date of 1/1 and another with end_date of 31/12.

Cheers!

Mike

-- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Portland PD507, City Campus, Leeds Metropolitan University,
Portland Way, LEEDS,  LS1 3HE,  United Kingdom 
E: m.f...@leedsmet.ac.uk T: +44 113 812 4730


 But in the
case of years actually mattering then, yes, the above would not work


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm


RE: [PHP-DB] SELECT

2011-10-18 Thread Ford, Mike
 -Original Message-
 From: Ron Piggott [mailto:ron.pigg...@actsministries.org]
 Sent: 17 October 2011 18:38
 
 I need help creating a mySQL query that will select the correct
 introduction message for a website I am making.  The way I have
 designed the table I can’t wrap my mind around the SELECT query that
 will deal with the day # of the month.
 
 The part of the SELECT syntax I am struggling with is when the
 introduction message is to change mid month.  The reason I am
 struggling with this is because I haven’t used ‘DATE’ for the column
 type.  The reason I didn’t use ‘DATE’ is because the same message
 will be displayed year after year, depending on the date range.
 
 What I am storing in the table is the start month # (1 to 12) and
 day # (1 to 31) and then the finishing month # (1 to 12) and the
 finishing day # (1 to 31)
 

This is a little bit of a tricky one, as you have to consider both
start_month and end_month as special cases - so you need a three-part
conditional, for the start month, the end month, and the months in
between. Something like this:

SELECT * FROM `introduction_messages`
 WHERE (month`start_month` AND month`end_month`)
   OR (month=`start_month AND day=`start_day`)
   OR (month=`end_month` AND day=`end_day`);

Cheers!

Mike

-- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Portland PD507, City Campus, Leeds Metropolitan University,
Portland Way, LEEDS,  LS1 3HE,  United Kingdom 
E: m.f...@leedsmet.ac.uk T: +44 113 812 4730




To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm


RE: [PHP-DB] Configuring PHP with GD and JPEG support

2011-01-15 Thread mike dorian

Just tried it with the following but still fails.  All I'm getting is a blank 
page.

php?
function create_image()
{
 //Let's generate a totally random string using md5
 $md5_hash = md5(rand(0,999));
 //We don't need a 32 character long string so we trim it down to 5
 $security_code = substr($md5_hash, 15, 5);

 //Set the session to store the security code
 $_SESSION[security_code] = $security_code;

 //Set the image width and height
 $width = 100;
 $height = 20;

 //Create the image resource
 $image = ImageCreate($width, $height);

 //We are making three colors, white, black and gray
 $white = ImageColorAllocate($image, 255, 255, 255);
 $black = ImageColorAllocate($image, 0, 0, 0);
 $grey = ImageColorAllocate($image, 204, 204, 204);

 //Make the background black
 ImageFill($image, 0, 0, $black);

 //Add randomly generated string in white to the image
 ImageString($image, 3, 30, 3, $security_code, $white);

 //Throw in some lines to make it a little bit harder for any bots to break
 ImageRectangle($image,0,0,$width-1,$height-1,$grey);
 imageline($image, 0, $height/2, $width, $height/2, $grey);
 imageline($image, $width/2, 0, $width/2, $height, $grey);

 //Tell the browser what kind of file is come in
 header(Content-Type: image/jpeg);

 //Output the newly created image in jpeg format
 ImageJpeg($image);

 //Free up resources
 ImageDestroy($image);
}

create_image();

?

 From: k...@designdrumm.com
 Date: Mon, 10 Jan 2011 17:10:35 -0600
 To: php-db@lists.php.net
 Subject: Re: [PHP-DB] Configuring PHP with GD and JPEG support
 
 
 On Jan 10, 2011, at 9:35 AM, mike dorian wrote:
 
 
  Hello,
 
  Questions with regards to compiling PHP to support GD with JPEG on  
  64-bit CentOS 5.5.
 
  1) Specifying folder for jpeg library
  When I execute the following command, am I saying the full path to  
  libdir is at /usr/source/lib64?
  ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-gd -- 
  with-jpeg-dir=/usr/source --with-libdir=lib64
 
  Should I have done the following instead?
  ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-gd -- 
  with-jpeg-dir=/usr/source/lib64
 
 
  2) After copying the compiled JPEG libraries to the the lib64  
  directory, PHP is still unable to call the GD functions (ie  
  ImageCreateFromJpeg) properly.
  Once I've done the following.
  ./configure --enable-shared
  make
  make install
 
  I have the following files installed.  Meanwhile the /usr/local/ 
  lib64 directory doesn't have these files.  Despite copying the  
  whole set to /usr/local/lib64, the above configure command still  
  doesn't work.
  /usr/local/lib/libjpeg.a
  /usr/local/lib/libjpeg.la
  /usr/local/lib/libjpeg.so - libjpeg.so.8.0.2
  /usr/local/lib/libjpeg.so.8 - libjpeg.so.8.0.2
  /usr/local/lib/libjpeg.so.8.0.2
 
  The following displays a blank page on my Firefox.
  ?php
  header('Content-Type: image/jpeg');
$image_file_path = '/usr/local/apache2/htdocs/image.jpg';
$image_file_path;
$im = @ImageCreateFromJpeg($image_file_path);
echo $im;
imagejpeg($im);
echo End: imagedestroy($im);
  ?
 
  
 
 
 Hi Mike,
 Dont know about your server config, but maybe try using this create  
 image script and see.
 
 function create_image()
 {
  //Let's generate a totally random string using md5
  $md5_hash = md5(rand(0,999));
  //We don't need a 32 character long string so we trim it down to 5
  $security_code = substr($md5_hash, 15, 5);
 
  //Set the session to store the security code
  $_SESSION[security_code] = $security_code;
 
  //Set the image width and height
  $width = 100;
  $height = 20;
 
  //Create the image resource
  $image = ImageCreate($width, $height);
 
  //We are making three colors, white, black and gray
  $white = ImageColorAllocate($image, 255, 255, 255);
  $black = ImageColorAllocate($image, 0, 0, 0);
  $grey = ImageColorAllocate($image, 204, 204, 204);
 
  //Make the background black
  ImageFill($image, 0, 0, $black);
 
  //Add randomly generated string in white to the image
  ImageString($image, 3, 30, 3, $security_code, $white);
 
  //Throw in some lines to make it a little bit harder for any  
 bots to break
  ImageRectangle($image,0,0,$width-1,$height-1,$grey);
  imageline($image, 0, $height/2, $width, $height/2, $grey);
  imageline($image, $width/2, 0, $width/2, $height, $grey);
 
  //Tell the browser what kind of file is come in
  header(Content-Type: image/jpeg);
 
  //Output the newly created image in jpeg format
  ImageJpeg($image);
 
  //Free up resources
  ImageDestroy($image);
 }
 
 Was taken from the WebCheatSheet.com - Create CAPTCHA Protection.
 Namely to see how they are using the ImageJpeg, not the whole code.
 But, at least you will have a code you know produces an image

[PHP-DB] Configuring PHP with GD and JPEG support

2011-01-10 Thread mike dorian

Hello,

Questions with regards to compiling PHP to support GD with JPEG on 64-bit 
CentOS 5.5.

1) Specifying folder for jpeg library
When I execute the following command, am I saying the full path to libdir is at 
/usr/source/lib64?
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-gd 
--with-jpeg-dir=/usr/source --with-libdir=lib64

Should I have done the following instead?
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-gd 
--with-jpeg-dir=/usr/source/lib64


2) After copying the compiled JPEG libraries to the the lib64 directory, PHP is 
still unable to call the GD functions (ie ImageCreateFromJpeg) properly.
Once I've done the following.
./configure --enable-shared
make
make install

I have the following files installed.  Meanwhile the /usr/local/lib64 directory 
doesn't have these files.  Despite copying the whole set to /usr/local/lib64, 
the above configure command still doesn't work.
/usr/local/lib/libjpeg.a
/usr/local/lib/libjpeg.la
/usr/local/lib/libjpeg.so - libjpeg.so.8.0.2
/usr/local/lib/libjpeg.so.8 - libjpeg.so.8.0.2
/usr/local/lib/libjpeg.so.8.0.2

The following displays a blank page on my Firefox.
?php
header('Content-Type: image/jpeg');
  $image_file_path = '/usr/local/apache2/htdocs/image.jpg';
  $image_file_path;
  $im = @ImageCreateFromJpeg($image_file_path);
  echo $im;
  imagejpeg($im);
  echo End: imagedestroy($im);
?

  

RE: [PHP-DB] Re: Stuck in apostrophe hell

2010-08-04 Thread Ford, Mike
 -Original Message-
 From: Simcha Younger [mailto:sim...@syounger.com]
 Sent: 04 August 2010 08:19
 
  paul_s_john...@mnb.uscourts.gov wrote:
 
  
   THE INPUT:
  
   $sql_insert_registration = sprintf(INSERT INTO
 Registrations (
   Class_ID,
   prid,
   Registrant,
   Company,
   Phone,
   Email
 )
   VALUES (
   $_POST[Class_ID],
   $_POST[prid],
   '%s',.
 
 You need double-quotes here,
  \%s\,

No, he doesn't. Single quotes are fine. Doubles would more than likely be a SQL 
error.

   parseNull($_POST['Company']).,
   '$_POST[Phone]',
   '$_POST[Email]'
   ), mysql_real_escape_string($_POST['Registrant']));
  
 
 
 --
 Simcha Younger sim...@syounger.com


Cheers!

Mike

 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507 City Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.f...@leedsmet.ac.uk 
Tel: +44 113 812 4730




To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP-DB] losing MySQL resource

2009-11-11 Thread Ford, Mike
 -Original Message-
 From: Nehemias Duarte [mailto:ndua...@aflac.com]
 Sent: 11 November 2009 14:25
 To: Stan; php-db@lists.php.net
 Subject: RE: [PHP-DB] losing MySQL resource
 
 I was under the impression that session_start() had to be the FIRST
 thing ran in the script. Is this incorrect?

Yes.

It has to be before any actual *output*, but it would be perfectly valid to 
have umpteen thousand lines of PHP before session_start() so long as all the 
output came after it.

Cheers!

Mike

 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.f...@leedsmet.ac.uk 
Tel: +44 113 812 4730






To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP-DB] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?

2009-08-05 Thread Ford, Mike
 -Original Message-
 From: Govinda [mailto:govinda.webdnat...@gmail.com]
 Sent: 05 August 2009 01:41
 
  Taking this:
  SELECT count(*) AS
  `CountUniqueDatesInMyTbl`, date(solarAWDateTime) AS `uniqueDate`,
  'aweber_7solar_aw' AS `tableAlias` FROM aweber_7solar_aw GROUP BY
  DATE(solarAWDateTime)

Just one other tiny point of style here: having given the expression 
date(solarAWDateTime) the alias uniqueDate, you should probably use that alias 
to refer to the same thing elsewhere in your query, such as in the GROUP BY 
column.  So:

SELECT count(*) AS `CountUniqueDatesInMyTbl`,
   date(solarAWDateTime) AS `uniqueDate`,
   'aweber_7solar_aw' AS `tableAlias`
   FROM aweber_7solar_aw
   GROUP BY `uniqueDate`;

That's how I'd write it, anyway.


Cheers!

Mike
 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.f...@leedsmet.ac.uk 
Tel: +44 113 812 4730





To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP-DB] Postgres query failing, not enough info for debugging...

2009-06-17 Thread Ford, Mike
On 16 June 2009 15:57, Carol Walter advised:

 Hello,
 
 I'm using PHP 5 and PostgreSQL 8.3.6.  I have a query that is failing
 and I don't know how to troubleshoot the problem.  The error message
 that it is giving is quite vague.  The error message is as follows:
 
 
 Warning: pg_query_params() [function.pg-query-params]: Query failed:
 ERROR: syntax error at end of input at character 156 in /home/walterc/
 ssl/PHP/km_input_test2c.php on line 631
 ERROR: syntax error at end of input at character 156
 
 The query that is failing looks like this...
 
 $pg_pres_ins6 = pg_query_params(INSERT INTO \brdgMediaCallsEvents
 \ (\mediumId\, \eventId\, rank) VALUES
 ((currval('\tblMedia_mediumId_seq\'),
 (currval('\tblCallsEvents_eventId_seq\'), $1), array($ev_rank));
   echo pg_last_error($pg_connection);

You have 2 more opening parentheses than close parentheses in that SQL
-- in both cases, the parenthesis immediately preceding currval should
be omitted.

Also, to ameliorate your quote hell, you might consider using a heredoc
(http://php.net/manual/language.types.string.php#language.types.string.s
yntax.heredoc) for this:

  $pg_pres_ins6 = pg_query_params(SQL
  INSERT INTO brdgMediaCallsEvents (mediumId, eventId, rank)
  VALUES (currval('tblMedia_mediumId_seq'),
  currval('tblCallsEvents_eventId_seq'), $1)
  SQL
 , array($ev_rank));

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.f...@leedsmet.ac.uk
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP-DB] Re: PHP and table/view names with '$'

2009-04-23 Thread Ford, Mike
On 23 April 2009 11:36, Mark Casson advised:

 Hi Guys,
 
 Thanks to you both - you are spot on!
 
 Shame this is not better documented somewhere.

I don't know how much better documented it can be than at
http://php.net/language.types.string ... ;)

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.f...@leedsmet.ac.uk
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP-DB] Building WHERE SQL clauses

2008-09-17 Thread Mike Sullivan

Chris [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Mike Sullivan wrote:
 Hi all thanks for the responses! What I have is a 6 table db that has 
 each

 table created from the output of 6 identical laboratory machines (chico,

 harpo, ...). The out put is a text file which I import as a table named

 after the machine. I do realize that one solution is to add the machine

 name as a attribute and concatenate the tables together. I'm going to 
 weigh

 that change against Bastien's suggestion of UNIONing the selects.

 I must admit that I'm still rather weak in the SQL department and did try 
 a

 solution of:

 SELECT * FROM (chico UNION harpo) WHERE operator = Bill OR operator =

 Jessica but that apparently is a SQL syntax error.

 Thanks again for the insight and any other suggestions you might 
 have. ---  Mike

 A UNION combines the results from query 1 and query 2 together.

 For example:

 select * from chico where operator in ('Bill', 'Jessica')
 union
 select * from harpo in ('Bill', 'Jessica')

 will:

 - get all rows from the chico table where the operator is Bill or Jessica
 - get all rows from the harpo table where the operator is Bill or Jessica
 - remove duplicate results
 - return the results


 A UNION ALL will skip the 'remove duplicates' step:

 - get all rows from the chico table where the operator is Bill or Jessica
 - get all rows from the harpo table where the operator is Bill or Jessica
 - return the results

 If query 1 AND query 2 don't return the results you want, then a union
 is the wrong type of query to run.

 http://dev.mysql.com/doc/refman/5.0/en/union.html

 I'm confused about what you're trying to get out of the results, can you
 explain further and give an example of the data you have, and the result 
 you want to return?

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



From what I've experimented around with from the suggestions gathered here, 
a union is what I want.  and had tried that but using table names as the 
parameters to UNION not the results of query's as you show above.   I've got 
a prototype like this now working but I've pretty much decided to go back 
and redo the java program that parses the text files and builds the 
LOAD-able files so that it adds a machine name attribute and concatenates 
the data in one file.

--- Mike 



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



Re: [PHP-DB] Building WHERE SQL clauses

2008-09-16 Thread Mike Sullivan
Hi all thanks for the responses! What I have is a 6 table db that has each

table created from the output of 6 identical laboratory machines (chico,

harpo, ...). The out put is a text file which I import as a table named

after the machine. I do realize that one solution is to add the machine

name as a attribute and concatenate the tables together. I'm going to weigh

that change against Bastien's suggestion of UNIONing the selects.

I must admit that I'm still rather weak in the SQL department and did try a

solution of:

SELECT * FROM (chico UNION harpo) WHERE operator = Bill OR operator =

Jessica but that apparently is a SQL syntax error.

Thanks again for the insight and any other suggestions you might have. ---  
Mike



Bastien Koert [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Mon, Sep 15, 2008 at 1:33 PM, Stephen Wellington 
 [EMAIL PROTECTED] wrote:

 You probably want something like this:

 SELECT * FROM chico as c, harpo as h WHERE c.operator = Bill OR
 c.operator =
 Jessica OR h.operator = Bill OR h.operator =Jessica

 However if those tables really are identical I would suggest having a
 good look at your
 database design to see if it can be normalised or something...

 Stephen Wellington

 On Mon, Sep 15, 2008 at 4:06 PM, Mike Sullivan [EMAIL PROTECTED] wrote:
  Hello all.  I'm using PHP to build a query for a database that consists
 of
  multiple tables, all with identical attribues.  A typical syntax try
 looks
  like this:  SELECT * FROM chico, harpo WHERE operator = Bill OR
 operator =
  Jessica
 
  MySQL responds with this:  Couldn't execute query.Column 'operator' in
 where
  clause is ambiguous
 
  I was hoping that since the tables are identical all I would need to do
 is
  list the attribute values not have to append them to the table names. 
  Is
  there any way to do this?  Perhaps with a setting in MySQL or a 
  different
  syntax (JOIN, UNION, ...)?  If not are there available some canned code
  snippets that build these types of strings from values passed in the
 $_POST
  array.  Thanks for any insights on this. --- Mike
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 if the structures and fields are truly the same you can UNION the queries

 select * from chico where operator in('Jessica','William')
 union
 select * from harpo where operator in('Jessica','William')

 But as suggested, if they are truly similar, the db needs to be looked for
 design

 -- 

 Bastien

 Cat, the other other white meat
 



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



[PHP-DB] Building WHERE SQL clauses

2008-09-15 Thread Mike Sullivan
Hello all.  I'm using PHP to build a query for a database that consists of 
multiple tables, all with identical attribues.  A typical syntax try looks 
like this:  SELECT * FROM chico, harpo WHERE operator = Bill OR operator = 
Jessica

MySQL responds with this:  Couldn't execute query.Column 'operator' in where 
clause is ambiguous

I was hoping that since the tables are identical all I would need to do is 
list the attribute values not have to append them to the table names.  Is 
there any way to do this?  Perhaps with a setting in MySQL or a different 
syntax (JOIN, UNION, ...)?  If not are there available some canned code 
snippets that build these types of strings from values passed in the $_POST 
array.  Thanks for any insights on this. --- Mike 



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



Re: [PHP-DB] ? SELECT TABLE Command

2007-09-10 Thread Mike W.
Chris wrote (in news:[EMAIL PROTECTED]):

  It is an SQL query (probably MySQL, but perhaps SQLite or possibly even
PGSQL or mSQL):

 The line after $query should tell you what uses it ;)

Sorry, I meant the book may have been about any of those; I was skimming through
a bunch of SQL books at that time and don’t know which one I got it from.

  $query=SELECT TABLE $tablename;;
  if (mysql_query($query, $link)) {
   echo($indent.The table, '$tablename', was successfully opened.br
/\n); }
 
  To make things even stranger, it works fine in the original program that I
  put it in (although what, if anything, it does is beyond me), but fails
  when I try it in another program (yes, I took care of $tablename).

 What's the exact query that's run? Maybe $tablename contains more than just a
table name.

Nope, it’s just

SELECT TABLE lyrics;

 Different mysql version? Maybe it was in an older version of mysql but they
removed it.

 It doesn't work in mysql5 or mysql4.0, maybe it does in an older version
though.

 Looks like you're trying to check that the mysql user you connected as has
access to that table.

It really feels like a command I may have used in the SQLite analyzer or
something.  However, I’m sure I copied it from an example script in a book.  I’
ve put holds on all the books on PHP and (My)SQL at the library and will check
them all.

-- 
Mike W.

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



Re: [PHP-DB] date problems

2007-09-06 Thread Mike Gohlke
It's much better to use add_date instead of to_days since mysql isn't 
smart enough to do it for you.

Such as:
SELECT yourEventFields FROM theTable
WHERE theEventDate BETWEEN now() AND date_add(now(), INTERVAL 21 DAYS;

This way mysql will calc the now() and date_add and will essentially 
convert them to static values.  If there's an index on theEventDate it 
will be used.


Mike...

Instruct ICC wrote:

From: rDubya [EMAIL PROTECTED]
My problem is that I have events dated for Sep 2007 and on, and yet
they all come up as being on Dec 7 to 9, 2006..  any ideas?

rDubya


How about having MySQL only return the events you are interested in?

SELECT yourEventFields FROM theTable
WHERE
TO_DAYS( theEventDate ) = TO_DAYS( NOW() )
AND
TO_DAYS( theEventDate ) = TO_DAYS( NOW() ) + 21

I like theEventDate to be in the format -MM-DD

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_to-days 



_
A place for moms to take a break! 
http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us




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



Re: [PHP-DB] date problems

2007-09-06 Thread Mike Gohlke
Argh, make sure you add the closing paren for the date_add since I 
forgot it.


Mike...

Mike Gohlke wrote:
It's much better to use add_date instead of to_days since mysql isn't 
smart enough to do it for you.

Such as:
SELECT yourEventFields FROM theTable
WHERE theEventDate BETWEEN now() AND date_add(now(), INTERVAL 21 DAYS;

This way mysql will calc the now() and date_add and will essentially 
convert them to static values.  If there's an index on theEventDate it 
will be used.


Mike...

Instruct ICC wrote:

From: rDubya [EMAIL PROTECTED]
My problem is that I have events dated for Sep 2007 and on, and yet
they all come up as being on Dec 7 to 9, 2006..  any ideas?

rDubya


How about having MySQL only return the events you are interested in?

SELECT yourEventFields FROM theTable
WHERE
TO_DAYS( theEventDate ) = TO_DAYS( NOW() )
AND
TO_DAYS( theEventDate ) = TO_DAYS( NOW() ) + 21

I like theEventDate to be in the format -MM-DD

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_to-days 



_
A place for moms to take a break! 
http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us






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



[PHP-DB] Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink

2007-08-26 Thread mike
On 8/26/07, Richard Lynch [EMAIL PROTECTED] wrote:

 This is *SO* not correct at all!

 $_REQUEST[] is merely array_merge($_GET, $_POST, $_COOKIE);

Yes and it mimics being lazy - allowing overriding values from $_POST
vs. $_GET vs. $_COOKIE depending on what the programmer wants to
trust

It encourages poor practices. There is no reason to not name the
proper source of data - i.e. i want it from POST not GET

 It is *NOT* in any way, shape, or form, polluting the global namespace
 of all your variables, which is what register_globals is.

That is why I said it was *one* reason register_globals was disabled -
global namespace was probably the biggest reason, but also variable
overriding and sloppyness allowing for exploits was probably up there
too.

 There could easily be a script written which is expected to respond to
 GET or POST data in the same way, particularly a simplistic
 web-service that doesn't really care if the web Designers prefer to
 have buttons or links or CSS links that look like buttons or CSS
 buttons that look like links or rabid squirrels that send the GET
 and/or POST data to make the HTTP request.

Yes, there could. But part of that would rely on a *very* motivated
end-user (or we'll call them hacker) - they would probably find a
way in or do what they want either way.

There's no reason to make it easier just because well they can hack
something up to do that anyway - that's a Microsoft approach to
security. Whatever happened to people at least trying to discourage
abuse or issues.

I have never used $_REQUEST and my applications don't seem to have any
issues. Obviously someone could have tried to switch POST/GET on me,
but I still ensure proper bounds checking/sanity checking/type
checking/etc. But I would not allow someone to issue a GET variable to
override a cookie value without having to make the extra effort (and
furthermore understand how the variables work on the server side to
make it actually work how they want.)

 Use $_POST when you expect the data to always be in POST data.

correct.

 Use $_GET when you expect the data to alwasy be in GET data.

correct.

 If you actually want to accept HTTP requests of either kind for
 flexibility to an external user, by all means use REQUEST.

In my opinion a properly coded web application shouldn't be lazy and
should know the source of data. So I consider this incorrect.

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



[PHP-DB] Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink

2007-08-26 Thread mike
 I'll say it again:

 regsiter_globals has *NOTHING* to do with $_REQUEST.

 Zero.
 Zilch.
 Nada.
 Zip.

To me it allows for the same [lazy] behavior. Period. I've had other
people agree. Say what you want about it.

 No, it only relies on one Designer who wants their request to look
 like a FORM and another Designer who wants their request to look
 like a link.

I've never had to write an app where I allow GET and POST. Either way
can be created using a form, a button, a link, etc. Pick one and stick
with it.

 And I don't really *CARE* if the search terms (or whatever input it
 its) comes from GET versus POST as there is NO Security difference
 whatsoever.

 They need equal filtration.

Agreed

 The point is that GET and/or POST are equally tainted data, and that I
 wish to provide the same services to either kind of request, and there
 is NO DIFFERENCE between them for this service.

I disagree with that approach to a web application.

 You're still not getting the point.

No, I get it. I was too vague in my original message. To me newbies
picked up PHP easily because hey, this query string variable is $foo
just like when I do a post variable of $foo! and $_REQUEST to them is
their way to get around a register_globals = off installation. I've
seen it many times with people just learning PHP. I associate the use
of $_REQUEST with people new to PHP, because I've seen it many times.
Also when told about $_GET, $_POST, $_COOKIE, etc... they realized how
much cleaner that is and adjust appropriately.

 There *ARE* valid reasons for allowing GET and POST to be used
 inter-changably.

 Consider a stupid simple web service that lets you look up
 Longitude, Latitude by zip code from their own website.

 Do you really CARE if they use a link or a form to REQUEST the
 long/lat with the zip input?

 No.  You don't.

You're right - I don't. But I tell them to use GET or POST and they
prepare their client-side code appropriately. Both ways can be done. I
don't make my applications lazy and then allow two interfaces to them
when one is perfectly fine and allows for one consistent interaction
method.

 But please do NOT spread mis-information that using $_REQUEST un-does
 what turning register_globals off does.  Because that is simply not
 factually correct, no matter how you feel about $_REQUEST.

Eh, you call it mis-information. I call it advising on how to code a
tighter web application.

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



[PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink

2007-08-24 Thread mike
On 8/23/07, Suamya Srivastava [EMAIL PROTECTED] wrote:
 Hello,

 How can I pass variables on clicking a hyperlink to a PHP script? I have 5
 hyperlinks, all pointing to the same PHP script. However, on clicking each
 hyperlink a different value of the variable needs to be passed to the PHP
 script.
 i.e.  I have 5 databases from which I want to obtain information, however
 the information should be displayed only when the user clicks on the
 hyperlink for that database. How can I pass the database name to the PHP
 script? How would the script know which database to get information from?

 I am new to PHP so any help would be greatly appreciated. I hope my
 question is clear.

use GET

foo.php?param=value

or you could use POST by using some client-side javascript to do a
form submit with key/value pairs.

this is a *very* simple operation... all web-enabled languages
understand HTTP POST/GET/etc. - those are the main ways of exchanging
data between client/server.

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



Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink

2007-08-24 Thread mike
On 8/24/07, Goltsios Theodore [EMAIL PROTECTED] wrote:
 the posted or got option buy using the $_REQUEST array ($_GET and $_POST are
 included in that like a less lame solution). Let's say you have a

Please do not encourage the use of $_REQUEST.

You might as well just tell people to enable register_globals again.

Use $_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, etc. for the
appropriate source of data. $_REQUEST is laziness and introduces most
of the same issues that was the reasoning behind disabling
register_globals to begin with.

(As for dropdowns, that's just an in-browser method of collecting data
and sending the key/value pairs in POST or GET... IMHO the HTML
portion should already be known before someone steps into the realm of
PHP and server-side programming)

- mike

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



[PHP-DB] Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink

2007-08-24 Thread mike
On 8/24/07, Suamya Srivastava [EMAIL PROTECTED] wrote:
 Hi..

 in the settings, session.use_cookies is turned ON but session.trans_sid is
 turned OFF. do i need to enable this as well?
 by doing this can i disable the register_globals?
  - suamya

You need to make sure session_start() is called on all pages to be
able to read/write the session data. This is probably the case.

I have never needed to use trans_sid. It introduces some complexities
that I don't think are needed.

$_REQUEST is basically a new way of doing register_globals, which is a
security issue. register_globals can allow a savvy user to overwrite a
variable with another source - say you wanted a POST variable, a user
could supply GET instead. or if you want it to come from a cookie
using $_COOKIE it could be overridden using GET. If that makes sense.
There's a lot of information about it. It was disabled by default a
while back. Never enable it. You do not need it, period. Anyone
telling you to enable it or reading somewhere you need to enable it is
*absolutely* incorrect.

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



Re: [PHP-DB] Read more link with HTML code

2007-05-08 Thread Mike van Hoof

Hello:

EG:

iThe community of Gbongay, Sierra Leone, suffered greatly after the country's civil war, and had aspirations of starting a beekeeping operation to improve their situation. That's when they turned to NABUUR for assistance. But with Neighbours living all over the world and a Facilitator with no knowledge of bees, could this dream ever become a reality?/ibr /br /bThe challenge/bbr 
/Gbongay, a rural village situated in southeast Sierra Leone, lost everything after the civil war -- the school and hospital were destroyed, and its inhabitants no longer had access to safe water. To try to overcome this tragedy, the community decided it needed to raise money, which could be used to create a small, sustainable business.br /br /Beekeeping seemed to be a promising option, since it required only a 
small investment and had the potential for a high return -- and the proof was in the neighbouring village, which already had a successful honey business.br /br /bA real leader/bbr /What really got this project started was the project's Facilitator, Raul Alberto Caceres. Born in Colombia, Raul moved to Australia for a post-graduate programme. He now works as a chemical engineerbr /in 
the food industry and recently joined NABUUR.br /br /As the leader of the beekeeping project, Raul designed a detailed plan. He knew they needed to research as much as possible about starting and running a beekeeping operation, and that the assistance of thebr /Neighbours was going to be essential.br /br /The Neighbours -- from more than ten countries -- were involved at different stages of 
the project depending on their expertise. Somebr /volunteers helped with general tasks, like Internet research, letter writing and contacting organisations for information, while others helped with more specific assignments that pertained to beekeepingbr /itself.br /br /bQuick success/bbr /Gbongay's beekeeping operation progressed quickly -- and it couldn't have been done 
without Raul's impressive leadership abilities. He showed enthusiasm on the website and was able to mobilisebr /volunteers all over the world, including Turkey, Ghana, Canada and the Netherlands. Because NABUUR volunteers often never have the chance to meet in person, it's essential that a project's Facilitator be an organised and enthusiastic leader. Fortunately for the community of Gbongay, Raul was just that!br 
/br /bBeekeeping today/bbr /img src=http://www.nabuur.com/uploads/img_4512900141172.jpg; align=right hspace=15 alt= /The beekeeping operation in Gbongay has further expanded and now includes a beekeeping school. After some research, the Neighbours and local community decided this would be a great way tobr /ensure the future of the 
beekeeping business. In March 2006, everyone began work on the school.br /br /Today, things are looking better for the village of Gbongay. The community's first water pump has been installed, the first 35 beekeepers have graduated from the new school -- and, best of all,br /the first customers are buying honey!br /br /bBonus/bbr /Gbongay has been rewarded by 
nature. It wasbr /given the local bee, which is extremely prolific, anbr /abundance of bee flora and a favourable climatebr /for beekeeping -- making this initiative a lucrativebr /one.br /br /Mariama Fawundu, Local Representativebr /br /


With kind regards

Mike

Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024  
fax: 040-29 63 567

url: www.medusa.nl
mail: [EMAIL PROTECTED]

Uw bedrijf voor Multimedia op Maat



Rafael Costa Pimenta schreef:

could you show some example?

2007/5/7, Mike van Hoof [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:

Hello list,

I got a problem with displaying content in a read more block which
contains HTML code.
The problem is as followes:

I got a large piece of content, which contains HTML code (bui
etc), but after 200 characters a read more link appears. At the
moment I
strip al the HTML out of this piece of content, and display the
full set
off content on another page.
But now i also want to display the bold text etc. in the first (200
chrs) content block. The only problem i have here, is that when I
got a
bold tag opend in the first 200 chrs, and it's closed after 400 chrs,
then the rest off the page is also bold.

somebody got a solution ?

Thanks for reading.

Mike

--
Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024
fax: 040-29 63 567
url: www.medusa.nl http://www.medusa.nl
mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

Uw bedrijf voor Multimedia op Maat

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




--
Atenciosamente,
Rafael C. Pimenta
Programador - CTT Integration Group 


Re: [PHP-DB] Re: Read more link with HTML code

2007-05-08 Thread Mike van Hoof

Hey,

a client can type anything in the field, so all kind of HTML tags can be 
inserted...


- Mike

Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024  
fax: 040-29 63 567

url: www.medusa.nl
mail: [EMAIL PROTECTED]

Uw bedrijf voor Multimedia op Maat



bedul schreef:

i prefer u use the prefix.. but it very advance..

can u spesific more.. client able to type what tag (u must consider lock
other than what u type earlier)
anyway.. using a table is a good idea.. actualy if your client type using
table.. what should u do??
- Original Message -
From: itoctopus [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Tuesday, May 08, 2007 7:26 AM
Subject: [PHP-DB] Re: Read more link with HTML code


  

Put your 200 characters in a table block:
table
tr
td
Your 200 characters
/td
/tr
/table

--
itoctopus - http://www.itoctopus.com
Mike van Hoof [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]


Hello list,

I got a problem with displaying content in a read more block which
contains HTML code.
The problem is as followes:

I got a large piece of content, which contains HTML code (bui
  

etc),
  

but after 200 characters a read more link appears. At the moment I strip
al the HTML out of this piece of content, and display the full set off
content on another page.
But now i also want to display the bold text etc. in the first (200
  

chrs)
  

content block. The only problem i have here, is that when I got a bold
  

tag
  

opend in the first 200 chrs, and it's closed after 400 chrs, then the
  

rest
  

off the page is also bold.

somebody got a solution ?

Thanks for reading.

Mike

--
Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024  fax: 040-29 63 567
url: www.medusa.nl
mail: [EMAIL PROTECTED]

Uw bedrijf voor Multimedia op Maat
  

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




  


Re: [PHP-DB] Read more link with HTML code

2007-05-08 Thread Mike van Hoof

Hey,

thanks for the help everyone, but after reading all the answers i 
decided to do some regexp thingies. Came up with this:


   function readMore_closedtags($text, $length) {
   preg_match_all('/(.*?)/s',substr(stripslashes($text), 0, 
$length),$out);

   foreach($out[1] as $key2 = $val2){
   if(
   !preg_match(/br.*/, $val2) 
   !empty($val2)
   ){
   $val2_arr = explode( , $val2);
   $val2 = $val2_arr[0];
   if(preg_match(/^\//, $val2))
   $html_arr_close[] = strtolower($val2);
   else
   $html_arr_open[] = strtolower($val2);
   }
   }
  
   $not_closed_tags = array();

   foreach($html_arr_open as $tag){
   $key = array_search(/ . $tag, $html_arr_close);
   if($key !== false){
   unset($html_arr_close[$key]);
   } else {
   $not_closed_tags[] = $tag;
   }
   }
  
   $closed_tags_str = '';

   foreach($not_closed_tags as $tag){
   $closed_tags_str .= / . $tag . ;
   }
   return $closed_tags_str;
   }

Mike

Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024  
fax: 040-29 63 567

url: www.medusa.nl
mail: [EMAIL PROTECTED]

Uw bedrijf voor Multimedia op Maat



Mike van Hoof schreef:

Hello:

EG:

iThe community of Gbongay, Sierra Leone, suffered greatly after the 
country's civil war, and had aspirations of starting a beekeeping 
operation to improve their situation. That's when they turned to 
NABUUR for assistance. But with Neighbours living all over the world 
and a Facilitator with no knowledge of bees, could this dream ever 
become a reality?/ibr /br /bThe challenge/bbr /Gbongay, a 
rural village situated in southeast Sierra Leone, lost everything 
after the civil war -- the school and hospital were destroyed, and its 
inhabitants no longer had access to safe water. To try to overcome 
this tragedy, the community decided it needed to raise money, which 
could be used to create a small, sustainable business.br /br 
/Beekeeping seemed to be a promising option, since it required only a 
small investment and had the potential for a high return -- and the 
proof was in the neighbouring village, which already had a successful 
honey business.br /br /bA real leader/bbr /What really got 
this project started was the project's Facilitator, Raul Alberto 
Caceres. Born in Colombia, Raul moved to Australia for a post-graduate 
programme. He now works as a chemical engineerbr /in the food 
industry and recently joined NABUUR.br /br /As the leader of the 
beekeeping project, Raul designed a detailed plan. He knew they needed 
to research as much as possible about starting and running a 
beekeeping operation, and that the assistance of thebr /Neighbours 
was going to be essential.br /br /The Neighbours -- from more than 
ten countries -- were involved at different stages of the project 
depending on their expertise. Somebr /volunteers helped with general 
tasks, like Internet research, letter writing and contacting 
organisations for information, while others helped with more specific 
assignments that pertained to beekeepingbr /itself.br /br 
/bQuick success/bbr /Gbongay's beekeeping operation progressed 
quickly -- and it couldn't have been done without Raul's impressive 
leadership abilities. He showed enthusiasm on the website and was able 
to mobilisebr /volunteers all over the world, including Turkey, 
Ghana, Canada and the Netherlands. Because NABUUR volunteers often 
never have the chance to meet in person, it's essential that a 
project's Facilitator be an organised and enthusiastic leader. 
Fortunately for the community of Gbongay, Raul was just that!br /br 
/bBeekeeping today/bbr /img 
src=http://www.nabuur.com/uploads/img_4512900141172.jpg; 
align=right hspace=15 alt= /The beekeeping operation in Gbongay 
has further expanded and now includes a beekeeping school. After some 
research, the Neighbours and local community decided this would be a 
great way tobr /ensure the future of the beekeeping business. In 
March 2006, everyone began work on the school.br /br /Today, 
things are looking better for the village of Gbongay. The community's 
first water pump has been installed, the first 35 beekeepers have 
graduated from the new school -- and, best of all,br /the first 
customers are buying honey!br /br /bBonus/bbr /Gbongay has 
been rewarded by nature. It wasbr /given the local bee, which is 
extremely prolific, anbr /abundance of bee flora and a favourable 
climatebr /for beekeeping -- making this initiative a lucrativebr 
/one.br /br /Mariama Fawundu, Local Representativebr /br /



With kind regards

Mike

Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024  fax: 040-29 63 567
url: www.medusa.nl
mail: [EMAIL PROTECTED]

Uw bedrijf voor Multimedia op Maat



Rafael Costa Pimenta

[PHP-DB] Read more link with HTML code

2007-05-07 Thread Mike van Hoof

Hello list,

I got a problem with displaying content in a read more block which 
contains HTML code.

The problem is as followes:

I got a large piece of content, which contains HTML code (bui 
etc), but after 200 characters a read more link appears. At the moment I 
strip al the HTML out of this piece of content, and display the full set 
off content on another page.
But now i also want to display the bold text etc. in the first (200 
chrs) content block. The only problem i have here, is that when I got a 
bold tag opend in the first 200 chrs, and it's closed after 400 chrs, 
then the rest off the page is also bold.


somebody got a solution ?

Thanks for reading.

Mike

--
Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024  
fax: 040-29 63 567

url: www.medusa.nl
mail: [EMAIL PROTECTED]

Uw bedrijf voor Multimedia op Maat

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



RE: [PHP-DB] variable with NULL value

2007-05-04 Thread Ford, Mike
On 03 May 2007 16:22, OKi98 wrote:

 Hi,
 
 one more question.
 
 Why the variable, that contains NULL value appears to be not
 set.

U -- because that's how it's defined??  (http://php.net/isset)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730  Fax:  +44 113 812 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm


Re: [PHP-DB] weird comparsion

2007-05-03 Thread Mike van Hoof

http://nl3.php.net/manual/en/language.operators.comparison.php

try using === (3x =) for comparison

- Mike

OKi98 schreef:

Hello,

Why does anything compared to 0 return true?

I know it might seem to be a bit off-topic, but for me it is important 
for detecting if NULL value in table has been changed (for example 
NULL is changed to 0).


if (foo==0) echo(foo equals to 0);

OKi98



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



RE: [PHP-DB] weird comparsion

2007-05-03 Thread Ford, Mike
On 03 May 2007 12:30, OKi98 wrote:

 I know about identity operator (===) but with == operator 0 is false
 and foo is true

No, that's not correct.

  , try this:
 
 $foo=0;
 $bar=bar;
 if ($foo) echo($foo is true, );
 else echo($foo is false, );
 if ($bar) echo($bar is true, );
 else echo($bar is false, );
 if ($foo==$bar) echo($foo==$bar);
 
 returns 0 is false, bar is true, 0==$bar

That's because you've got loads of implicit type conversions going on there, so 
you're not comparing like with like.

For  if ($foo) ... and if ($bar) ...:

within the context of the if(), both $foo and $bar are implicitly converted to 
Boolean:
  - (bool)0 is FALSE
  - (bool)any non-empty() string is TRUE


On the other hand, for  if ($foo==$bar) ...:

in the context of the == comparison, $bar is converted to a number, and any 
string not beginning with a numeric character converts to numeric zero -- so 
you get a comparison of zero with zero, which is, of course, TRUE!

Or, in other words, (bool)$foo!==(bool)$bar, BUT (int)$foo===(int)$bar


It's exactly when you *don't* want this kind of automatic type-conversion 
shenanigans going on that you should use the === operator to make your intent 
entirely clear -- otherwise you have to be extremely aware of the context in 
which you are evaluating your variables in order to avoid hidden surprises like 
this.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730  Fax:  +44 113 812 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm


Re: [PHP-DB] PHP_AUTH_USER .htaccess

2007-03-06 Thread Mike van Hoof
This must be set on On, because in a directory where the .htaccess 
file doesn't exist it works, or can that setting also be set to on?


- Mike

bedul schreef:

- Original Message -
From: Mike van Hoof [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Tuesday, March 06, 2007 3:02 PM
Subject: [PHP-DB] PHP_AUTH_USER  .htaccess


  

Hello,

I've got a really strange problem, and hope this is the right list to
post to.

I got a website with a login, which uses a .htaccess file for
autentication. That part works like a charm. But when i want to read the
loggin details with PHP, the variable $_SERVER['|PHP_AUTH_USER'] isn't
set (in the directory where i logged into)

when i go a directory back, and view a phpinfo() there i see
|$_SERVER['|PHP_AUTH_USER']|| is set, so i do a phpinfo() in the
directory with the .htaccess and it is gone.

Had anyone ever had experience with this, because i can't find a solution.

- Mike|


i do believe this can only be answer by your webadmin.. since this might not
your local but using web right??
try ask to them are the php_auth_user is set ON

  


[PHP-DB] Re: SQL Query - Using variable from another SQL Query

2007-02-12 Thread Mike Morris

I think you don't need to break this into two queries... this is really a SQL 
question, 
not a PHP question... 

Just do a join on the two tables:
*   where table1.cal_id = table2.cal_id

and then have a where clause that does all your filtering:

*   and table1.Date  now() and table2.cal_category='501' 


Using SQL instead of code is almost always the right thing to do. Learning how 
to 
do more sophisticated queries will pay off big time in the long run... and good 
tutorials are widely and freely available...



From:   Matthew Ferry [EMAIL PROTECTED]
To: php-db@lists.php.net
Date sent:  Mon, 12 Feb 2007 11:14:32 -0500
Subject:SQL Query - Using variable from another SQL Query

 Hello Everyone
 
 Got a simple / stupid question.
 Worked on this all night. I'm over looking something very basic here.
 
 The query event_time brings back the calendar id for each event that is 
 pending in the future.
 ie 12, 13, 14, 26  (There could be 100 of them out there)
 
 The second query events needs to meet both reqirements.  
  1 - cal_category='501' 
  2 - cal_id= a number from the event_time query
 
 I think i need to do a loop inside of a loop
 
 Thanks...
 
 Matt 
 
 
 Here is my code: 
 
 ?php
 
 $todays_year = date(Y);
 
 $todays_month = date(m);
 
 $todays_day = date(d);
 
 $tstamp = mktime(0, 0, 0, $todays_month, $todays_day, $todays_year);
 
 $event_time = mysql_query(SELECT cal_id FROM egw_cal_dates where cal_start  
 $tstamp, $db);
 
 $events = mysql_query(SELECT * FROM egw_cal WHERE cal_category='501' and 
 cal_id='$event_time'\n, $db);
 
 
 
 if ($event = mysql_fetch_array($events)) {
 
 echo center\n;
 
 echo HR\n;
 
 do {
 
 echo BFont 
 Size='10'$event[cal_title]nbsp;nbsp;nbsp;nbsp;-nbsp;nbsp;nbsp;$event[cal_location]/B/Font\n;
 
 echo BR\n;
 
 echo $event[cal_description];
 
 echo BR\n;
 
 echo HR\n;
 
 } while ($event = mysql_fetch_array($events));
 
 } else {
 
 echo No Public Events Are Currently Scheduled...;
 
 }
 
 ?
 
 




[PHP-DB] MYSQL REGEXP question

2007-01-09 Thread mike
Hello,

i am try to make a regular expression work, but keep getting an error 
message
does anyone know how i can make it work?
The query is:

SELECT 'boer bv' REGEXP '[ b|^b](?![v$|v ])';

So it has to match each starting 'b' and all the b's pf following words. 
But now followed by a v(line end) or a v followed by a space.

so it should match:

'b test'
'test b'
'test b bv'
'bv b test'

and NOT

'test bv'
'bv test'

Any idea's?!

Thanks, mike

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




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsigAdmID:FB05127CFE0569CA76887DED108E0F2F



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


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

[PHP-DB] MYSQL REGEXP question

2007-01-08 Thread Mike van Hoof

Hello,

i am try to make a regular expression work, but keep getting an error 
message

does anyone know how i can make it work?
The query is:

SELECT 'boer bv' REGEXP '[ b|^b](?![v$|v ])';

So it has to match each starting 'b' and all the b's pf following words. 
But now followed by a v(line end) or a v followed by a space.


so it should match:

'b test'
'test b'
'test b bv'
'bv b test'

and NOT

'test bv'
'bv test'

Any idea's?!

Thanks, mike

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



RE: [PHP-DB] detecting negative numbers

2006-07-17 Thread Ford, Mike
On 17 July 2006 01:07, Dave W wrote:

 No, I get it. I just thought that there might have been some built in
 function like if(neg_num($quant - $amount))
 or something like that. I know how to do it, but I thought
 that there might
 have been an alternate method. Just because I asked a simple question
 doesn't mean I'm stupid, I'm just curious if there is a
 simpler way to do an
 already simple task.

The absolute simplest way to do this is what you originally had.  I would not 
look further than

if ($quant$amount)
   // $quant-$amount is negative

If I were reading your code, I would find both if(($quant-$amount)0) and 
if(neg_num($quant-$amount)) more obfuscating than if($quant$amount).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



[PHP-DB] Need Help Compiling PHP5 With MS SQL Support

2006-07-03 Thread Mike
I am new to Linux and have NEVER compiled PHP. I have PHP 5 and need to
compile it with MS SQL support. Per PHP docs, I installed FreeTDS and tested
it and it works. Now I need to (re)compile PHP to get the support I need to
access MS SQL databases. I am on a Ubuntu 6.06 version of Linux.

Again, PLEASE keep in mind that I am new to all of this. I tread VERY softly
doing this! (I am on a VMWare virtual server and have made a clone drive as
a backup.)

Am I correct that my first step is to see what is already compiled into my
version of PHP using php -m? I have that list.

I assume that my next step is to get the PHP source for PHP 5.1.4.  From
here on I do not understand clearly by reading the docs I have searched for
on the Internet through Google. Is there a place that has a VERY clear, step
by step process to compile PHP?

Any and all help is GREATLY appreciated.

TIA.

Mike

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



RE: [PHP-DB] PHPSESSID how to append and access

2006-05-25 Thread Ford, Mike
On 25 May 2006 12:12, Girish Agarwal wrote:

 Hi All,
  I am using header(Location:
 http://dv-medical/phpscripts/test.php;) function to hop from
 one Page to
 Another in My Web Application
 My Problem is I have been unable to get the exact
 syntax to append
 the Session ID to the URL specified in the header so that it
 is available

  header(Location: http://dv-medical/phpscripts/test.php?.SID)

That's what the SID constant is for.  You can even use it with impunity when 
cookies are in use, since it is set to the empty string in that case.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP-DB] Displaying results from a query properly.

2006-03-27 Thread Ford, Mike
On 24 March 2006 16:40, Alex Major wrote:

 Thanks, works like a charm (had to make is -2 instead of -1
 as it added a
 space after each result). Hadn't thought of something so simple.
 
 On 24/3/06 16:22, Bastien Koert [EMAIL PROTECTED] wrote:
 
  Build it up as a string and remove the trailing comma at the end of
  the loop 
  
  do { $sHTML .= ''.$administrators['username'].', ';}
  while ($administrators = mysql_fetch_assoc($administrators_result))
  
  $sHTML = substr($sHTML, 0, strlen($sHTML)-1);

You don't need a strlen() call here, as substr understands count from the 
right notation:

   $sHTML = substr($sHTML, 0, -1);

... or, with Alex's correction:

   $sHTML = substr($sHTML, 0, -2);

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP-DB] Quick question

2005-12-09 Thread Ford, Mike
On 08 December 2005 20:53, Chris Payne wrote:

 Hi there everyone,
 
 
 
 How do I set the following items with ini_set()?  I looked at
 the manual but
 when I try nothing happens:
 
 
 
 * file_uploads
 * upload_max_filesize
 * max_input_time
 * memory_limit
 * max_execution_time
 * post_max_size

Apart from max_execution_time, the things affected by those settings all take 
place before your script even gains control -- so changing them in the script 
can never have any useful effect.  To do any good, they must be set in an 
appropriate config file (php.ini, httpd.conf, .htaccess, etc.) as permitted.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP-DB] problem of transmiting variabl into another page?

2005-12-07 Thread Ford, Mike
On 02 December 2005 13:06, Bastien Koert wrote:

 ?php for ($j=ord('A'); $j = ord('Z'); $j++) {
 echo | ba
 href='alpha.php?artist=.chr($j).'.chr($j)./a/b ;
 
   } ?
 
 You need to use the ORD function to get the numerical ascii
 equivalent of the letter and the CHR function to go back the other
 way.

Gak! That's almost worse than the original!!

 
 Bastien
 
 
  From: Mohamed Yusuf [EMAIL PROTECTED]
  To: php-db@lists.php.net
  Subject: [PHP-DB] problem of transmiting variabl into another page?
  Date: Fri, 2 Dec 2005 12:30:12 +0200
  
  I am transmitting variable from one of my pages and I would like to
  match that variable into mysql data. it won't return data.
  my code is this.
  
  ?php for ($j=A; $j = Z; $j++) {
 echo | ba href='alpha.php?artist=$j'$j/a/b |;
 if  ($j == Z) {
   break;
}
   } ?

1. You have unquoted strings -- should be 'A' and 'Z'.

2. The test condition in your for is wrong (and either that or the break is 
redundant).

Here's how I'd write it:

   for ($j='A'; $j!='AA'; $j++):
 echo | ba href='alpha.php?artist=$j'$j/a/b |;
   endfor;

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 



To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP-DB] pg_insert tyro question

2005-08-22 Thread mike burnard
I certainly agree with that Micah.  array_pop only removes that last 
item.  If you are in a an open environment you definitely want to 
include security checks and form validation.


-mike
On Aug 22, 2005, at 4:07 PM, Micah Stevens wrote:



This is tenuous and insecure, you have no control over the $_POST 
array, only
the submitting page does, I'd do a sanity check, and assign the values 
needed

into another array before submitting to the database.

This is also primed for a SQL injection attack.

Bad idea.. IMHO..

-Micah

On Monday 22 August 2005 3:52 pm, Jon Crump wrote:

Thanks mike! that did the trick. This works:

array_pop($_POST);
/* this gets rid of the last element of $_POST which is 'addentry' 
from
the form's submit button. $_POST now containes ONLY the values 
expected by
pg_insert. By the way, the order of the values in $_POST does not 
seem to
matter, only that there are exactly as many as there are columns in 
the

table and their names match the columns exactly.*/

$res = pg_insert($db, 'foo', $_POST);
if ($res) {
echo You're a Genius;
} else {
print pg_last_error ($db);
exit;
}

On Mon, 22 Aug 2005, mike burnard wrote:
It very likely is the error.  you can use array_pop($_POST); to 
remove
that last line.  You can always have your insert function return an 
error

on failure. snip /


By the way Bastian and John, thanks for responding to my pg_connect
question some days ago. Installing Marc Liyanage's distribution did 
the

trick!

Thanks too to Bastian and Micah.


Or if you need to store all the values, you could normalize the table


field


into another table.


-Micah

On Monday 22 August 2005 3:19 pm, Bastien Koert wrote:

To further append the previous note,

if you want to insert the array, you need to serialize it
(www.php.net/serialize) to make the array db safe

if you want to insert the individual specific values, you will need 
to

implode the array with separators (and check the data in the correct


order

for the field list) or you will need to supply a field list that 
matches
the array list to ensure the data elements are placed into the 
correct

columns

Bastien


I'm not sure what any of this means, but it didn't turn out to be
necessary.

Jon




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



Re: [PHP-DB] mysql INNER JOIN

2005-05-29 Thread Mike Bellerby

have a look at http://www.webmasterworld.com/forum88/3653.htm

hope this helps!

Mike


ioannes wrote:

I usually use INNER JOIN to link tables together in a straight line, 
like a branch.  Can I use it to link tables like twigs stemming off 
the branch.  If so, do I use:


SELECT
TABLE1.FIELD, TABLE2.FIELD, TABLE3.FIELD
FROM
(
TABLE1 INNER JOIN TABLE2
ON TABLE1.FIELD =TABLE2.FIELD
)
INNER JOIN TABLE3
ON TABLE1.FIELD=TABLE3.FIELD

or if the join has to be in the middle:

SELECT
TABLE_1.FIELD, TABLE_2.FIELD, TABLE_3.FIELD, TABLE_4.FIELD
FROM
TABLE_1 INNER JOIN
(
TABLE_2 INNER JOIN TABLE_3
ON TABLE_2.FIELD =TABLE_3.FIELD
)
ON TABLE_1.FIELD=TABLE_2.FIELD
INNER JOIN TABLE_4
ON TABLE1.FIELD=TABLE3.FIELD


John


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



RE: [PHP-DB] Problem with foreach looping...

2005-04-07 Thread Mike Johnson
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] 

   I am attempting to use a simple foreach loop on a query result,
 and I am only getting the first element of the array back.  
 Here is the
 code...
 
 $exclude_query = SELECT hostname FROM exclusion;
 $exclude_results = mysql_query($exclude_query, $Prod);
 $exclude = mysql_fetch_array($exclude_results, MYSQL_NUM);
 
 foreach ($exclude as $row) {
   echo $row\n;
 }
 
   I don't understand how I am just getting a single item back from
 this.  The query actually returns all 13 entries in the 
 exclusion table.
 I have tested the query via the mysql client.  I also get all 13
 elements back if I loop via the following.
 
 while ($test = mysql_fetch_array($results, MYSQL_NUM)) {
   echo $test[0]\n;
 }
 
   Is my PHP somehow broke, or am I just missing something here?
 Thanks.

mysql_fetch_array() only fetches one record of the result set at a time.
Thus, the code's doing what you told it to. The while() loop is what you
want. Why do you need to use a foreach() loop? At that point, there's
nothing to foreach() through. No array has been constructed.

HTH!


-- 
Mike Johnson Smarter Living, Inc.
Web Developerwww.smartertravel.com
[EMAIL PROTECTED]   (617) 886-5539

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



[PHP-DB] MYSQL row position.. is it possible (urgent)

2005-03-04 Thread Mike
Let's say I have a database and I want to find the position of a row when it is 
ordered by a specific column

before a sort:

UNIQUE ID   | SCORE
1   | 100
2   | 50
3   | 30
4   | 80
5   | 50

after sort:

UNIQUE ID   | SCORE
1   | 100
4   | 80
2   | 50
5   | 50
3   | 30

is it posible to find the position of 4 with a query or mysql function?

Normally I'd just 'SELECT unique_id FROM table ORDER DESC' then loop through 
the results looking for a matching id, however my table contains thousands of 
entries, and it's simply not possible do do it that way.

Thanks
Mike


[PHP-DB] How-to pass informational mysql messages to the browser

2005-02-25 Thread Mike Millner
Hello everyone,
My PHP/mysql pages are working perfectly, the problem is users don't know if 
what they are doing is working.

I have a system that adds and deletes tape id's from mysql via a PHP front 
end.

I would like to pass the same success/failure messages that I would get if I 
performed the add/delete directly within mysql.

For example, If I delete a tape from the db within mysql, after I hit enter 
I get the following message:

mysql delete from tape_tracking_test where media_id like 'TR44';
Query OK, 1 row affected (0.01 sec)
I would like to display this message to the browser:
Query OK, 1 row affected (0.01 sec)
Any help would be appreciated,
Thanks,
Mike
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] How-to pass informational mysql messages to the browser

2005-02-25 Thread Mike Millner
Hello everyone,
My PHP/mysql pages are working perfectly, the problem is users don't know 
if
what they are doing is working.

I have a system that adds and deletes tape id's from mysql via a PHP front
end.
I would like to pass the same success/failure messages that I would get if 
I
performed the add/delete directly within mysql.

For example, If I delete a tape from the db within mysql, after I hit enter
I get the following message:
mysql delete from tape_tracking_test where media_id like 'TR44';
Query OK, 1 row affected (0.01 sec)
I would like to display this message to the browser:
Query OK, 1 row affected (0.01 sec)
Any help would be appreciated,
Thanks,
Mike
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: boolean values in postgresql

2005-02-21 Thread Mike Morris
On 21 Feb 2005 at 20:54, Bret Hughes said about boolean values in postgresql:

 Question:  Assuming the above assumption is correct, what is the most
 efficient way to define a column that will take only two values who's
 values will evaluate as intended in php?

How about a CHAR(1) with Y/N (or T/F) and use a trigger to enforce it. 
Or you could 
use the small int and have 0/1... the validating trigger's the point...


Mike Morris
The Music Place
1617 Willowhurst Avenue
San Jose, CA 95125
(408) 445-ARTS (2787)

Your Free Quote:
And that, in my view, is what the whole controversy comes down to: 
Are you entitled to the fruits of your own labor, or does government 
have some presumptive right to spend and spend and spend?
Ronald Reagan, 1981


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



[PHP-DB] Re: Newbie Setup Trouble

2005-02-07 Thread Mike Rondeau
Hello list,

I'd just like to thank everyone who jumped right in with their insights and 
suggestions to my troubles. There's a lot to get me going there! Every one 
of those posts was helpful.

I have downloaded XAMPP and am going to install it here in a minute. Armed 
with that, and the use of search as Jerry suggested, I bet all will go 
much more smoothely now, hehe.

Just wanted to affirm to you all that your assistance was appreciated :)

~Mike 

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



RE: [PHP-DB] timestamp

2005-02-01 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



 -Original Message-
 From: Balwant Singh [mailto:[EMAIL PROTECTED] 
 Sent: 01 February 2005 08:08
 
 on echoing $timestamp i m getting Fri Jan 28 19:53:09 2005 
 but on echoing $date i m getting 1970-01-01.  
 also i m getting full info. by phpinfo()
 
 i m using php 4.2.2 , apache 2.0 and rad hat 9.

The Change Log includes this line for version 4.3.3:

Fixed bug #13142 (strtotime not handling M d H:i:s Y format). (Ilia)

So I guess you need at least PHP 4.3.3 for this to work correctly for you.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



RE: [PHP-DB] mysql - image storing

2005-01-18 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 18 January 2005 17:11, Joseph Crawford wrote:

 Jason, can you explain why stripslashes should not be used on data
 taken from the db? when you store data in the db i thought it was good
 practice to addslashes, when you retrieve from the db, you will need
 to use stripslashes to remove the extra \

It's simple.  Suppose you have a script that looks a bit like this (but
hopefully with more input validation and error checking!):


$value = addslashes($_POST['text']); // magic_quotes_gpc off

$sql = INSERT INTO tbl SET fld = '$value';

database_execute($sql);

Now suppose the user types this into the 'text' form field:

Here's an apostrophe

Here's what happens:

  PHP does this:

$value is set to: Here\'s an apostrophe

$sql becomes: INSERT INTO tbl SET fld = 'Here\'s an apostrophe'

Which is sent to the database via database_execute()

  The DATABASE now does this:

Receives the SQL statement: INSERT INTO tbl SET fld = 'Here\'s an
apostrophe'

(Note how the \ escape is required here to stop the field
value from terminating prematurely -- but this escape is
aimed at the *database*, and is not a PHP escape.  A lot of
confusion seems to arise here for databases which use the
same \ escape character as PHP.)

Extracts the value:   Here\'s an apostrophe
and de-escapes it to give:Here's an apostrophe

Which gets inserted into the database.

So the value inserted into the database is the unescaped original, and on
retrieval there are no \ characters in the retrieved value to be
stripslashes()ed.

Hope that's clearer than mud, and helps you understand what's going on
better.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] php latest release!

2005-01-10 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 10 January 2005 09:28, JeRRy wrote:

 With PHP latest release from http://php.net/ do we
 require to update Zend Optimizer?

Yes.
 
 People are claiming some scripts previously that
 worked in a previous version of PHP works and not with the new
 version. 

There are several bug reports on bugs.php.net about this. Also see the red
warning text on http://php.net/downloads.php

 Why is it required to update Zend?

Earlier versions are incompatible with PHP 4.3.10, and exhibit various
incorrect behaviours -- in particular, foreach produces the wrong results.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Trying to connext to MySQL with PEAR

2005-01-07 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 06 January 2005 21:10, Norland, Martin wrote:

  -Original Message-
  From: Ford, Mike [mailto:[EMAIL PROTECTED]
  Sent: Thursday, January 06, 2005 1:13 PM
  Subject: RE: [PHP-DB] Trying to connext to MySQL with PEAR [snip]
  Oh dear, as a fully-paid-up pedant, I'm afriad I can't resist this
  one: 
  
  Doesn't affect the answer, but this occurrence of 'effect' should
  be 'affect'. ;) 
  
  Cheers!
  
  Mike
 
 * Joining in on the fun *
 
 I'm afraid you spelled afraid incorrectly.  I'll be sending you the
 bill for my services related to this matter.

Please send it to Mr Murphy, who obviously insinuated one of his pet
gremlins into my keyboard for those few moments...! ;)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] PHP query to mysql database returns emtpy data, but Query Browser shows records

2005-01-07 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 07 January 2005 03:25, Jason Walker wrote:

 Graeme - you were moving in the right direction. Since the
 data in the field
 is varchar(250), the only thing that changes is the fact that the last
 number is 3 digits. Other page queries were also affected
 with 4 x 2 digit
 numbers in the category field (eg. '37 48 49 52').
 
 By adding '%' between each number and using 'LIKE' as opposed
 to '=', the
 queries through PHP return the correct value.
 
 I think is very strange as 3x numbers work fine when using
 spaces (' ')
 between each criteria (as in '37 48 53').
 
 The change would look something like:
 
 SELECT description from cpProducts where category like '39%47%48%172'

That's not a good idea, as it would also match entries like:

 391 247 48 172
 39 147 148 172
 395 347 1486 1172

etc.

I think you really need to find out exactly what's in those failing records,
and why it's not matching your query.

 

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



RE: [PHP-DB] Trying to connext to MySQL with PEAR

2005-01-06 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 06 January 2005 16:39, Jochem Maas wrote:

 Hutchins, Richard wrote:
  echo $dsn; $isPersistant = TRUE;
 
 doesn't effect the code but 'Persistant' is spelled 'Persistent'

Oh dear, as a fully-paid-up pedant, I'm afriad I can't resist this one:

Doesn't affect the answer, but this occurrence of 'effect' should be
'affect'. ;)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP-DB] Filling Drop-Down Box.

2004-12-25 Thread Mike S.
 Hello All,

 I want to fill drop-down box from mysql table, if any body
 be kind to tell me a sample code :)
 e.g:
 In my application i want to gather subject list from current
 semester-subject table of a student.

 TIA
 --
 Nayyar Ahmad

You know that the HTML code for the drop-down is:
SELECT NAME=SAMPLE
OPTION VALUE=1Whatever 1/OPTION
OPTION VALUE=2Whatever 2/OPTION
/SELECT

Here's some pseudo-code remarks that should help you with your coding:

- whatever.html -
Drop-down: SELECT NAME=sample
?php
   //  connect to your database - if you haven't already
   //  construct a query to pull the records you want, and
   //  in the order you want to display them
   //  execute the query
   //  loop through the results, building an OPTIONwhatever/OPTION
   //  for each element in the drop-down.  You can get creative
   //  here if you need to.  Like:
   //  OPTION VALUE=##whatever/OPTION
   //  where ## is the key field, and whatever is another
   //(descriptive) field in your query
   //  close your database connection (or later, if needed)
?/SELECT

Try to fill in the actual code yourself.
If you get stuck, you can look at:
http://www.netmask.com/php-db/sample-dropdown.html

Good luck!

:Mike S.
:Austin TX USA

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



Re: [PHP-DB] data is not entering in created database

2004-12-24 Thread Mike S.
 hallo ,

 i have wriiten simple php script , below.
 created databse dollar1_allinfo with table 'totalinfo'

 but on clicking submit button ,

 information entered is not entering in database.

 also,  echo statements are also not displaying after submit

 ?php
 if ($submit)
 {
 $db = mysql_connect(localhost,root);
 mysql_select_db(dollar1_allinfo,$db);
 mysql_query(INSERT INTO totalinfo (username,password,) VALUES
 ('$loginusername','$loginpassword'));
  echo 'thank you';
  echo 'So Hurry Up';
   }
?

 thank you.

Because your query and echoes are within an if block, I'd say that
$submit is evaluating to FALSE, and thus not executing the query and
echoes.

Add (before the if statement):

   echo Submit = $submit;

Make sure that $submit is evaluating to TRUE.


To All Beginning Programmers (Newbies), or just people who want to
easily debug their code:
Try adding debugging statements to help you find problems.  A few echoes
or prints in selected locations will help identify the issue.  Make sure
your variables are evaluating to values that you think they should be.

If you want to keep the debugging statements in your code and just
activate them when you need to see them, do something like:
// near the top of your code
$debug=TRUE;
// and anywehere in your code
if ($debug) {
   echo DEBUG: Submit = $submitBR\n;
}
// or whatever echo might help you nail down the problem.  Put as many of
these in your code and you can turm them ON and OFF very easily, by
changing one line of code.

OR for even quicker debugging, replace $debug=TRUE; with
   $debug=$_GET['debug'];
and then you can turn it on in by adding ?debug=TRUE at the end of the
URL. Example:  http://www.php.net/path/my.html?debug=TRUE
or:  http://www.php.net/path/my.html?debug=1
**DISCLAIMER**  Using the URL method is NOT a secure way to do this!!! 
And I'm sure there's plenty of folks groaning out there because it is a
BIG security hole.  You really would want to do this on a development
machine and network, and remove the debug code for production.  That
really should go without saying.

Good luck.

:Mike S.
:Austin TX USA

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



RE: [PHP-DB] _POST, _GET, _REQUEST not working

2004-12-23 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 23 December 2004 01:12, Keane, Warren A FIN:EX wrote:

 I did try
 
 if (empty($_GET)) { parse_str($_SERVER['QUERY_STRING'],$_GET); }
 
 which worked so I guess I should be able to come up with an
 equivalent for _POST using argv, argc.
 
  I am guessing but I also think the problem is to do with the fact
  that the CGI sapi is being used.
 
 I am using the CLI SAPI, I checked using php_sapi_name(). Is this
 causing the problem?

Absolutely -- this is the Command-Line Interface.  As this is intended for
command-line scripting, it has no notion of being used in a Web context and
does not even attempt to fill the $_POST or $_GET (or most of the other $_)
arrays.  You need to use either the CGI SAPI, or the Apache module.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] still Parse errors ,,, can you. impart me about it.

2004-12-23 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 23 December 2004 18:04, amol patil wrote:

 hallo Mike,
 
 thanks for reply, but i want a bit more help, again

Please keep this on-list -- someone else may have time to reply before I can
(especially as I am about to go home for my tea and a well-earned sleep!).

 
 i know these parse errors are generally typing mistakes ,
 
 but i have checked for it , but still i am getting errors.
 
 i have attached files  with  their codes , can you go through
 it to find what is going wrong
 
 
 Parse error: parse error, unexpected '' in
 /home/dollar1/public_html/signup.php on line 263
 
 
 parse error, unexpected '' in
 /home/dollar1/public_html/login.php on line 94
 
 
 Parse error: parse error, unexpected T_STRING in
 /home/dollar1/public_html/addfunds.php on line 91 then on 102
 
 
 
 thank you.
 
 
 Ford, Mike [EMAIL PROTECTED] wrote:
 To view the terms under which this email is distributed,
 please go to http://disclaimer.leedsmet.ac.uk/email.htm
 
 
 
 On 21 December 2004 07:58, amol patil wrote:
 
  hallo friend,
  
  i have developed simple and small database website using php ,html
  and java script. 
  
  but i am getting these three parse errors on clicking ,
  
  i have checked 3-4 imes on these line numbers, but there wasn't any
  $ variable. php script is also correctly written.
  what is this T_STRING error.
  
  can you help me regarding this.
  
  thank you.
  
  errors:
  
  Parse error: parse error, unexpected $ in
  /home/dollar1/public_html/signup.php3 on line 379
 
 $ in PHP's error messages represents the end of the file, so PHP has
 reached the end of signup.php3 when it's still expecting more
 program. This means you have an error somewhere in the preceding 378
 lines -- most likely a missing }. (If PHP was complaining about a
 variable reference, the message would refer to unexpected
 T_VARIABLE.) 
 
 
 Cheers!
 
 Mike
 
 -
 Mike Ford, Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Headingley Campus, LEEDS, LS6 3QS, United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
 
 
 
 Do you Yahoo!?
 Jazz up your holiday email with celebrity designs. Learn more.


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

RE: [PHP-DB] Parse errors ,,, can you. impart me about it.

2004-12-22 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 21 December 2004 07:58, amol patil wrote:

 hallo friend,
 
 i have developed simple and small database website using php ,html
 and java script. 
 
 but i am getting these three parse errors on clicking ,
 
 i have checked 3-4 imes on these line numbers, but there wasn't any $
 variable. php script is also correctly written.
 what is this T_STRING error.
 
 can you help me regarding this.
 
 thank you.
 
 errors:
 
 Parse error: parse error, unexpected $ in
 /home/dollar1/public_html/signup.php3 on line 379

$ in PHP's error messages represents the end of the file, so PHP has reached
the end of signup.php3 when it's still expecting more program.  This means
you have an error somewhere in the preceding 378 lines -- most likely a
missing }.  (If PHP was complaining about a variable reference, the message
would refer to unexpected T_VARIABLE.)


Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] _POST, _GET, _REQUEST not working

2004-12-22 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 20 December 2004 21:50, Warren wrote:

 Hello,
 
 I am running PHP 4.39 as a CGI under Tomcat 5.025,  Linux 2.4.20-31.9.
 Configure = './configure' '--with-java=/usr/java/j2sdk1.4.2_04'
 '--with-servlet=/home/www/jakarta-tomcat-5.0.25' '--with-mysql'
 
 I cannot get the _GET function or _REQUEST functions to pick
 up values from
 a form generating even though I can see the query string
 values in the URL
 as in:
 http://localhost:8080/ip7/httptest.php?var1=212122var2=343434
 
 My HTML is very simple:
 
 form action=http://localhost:8080/ip7/httptest.php; method=get
 input type=text name=var1
 input type=text name=var2
 input type=submit
 /form
 
 The PHP program httptest.php is also very simple:
 
 ?PHP
 global $_SERVER, $_GET, $_POST, $_REQUEST, $_SESSION, $_COOKIE;
 
 if(!empty($_REQUEST['var1'])) { $var1 = $_REQUEST['var1']; }
 else { $var1 ='undefined'; }
 
 if(!empty($_GET['var2'])) { $var2 = $_GET['var2']; }
 else  $var2 ='undefined';
 
 // Various HMTL tags removed for simplicity
 echo   $var1
 echo   $var1

Is this a direct paste from your original?  If so, there's an obvious error
here -- one of those should be $var2,'cos as it is you're never even echoing
the value of the $_GET parameter.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] date conversions

2004-12-16 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 16 December 2004 06:00, neil wrote:

 Hi
 
 I am needing to convert a d/m/y date such as 30/11/2004 into the
 format that mysql can use ie. 2004-11-20
 
 If I try the following:
 
 $testdate=30/11/2004;
 echo date(Y-m-d, strtotime($testdate));
 
 the result is - 2006-06-11

strtotime() is, unfortunately, a little American biased and only recognises
the mm/dd/ numeric format (using slashes).  So the above is returning
the equivalent of the 11th day of the 30th month of 2004!

You can use other PHP functions, as has been suggested, but you might also
investigate the mySQL date formatting functions, as I believe they work
perfectly well on input dates as well as output ones.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] PHP 4.3.10RC2 - Any change in the way rows are fetch ed ?

2004-12-16 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 16 December 2004 12:51, Vincent KONIECZEK wrote:

 Hi there,
 
 
 I was testing PHP 4.3.10RC2 with a well-tested web application when I
 saw it failed badly. 
 
 After a little debug, I have found that the problem comes
 from this SQL
 query:
 SELECT CONCAT(num) AS k FROM user WHERE uid LIKE '%%'
 where user is a table with num as the PK and uid as a VARCHAR(128).
 
 I expect a result like this one (var_export-like display) of
 the fetched
 row (with mysql_fetch_array()):
 ([0] = 67,[k] = 67)
 But mysql_fetch_array() gives me:
 ([0] = ([0] = 67,[k] = 67))
 
 For me, it is a really big problem.
 I do not have it with PHP 4.3.8.
 I did not take the time to test with PHP 4.3.9 nor 4.3.10 but
 I took a
 look at the documentation web sites, the latest Changelogs and made a
 search on the mailing lists but found nothing about it.

Similar problems have been reported to the bugs database, and have been
traced to an old version of the Zend Optimiser -- if you are using this, try
disabling it, and if your application then works ok upgrade to the latest
version.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] mysql_array_array

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 13:15, Yemi Obembe wrote:


 $sql = SELECT * FROM arcadia WHERE email=$v;

$sql_in = INSERT INTO arcadia ('email') VALUES ('$v');

Spot the difference: you have quoted the email value $v in the INSERT
(correct) but not in the SELECT (wrong).  This means that:

   $res = mysql_query( $sql ) ; 

is failing with a SQL error, so $res is not being set to a valid MySQL
result resource, so that when you execute:

   if (list($row) = mysql_fetch_array($res)) {

The mysql_fetch_array() complains with the error you have seen.

After any database operation, you should check for failure and echo out any
error message -- see mysql_errno()  (http://php.net/mysql_errno) and
mysql_error() (http://php.net/mysql_error).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 14:39, Stuart Felenstein wrote:

 I want to send back a message when no matches are
 found on my search page.  Basically No matches
 found.  I assumed that mysql_fetch_assoc would be the
 determining factor on whether any rows will come back.
  As you can see below I do a if ($row_rsCS == false).
 Apparently though (while the message is sharp and
 centered ;)), it is not to right place, since it sends
 the message and exits whether records / matches exist or not.   Any
 suggestions ? 
 
 Thank you
 Stuart
 
 $query_limit_rsCS = sprintf(%s LIMIT %d, %d,
 $query_rsCS, $startRow_rsCS, $maxRows_rsCS);
 //print_r($query_limit_rsCS);
 $rsCS = mysql_query($query_limit_rsCS, $Pmmodel) or
 die(mysql_error()); //print_r($rsCS);
 $row_rsCS = mysql_fetch_assoc($rsCS);
 
 if ($row_rsCS == false)
 ?

The closing ? of a PHP segment also implies an end-of-statement semicolon
-- so the above is equivalent to:

   if ($row_rsCS == false) ;
   ?

Which, of course, means that the scope of the if doesn't extend to anything
beyond this point.

You need to mark the block controlled by the if, using either {-} or
:-endif, according to your taste.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 15:06, Stuart Felenstein wrote:

  The closing ? of a PHP segment also implies an
  end-of-statement semicolon
  -- so the above is equivalent to:
  
 if ($row_rsCS == false) ;
  ? 
  
  Which, of course, means that the scope of the if
  doesn't extend to anything
  beyond this point.
  
  You need to mark the block controlled by the if,
  using either {-} or
  :-endif, according to your taste.
  
 The reason the close is there is because the next line
 of code is the print_r , and I put some html in there.

Nothing wrong with having the closing ? there -- please re-read my
response.  If it's still unclear to you, please ask specific questions.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 15:16, Stuart Felenstein wrote:

 --- Stuart Felenstein [EMAIL PROTECTED] wrote:
 
  The reason the close is there is because the next
  line
  of code is the print_r , and I put some html in
  there.
  
 So this works great:
 
 if ($row_rsCS == false) {
 print_r (No Matches Found);
 exit;
 }
 
 But because I want to have some html formatting around
 the print_r, I closed the tags.

Yes, but you didn't include the { } to indicate the scope of the if -- so it
terminated at the ?.

  I'm not sure how to use the endif.

Well, your taste seems to be to use { }, so :-endif is irrelevant.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 15:26, Stuart Felenstein wrote:

 --- Ford, Mike [EMAIL PROTECTED] wrote:
 
  Well, your taste seems to be to use { }, so :-endif is irrelevant.
  
 Alright it's Friday, I'm punchy but we're all in a
 good mood !
 
 Yes, I like the closing curlies
 
 So, then where do these lovely ladies go here ?
 
 if ($row_rsCS == false) {

?

 p align=centerstrong?php print_r (No Matches Found);?
 /strong/p

?php

 exit;
 }

Just put the PHP tags in as indicated and you'll be good to go.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 15:26, Stuart Felenstein wrote:

 --- Ford, Mike [EMAIL PROTECTED] wrote:
 
  Well, your taste seems to be to use { }, so :-endif is irrelevant.
  
 Alright it's Friday, I'm punchy but we're all in a
 good mood !
 
 Yes, I like the closing curlies
 
 So, then where do these lovely ladies go here ?
 
 if ($row_rsCS == false) {
 p align=centerstrong?php print_r (No Matches Found);?
 /strong/p exit;
 }

And, by the way, why on earth are you using a print_r an a straight literal
string?  Seems to me you could just put that text in as part of the HTML:

   if ($row_rsCS == false) {
   ?
 p align=centerstrongNo Matches Found/strong/p
   ?php
 exit;
   }

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Multi-User Update Problem

2004-12-01 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 30 November 2004 14:45, SCALES, Andrew wrote:

 Thanks very much for your help. The main difficulty I was
 having really was
 unlocking the record again if the user crashed out or just
 closed down their
 browser/computer (something they have a bad habit of doing)
 but storing the
 time the record was locked and ignoring the lock if it's over
 that time
 sounds interesting.
 I may try storing the data in a session variable and then
 comparing that to
 the database before the updated data is inserted into the
 record as Bastien
 suggested. We wanted to keep hits on the db to a minimum, but
 seen as some
 extra traffic will be necessary anyway I may just try that.

Another approach to this might be:

Keep a column in your database table for time of last update of each record.

When a user reads a record for update, don't lock it at this point, but save
the time at which it was read into the user's session (or somewhere in the
database).

On receiving a potential update, check the time the record was read (as
recorded above) and the last update time of the record (lock the record as
part of this query) -- if the update time is later then the read time,
someone else has updated in the interim and you should abandon ship;
otherwise, update the record including a new last-updated value; in either
case, unlock the record.

This methodology keeps both the lock and unlock in the same script (and
potentially within a single database transaction), so no need for any
external checks for locked records, and minimizes the amount of time for
which any one record is locked.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Error Help

2004-11-30 Thread Mike Johnson
From: Chris Payne [mailto:[EMAIL PROTECTED] 

 I do have a final question, had a look online but couldn't find 
 what I needed.  It's hard to explain why, but basically 
 individuals have my program on their HD, the DB is on their HD 
 etc  And it connects on startup to a remote server to check 
 the latest version number so they can then download if a new 
 one is available (Which I package using MS.net's installer 
 system for distribution),  Anyway, what I want to know is, how 
 can I get a NICE error message IF they aren't connected to the 
 net when they launch the software on their machine?  Currently 
 I get a nasty message, but I'd like to replace it with 
 something like Please make sure you are connected to the 
 Internet or something like that?  I know the OR DIE command, 
 but that doesn't work with connection failures.

I think what you're looking to do is suppress the PHP/DB error and
supply your own. What you want to do is preprend the db connection
function with `@' and add your own upon failure -- something like this:

?

$dbh = @mysql_connect($dbhost, $dbuser, $dbpass);
if (!$dbh) {
echo Please make sure you are connected to the Internet;
exit;
}

?

The only problem with this is that it'll fail with the same error
message if their internet connection is fine but $dbhost is unavailable.
I'm not entirely certain if PHP can gracefully detect a local internet
connection, actually. For your purposes, though, this should do the job.

HTH!


-- 
Mike Johnson Smarter Living, Inc.
Web Developerwww.smarterliving.com
[EMAIL PROTECTED]   (617) 886-5539

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



RE: [PHP-DB] Transaction suddenly not working

2004-11-29 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 29 November 2004 13:19, Stuart Felenstein wrote:

 Now the printout of the query is this:
 
 0: INSERT INTO Table1 (LurkID, ProfileName, Edu,
 WorkAuth, WorkExp, CarLev, Secu, Confi, Relo,
 Telecomu, City1, State1, City2, State2, TravelPref,
 SalaryAnnual, SalaryHourly, Available) VALUES (47,
 '', 7, 2, 1015, 5, , '', '', '', 'fds', 5, '',

You have 2 successive commas in this last line, with no value in between --
this is your syntax error.

 , 4, 26, , 2004-02-02)01062 : Duplicate entry '0-f' for key 1

And again on this line -- twice, in fact, since the previous line ends with
a comma, too.

Track down whatever is outputting these null values, fix it, and you should
be good to go (well, at least less bad!).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] PHP / Javascript question

2004-11-16 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 16 November 2004 03:03, Chris Payne wrote:

This is OT, really, but because it's an easy answer:

 if ( document.removeitems.del.value ==  )

 BUT because the tickboxes information is stored in a PHP
 Array called del[]
 I am having major problems getting it to work.

You shouldn't be, since any good JavaScript text will tell you that, by
definition, x.y is identical to x['y']; so:

document.removeitems['del[]']

will get you started.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Re: Subject: Javascript Question (Was PHP / Javascri pt question)

2004-11-16 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 16 November 2004 15:12, Neil Smith wrote:

 That
 
 if (df[i].checked=true) {
 
 should of course read
 
 if (df[i].checked==true) {

No it shouldn't -- it should read 

  if (df[i].checked) {

More efficient, more readable, and, more important, The Right Way (TM)! ;)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Persistent Connections to Oracle databases

2004-11-15 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 11 November 2004 19:11, Patrick David wrote:

 My understanding of persistent connections was that using the
 ociplogon function a connection would be opened to the
 database and all other connections to the same database (with
 the same username and password) would use the first one
 previously opened, which mean I would have only 1 connection
 to the database.

I know this is a late response, but I haven't seen anybody point this out
yet: that's 1 connection *per Apache child process*, since each process
still has to have its own connection.

  But in fact it is not what is happening,
 every time I submit the page to the same database a new
 connection is opened. Which is a little bit annoying if I
 submit this one 100 times (100 connections at the end).

Potentially, if you have Apache configured to run 100 children or more.  If
you configure it to run only 50 children, that's the maximum number of
Oracle connections you will get.


Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP-DB] IIS and php sessions

2004-11-15 Thread Mike Smith
I'm pretty sure this is enabled by default in PHP for Windows, I think
you'll need to check the IUSR_[machine_name] persmissions on the
sessions folder. I'm headed in the other direction. I'm re-writing an
app with a database abstraction layer with hopes of moving to
postgres.

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



RE: [PHP-DB] Forms list from database

2004-11-02 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 01 November 2004 21:11, Jason T. Davidson wrote:

 Here is the code:
 
 form name=form1 method=post action=staff_code/add_code.php
 table width=600 border=0 align=center cellpadding=0
cellspacing=0 tr bgcolor=#CC
  td colspan=3 bgcolor=#FFdiv align=center
select name=controller id=controller
  option /option
   option
 ?
   while ($check=mysql_fetch_array($result)){
 print $check[LNAME],$check[FNAME]($check[CID]);
 }
  
   /option
/select
  /div/td
  /tr

I think you're missing some option/option tags -- these should be
present around each value extracted from the database, so:

while ($check=mysql_fetch_array($result)){
print
option{$check['LNAME']},{$check['FNAME']}({$check['CID']})/option\n;
}
 

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Problems with mysql_num-rows()

2004-11-01 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 01 November 2004 05:01, Doug Thompson wrote:

 The variables are not being expanded. As a minimum, you need to
   escape the single quotes. $query = SELECT * from user where
  name=\'$userid\' and pass=password(\'$password\')

This is complete BS.  The whole string is in double quotes -- the
presence of single quotes within it has no effect whatsoever on the
expansion of variables, nor is it necessary to escape them.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] can i display an image _directly_ from postgres db storage?

2004-11-01 Thread Mike
Philip,

Typically, it's infinitely more performance-friendly to simply store your
files on the hard disk and use the database to refer to that location.

For instance, assume your root web dir is /www. Inside there you have an
/images directory. 

If you religiously put all files inside of /images you can store the file
name inside the DB and simply have your code output the proper HTML. Or, if
you have to actually do image processing, you can have your code query the
DB and then read the file into an image handler for GD or whatever you're
using to do the processing.

Either way, it's usually encouraged not to store BLOBs whenever possible due
to the performance hit that's usually associated with that.

-M



-Original Message-
From: P. George [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 01, 2004 10:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] can i display an image _directly_ from postgres db
storage?

i know that postgres has a raw binary datatype called bytea for storing 
pictures and whatnot, but i'm having trouble finding an example of 
displaying an image on a web page with php that is pulled directly from 
the database?

is this possible?

if so, how?

thanks.

- philip

-- 
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 code on sqlite

2004-10-20 Thread Mike Smith
Add

?
}
}
?

after your closing /html


On Wed, 20 Oct 2004 11:50:29 -0700 (PDT), Aravalli Sai
[EMAIL PROTECTED] wrote:
 hi
   this is php code for inventory management system
 which is done using SQLite.this is an user
 interface where an user wil giv values to the text
 boxes and it should be saved in the backend database
 which is sqlite..
 but when i run this code on browser it is giving an
 error ... Parse error: parse error in
 /home/saravall/.HTML/inv.php on line 81
 
 HTML
 HEAD
 /HEAD
 body
 ?php
 
 $db =/home/saravall/office.db;
 $handle = sqlite_open($db) or die(could not open
 database);
 
 if(isset($_POST['submit'])) {
 
 if (!empty($_post['tagno'])  !empty
 ($_post['desc']) 
 !empty ($_post['acqdt'])  !empty
 ($_post['manufacturer'])  !empty
  ($_post['model']) !empty($_post['serialid']) 
 !empty( $_post
 ['custloc'])  !empty($_post['totcost']))
  {
 $insquery = insert into inventory
 (tagno,desc,acqdt,manufacturer,model, serial
 id,custloc,totcost) values (\.sqlite_escape_string(
 $_post['tagno']).\,\.sqlite_escape_string($_post['desc']).\,\
 .sqlite_escape_string($_post['serialid']).\,\.sqlite_escape_string($_post
 ['custloc']).\,\.sqlite_escape_string($_post['totcost']).\);
 
 $insresult = sqlite_query($handle,$insquery) or
 die(error:.sqlite_error_string(sqlite_last_error($handle)));
 echo isuccessfully inserted!/ip /;
 }
 else {
 echo iincomplete from input!/ip /;
   $query = SELECT * FROM inventory ;
 $result = sqlite_query($handle,$query) or
 
 die(err:.sqlite_error_string(sqlite_last_error($handle)));
 if (sqlite_num_rows($result)  0)
 {
 echo table cellpadding=20 border=1;
 while ($row = sqlite_fetch_array($result))
 {
 echo tr;
 echo td.$row[0]./td;
 echo td.$row[1]./td;
 echo td.$row[2]./td;
 echo td.$row[3]./td;
 echo td.$row[4]./td;
 echo td.$row[5]./td;
 echo td.$row[6]./td;
 echo td.$row[7]./td;
 echo td.$row[8]./td;
 echo td.$row[9]./td;
 echo /tr;
 }
 echo /table;
 
 }
 sqlite_close($handle);
 ?
 p
 h2
 enter  new record:/h2
 form method=post action=?php  echo
 $_server['php_self'];?
 Tag number:input type=text name=number
 br/
 desc:input type=text name=desc
 br/
 acq date:input type=text name=date
 br/
 manufacturer:input type=text name=manufacturer
 br/
 model:input type=text name=model
 br/
 serial id:input type=text name=serial id
 br/
 custodian location:input type=text
 name=custodian
 br/
 sum cost:input type=text name=cost
 br/
 input type=submit name=submit value =save
 /p
 /form
 /body
 /HTML
 
 i would appreciate if you can help me in correcting
 this error..
 thanks in advance..
 sai
 
 ___
 Do you Yahoo!?
 Declare Yourself - Register online to vote today!
 http://vote.yahoo.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-DB] Re: Safe / Secure Login Script

2004-10-05 Thread Mike Morris
These are not PHP specific suggestions, but I see two big problems:

 5.) Password is then encrypted using base64_encode() 6.) 

You've confused encryption and encoding. Base64 encoding is trivial to decode, and 
fairly 
obvious to spot as well. All this achieves is that someone can't accidentally - before 
they 
avert their eyes - read the password while doing a view source. But anyone who wants 
it 
can get it if they're given the base64 encoded representation. I wouldn't use this 
method - or 
a website that did.

 8.) If No username is found, Message is sent to end user stating
 username does not exist. 

Don't tell them whether it was the username or the password that was wrong. Doing so 
lets 
a hacker decompose a complex problem into two simpler problems. With your method, I 
would first keep trying until you confirm that I've guessed a valid username, then I 
can go 
about guessing the password. If I don't know which is wrong, the number of 
possibilities is 
increased geometrically.  

Mike Morris
The Music Place
1617 Willowhurst Avenue
San Jose, CA 95125
(408) 445-ARTS (2787)

Your Free Historical Quote:
Finally, it is my most fervent prayer to that Almighty Being before whom I now 
stand, and who has kept us in His hands from the infancy of our Republic to 
the 
present day, that He will so overrule all my intentions and actions and 
inspire the
hearts of my fellow-citizens that we may be preserved from dangers of all 
kinds 
and continue forever a united and happy people.
- Andrew Jackson, Second Inaugural Address, March 4, 1833


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



[PHP-DB] SSL connection between PHP4 PostgreSQL ???

2004-10-05 Thread Mike Morris
Hi,

I've setup a postgres server (7.4) and confirmed that SSL is enabled - I can 
successfully 
connect via tcp socket over SSL using the psql client.

From PHP4, how can I get the pg_connect function to negotiate an SSL connection?

I gather from researching the issue that pg_connect uses the same libraries as psql, 
so that 
this should be possible. But I've tried every syntax I can think of... the options 
parameter to 
pg_connect is not well documented.

I've played with all varieties of requiressl or ssl, alone or as a boolean, e.g., 
requiressl=true, etc...

If not possible in PHP4, is it in PHP5?

Any help greatly appreciated!

MikeM
Mike Morris
The Music Place
1617 Willowhurst Avenue
San Jose, CA 95125
(408) 445-ARTS (2787)

Your Free Historical Quote:
Above all, I know there is a Supreme Being who rules the affairs of men and 
whose goodness and mercy have always followed the American people, and I know 
He will not turn from us now if we humbly and reverently seek His powerful aid.
- Grover Cleveland, Second Inaugural Address, March 4, 1893


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



RE: [PHP-DB] What is PHPBB?

2004-10-02 Thread Mike
Google is your friend:
http://www.google.com/search?hl=enie=UTF-8q=PHPBBbtnG=Google+Search

-Original Message-
From: Lic. Daniel Alfredo Betancourt Reboso
[mailto:[EMAIL PROTECTED] 
Sent: Saturday, October 02, 2004 9:22 AM
To: '[PHP-DB] Mailing List'
Subject: [PHP-DB] What is PHPBB?

Hi folks!!!:

Somebody wrote:

for example, the phpBB web app, multiple people log into the bulletin 
board.  but the account that is used to connect to the MYSQL (in this 
case) backend is a single account that is created when you first install 
phpBB.  phpBB then uses this account to do all the work needed and logs 
that into a table so you know who posted (or edit or deleted) what post 
on the forum.

All I wanna know is what is PHPBB?. Is it some PHP thing that deals with
Database directly or is it another PHP relese?

Thank´s

Regards...
Daniel..

Please excuse my englsih grammar.




INFOSOL Webmail
http://webmail.gtm.sld.cu/imp/

-- 
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] Convert plain text to HTML tagged text

2004-09-28 Thread Ford, Mike
On 28 September 2004 18:15, [EMAIL PROTECTED] wrote:

 To the list:
 
 I've googled and searched the manual, but I'm still looking
 for a simple solution to a simple problem.
 
 I have a MySQL database of text stories in longtext MySQL
 fields. These stories have simple returns (\r) in them and no
 other formatting. I need to use these stories both for web
 and print production, so I need to be able to get the text
 out of MySQL via PHP and have those returns change to P
 tags. But I also need to keep those extra P tags out of the
 database file so the text can be exported and poured into a
 layout program.
 
 HTMLspecialchars and HTMLentities don't seem like the right
 solution, but maybe I'm missing something. Do I have to use
 regular expressions in PHP as the text is pulled from the database?

http://www.php.net/str_replace should be all you need -- no need for regexps for such 
a simple replace.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] MultSelect ListBox hell!

2004-09-24 Thread Ford, Mike
On 23 September 2004 20:53, Stuart Felenstein wrote:

 So here is what I have:
 
 //Here is defines the field variable and uses
 //CodeCharge function to grab the variable
 $s_Industry = CCGetParam(s_Industry, );
 $s_LocationState = CCGetParam(s_LocationState, );
 $s_TaxTerm = CCGetParam(s_TaxTerm, );
 
 //Here is the parsing of the array.  I'm not sure
 what the $proj variable is for.  I gather it's a
 holder for the array values
 
 if (count($s_Industry)  0 AND is_array($s_Industry)) {
 foreach ($s_Industry as $key = $value) {
 if ($Proj1 != ) $Proj1 = $Proj1.,;
 $Proj1 = $Proj1.'.$value.';
 }
 }

$Proj1 now contains a comma-separated list of the values passed to
$s_Industry, which was filled by the CCGetParam() above.  The above code
block is equivalent to (and would be better coded as):

  if (count($s_Industry)  0 AND is_array($s_Industry)) {
 $Proj1 = '.implode(',', $s_Industry).';
  }

which may look somewhat familiar to you!

 //Parsing next array
 if (count($s_LocationState)  0 AND
 is_array($s_LocationState))
 {
 foreach ($s_LocationState as $key = $value) {
 if ($Proj2 != ) $Proj2 = $Proj2.,;
 $Proj2 = $Proj2.'.$value.';
 }
 }
 //Parsing file array
 if (count($s_TaxTerm)  0 AND is_array($s_TaxTerm)) {
 foreach ($s_TaxTerm as $key = $value) {
 if ($Proj3 != ) $Proj3 = $Proj3.,;
 $Proj3 = $Proj3.'.$value.';
 }
 }

These two blocks are similar for the other two parameters, $s_LocationState
and $s_TaxTerm

 Here is what will be the death of me :)
 First the where condition below is being appended to
 anoher file in my main sql statement (don't ask:))
 CC keeps their code in various sections and files.
 Anyway , if you remember yesterday, it was determined
 that I needed the where condition to be dynamically
 created based on the user input.
 Obviously the code below does nothing of that sort.

Obviously it does, using the lists of values built above.

 So as a start, I'm trying to figure out what I can do
 with this section here (since this is really what
 needs to be changed, I think) to make it all right.
 
 if ($Proj1)
 $VendorJobs-ds-SQL.=  AND (`VendorJobs`.Industry IN (.$Proj1.));

Plug the value for $Proj1 built above into this, and again you have
something that may look very familiar to you.  It's the very same IN clause
I was urging you to use yesterday! ;)

 if ($Proj2)
 $VendorJobs-ds-SQL.=  AND
 (`VendorJobs`.LocationState IN (.$Proj2.));
 if ($Proj3)
 $VendorJobs-ds-SQL.=  AND (VendorJobs.TaxTerm IN (.$Proj3.));
 echo SQL:. $VendorJobs-ds-SQL.br;

So you now have a dynamically built portion of SQL, in $VendorJobs-ds-SQL,
that has a clause like AND x IN ('a','b','c') for each input field that
has any values set.  According to your specs, this could be anywhere up to
six separate clauses.  This seems to be exactly what you wanted, so your
code looks good to go.

To help you understand exactly what's going on here, or in any script or
program you're struggling to interpret, I would recommend two time-honoured
techniques:

(i) Dry running: get out your genuine old-fashioned pen and paper, pretend
you're the PHP interpreter processing this program, and write down the value
of each variable as you work through the code.  Yes, it can be quite
long-winded and tedious, but you really get a tremendous feel for exactly
what's going on.  The number of times I've done this and cursed myself as
I've watched a value going out of range, or not getting set at all, I
couldn't begin to count.

(ii) As a variation of the above, put *lots* of debugging echos in your
script: echo the value of every variable frequently and redundantly -- it
can help sometimes just to have the reassurance that a value really hasn't
changed, even though you know it absolutely shouldn't!!  Again, if you're
struggling with how a script operates this can help you see how values are
built up, and can often show you exactly where a wrong value gets calculated
(and how, and maybe even why).  It's especially important to echo your final
complete SQL statement just before it's executed, so that if it produces an
error message you've got the actual relevant SQL right in front of you.

Hope this helps.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] MultSelect ListBox hell!

2004-09-23 Thread Ford, Mike
On 22 September 2004 18:45, Stuart Felenstein wrote:

 Just to confirm,
 This is what I'm going to start with:

Yeah, I'd say you've pretty much got it, except...
 
 //base sql statement
 $sql = select * from jobs where record_deleted = 'NO' ;
 
 if (isset($_POST['states'])){

Your SQL is going to need some sort of conjunction here, as your WHERE phrase already 
has an initial condition in it.  I'm guessing you'll want an AND, so:

$sql .= 'AND ';

 //check to see if the states is an array
 // multiple items or just one
 if (is_array($_POST['state']))

You've switched from $_POST['states'] to $_POST['state'] -- fix whichever is wrong ;)

 $sql .= state='.implode(' OR state=',
 $_POST['state']).';

Given the conditions you want your WHERE phrase to test, you're going to need more 
parentheses to force the ORs to be evaluated before the ANDs; this is where the IN 
syntax, IMO, is more readable.  So you want either:

$sql .= (state='.implode(' OR state=',$_POST['state']).');

or:

$sql .= state IN ('.implode(',',$_POST['state']).');

 
  }else{
 //$_POST['state'] is not an array
  $sql .= state = '.$_POST['state'].' ;
 }//end if
 
  if (isset($_POST['job'])){
if (isset($_POST['state'])){  $sql .=  AND ; }

And throughout this second block you've used a cut'n'paste of the first block without 
altering ['state'] to ['job'] -- just the sort of oversight that can give you the 
raving heebie-jeebies somewhere down the line if you fail to fix it! ;)

 
 //add in the AND if the state is set
 //check to see if the states is an array
 //multiple items or just one
 
 if (is_array($_POST['state']))
$sql .= state='.implode(' OR state=',
 $_POST['state']).';
 $sql .= );
   }else{
 $_POST['job'] is not an array
  $sql .= job = '.$_POST['job'].' ;
  }
 //end if

Given the moderate complexity of this code, I'd strongly recommend echo-ing out $sql 
immediately before it's used whilst you're in testing mode.  When your query fails, 
you'll already be one step ahead in working out what the problem is.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Using PHP to generate SQL statement

2004-09-23 Thread Ford, Mike
On 23 September 2004 07:47, Ed Lazor wrote:

 I keep looking at the following code and thinking there's
 gotta be a better
 way.  I've been in front of the computer all day tho and I'm drawing
 a blank.  Any ideas?

Seems to me we've just answered a very similar question to this (and I'd be
surprised it there weren't several relevant threads in the list archives).
Nonetheless:

 $sql = select ID from products where ;
 
 if ($webpage-parameter_isset(CategoryID)) {

Two possible approaches that spring to mind are:


  $sql = select ID from products where 1=1;
 
  if ($webpage-parameter_isset(CategoryID)) {
 $sql .=  AND CategoryID = '{$webpage-CategoryID}';
  }

  if ($webpage-parameter_isset(CompanyID)) {
 $sql .=  AND CompanyID = '{$webpage-CompanyID}';
  }

  if ($webpage-parameter_isset(SettingID)) {
 $sql .=  AND SettingID = '{$webpage-SettingID}';
  }

  if ($webpage-parameter_isset(SystemID)) {
 $sql .= AND SystemID = '{$webpage-SystemID}';
  }

Or:

  $where = ''
  foreach (array('CategoryID', 'CompanyID', 'SettingID', 'SystemID')
   as $field):
 if ($webpage-parameter_isset($field)):
$where .= ($where?' AND':''). $field = '{$webpage-$field}';
 endif;
  endforeach;

  if ($where):
 $sql = select ID from products where$where;
 ...
  else:
 // no where information -- major error
  endif;

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Ford, Mike
 -Original Message-
 From: Bastien Koert [mailto:[EMAIL PROTECTED] 
 Sent: 22 September 2004 15:27

[]

 //base sql statement
 $sql = select * from jobs where record_deleted = 'NO' ;
 
 if (isset($_POST['states'])){
//check to see if the states is an array (multiple items 
 or just one

This check isn't really necessary in PHP, since $_POST['state'] will *always* be an 
array if the form field has NAME='state[]', even if only 1 is selected.

if (is_array($_POST['state'])){
  $sql .= (;
  $x = 0;
  foreach ($_POST['state'] as $state)
if ($x == 0){
$sql.= state = '$state' ;
$x=1;
  }else{
 $sql .=  OR state = '$state' ;
 }
 $sql .= );

PHP has the very nice implode function to make this much easier:

$sql = state='.implode(' OR state=', $_POST['state']).';

(If your database supports the IN operator, this is probably even better:
$sql = state IN ('.implode(',', $_POST['state']).'); )

   }else{
  //$_POST['state'] is not an array
  $sql .= state = '.$_POST['state'].' ;
 }//end if
 
 if (isset($_POST['job'])){
   if (isset($_POST['state'])){  $sql .=  AND ; }  //add in 
 the AND if the 
 state is set
   //check to see if the states is an array (multiple items or just one
if (is_array($_POST['job'])){
  $sql .= (;
  $x = 0;
  foreach ($_POST['job'] as $job )
if ($x == 0){
$sql.= job = '$job ;
$x=1;
  }else{
 $sql .=  OR job = '$job ;
 }
 $sql .= );
   }else{
  //$_POST['job'] is not an array
  $sql .= job = '.$_POST['job'].' ;
 }//end if

Ditto for the job field.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James Graham 
Building, Leeds Metropolitan University, Headingley Campus, LEEDS,  LS6 3QS,  United 
Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Ford, Mike
 -Original Message-
 From: John Holmes [mailto:[EMAIL PROTECTED] 
 Sent: 22 September 2004 16:39
 
 From: Ford, Mike [EMAIL PROTECTED]
 if (is_array($_POST['state'])){
 
  This check isn't really necessary in PHP, since 
 $_POST['state'] will 
  *always* be an array if the form field has NAME='state[]', even if 
  only 1 is selected.
 
 But remember that the form comes from the client. Just 
 because you create 
 the form with state[], that doesn't mean I'm going to send 
 it that way. ;)

Yeah, true -- I have a very bad tendency to forget about security considerations like 
that until someone reminds me (often a posting on this list does it ;).  Just because 
I have a well-defined set of well-behaved users...!!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James Graham 
Building, Leeds Metropolitan University, Headingley Campus, LEEDS,  LS6 3QS,  United 
Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Ford, Mike
 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
 Sent: 22 September 2004 16:45
 
 --- Ford, Mike [EMAIL PROTECTED] wrote:
 
  if (is_array($_POST['state'])){
$sql .= (;
$x = 0;
foreach ($_POST['state'] as $state)
  if ($x == 0){
  $sql.= state = '$state' ;
  $x=1;
}else{
   $sql .=  OR state = '$state' ;
   }
   $sql .= );
  
  PHP has the very nice implode function to make this
  much easier:
  
  $sql = state='.implode(' OR state=', $_POST['state']).';
  
  (If your database supports the IN operator, this is
  probably even better:
  $sql = state IN ('.implode(',', $_POST['state']).'); )
 
 Sorry, cause I know this is probably a stupid
 question, but what block of code does the implode
 statement replace ?

Everything inside the if(is_array()).  Ummm, that should probably still be a
.= operator, then.  There's also some quotes missing in the original
version, so:

if (is_array($_POST['state']))
   $sql .= state='.implode(' OR state=', $_POST['state']).';

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



[PHP-DB] where can I post some mysql related questions?

2004-09-19 Thread Mike
hi, I've currently been looking for a mysql news server where I could post 
some questions on mysql database design (cause they shurely wouldn't fit 
here) and I have yet to find one. Can anyone help? 

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



RE: [PHP-DB] Re: Checkboxes in a table

2004-08-20 Thread Ford, Mike [LSS]
 -Original Message-
 From: Ford, Mike   [LSS]
 Sent: 21/08/04 01:57

   foreach ($_POST['checkbox'] as $key=$irrelevant):
 // checkbox[$key] was checked
   endif;

OK, it's 2a.m. here and I'm about asleep, whioch is why that last line
didn't read

endforeach;

!!!

Cheers!

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] Inserting a ' into mySQL

2004-08-20 Thread Ford, Mike [LSS]
 -Original Message-
 From: Ron Piggott
 Sent: 21/08/04 01:53

[]

 One of the problems I am now having is if the user types an ' into their
 entry --- these ones do not get saved into the mySQL database.

[]

 I can look at this and understand that if an ' is keyed why it wouldn't save 
 and that line would create an error --- How do you work around this? 

That's what mysql_real_escape_string() is for -- 
http://www.php.net/mysql_real_escape_string.

Cheers!

Mike

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



RE: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB

2004-08-19 Thread Ford, Mike [LSS]
On 19 August 2004 17:02, Michael Cortes wrote:

 ctrl-m is a carriage return.  Does anyone know what ctrl seqence is
 line feed? 

ctrl-j

(CR and LF are ASCII codes 13 and 10, so ctrl+ the 13th and 10th letters of
the alphabet respectively!)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Check Boxes

2004-08-18 Thread Ford, Mike [LSS]
On 18 August 2004 11:24, randy wrote:

 $chkboxes = $_POST['ch'];
 $sql = 'SELECT ';
 foreach($chkboxes as $k = $v)
 {
   $sql .= $v;
   if($k  (sizeof($chkboxes) - 1))
   {
   $sql .= ', ';
   }
 }
 $sql .= ' FROM form';

  $sql = 'SELECT ' . implode(', ', $chkboxes) . 'FROM form';

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Check Boxes

2004-08-18 Thread Ford, Mike [LSS]
On 18 August 2004 15:53, John Holmes wrote:

 Ford, Mike [LSS] wrote:
 
   $chkboxes = $_POST['ch'];
   $sql = 'SELECT ';
   foreach($chkboxes as $k = $v)
   {
 $sql .= $v;
 if($k  (sizeof($chkboxes) - 1))
 {
 $sql .= ', ';
 }
   }
   $sql .= ' FROM form';
  
  
$sql = 'SELECT ' . implode(', ', $chkboxes) . 'FROM form';
 
 Just note that with either solution, someone can post a value of *
 FROM table WHERE 1# and see everything in any table in your database.

I was waiting for someone to come in with a security warning, but knew that whoever it 
was would express it much better than I could ;) -- so, a gold medal to John!!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] OCI8

2004-08-13 Thread Ford, Mike [LSS]
On 13 August 2004 13:29, yannick wrote:

 I have some trouble with Oracle Database and php...
 
 see this code:
 ?
 while (1) {
 $conn=OCILogon($username,$password,$database);

Try OCIPLogon() rather than OCILogon().

 $stmt=OCIParse($conn,select 50 as toto from dual);
 OCIDefineByName($stmt,TOTO,$total);

Not related to your problem, but you don't need that  -- in fact, it's deprecated and 
may, one day, cause a parse error.

 OCIExecute($stmt);
 OCIFetch($stmt);
 echo :::$total:::\n;
 OCILogoff($conn);
 $err=OCIError($conn);
 OCILogoff($conn);
 sleep(10);
 }
  
 
 when i execute it, the number of fd on ocius.msg is growing. but
 there is only 1 connection at database.
 
 Can someone help me ?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Date problem: data is current as of yesterday

2004-07-03 Thread Ford, Mike [LSS]
-Original Message-
From: Karen Resplendo
To: [EMAIL PROTECTED]
Sent: 02/07/04 19:36
Subject: [PHP-DB] Date problem: data is current as of yesterday

The database queries all the sources at night after everyone has gone
home. That means the data was current as of yesterday. This little
snippet below returns yesterday's date, except that the first day of the
month returns 0 for the day. Now, I know why this is happening, but I
can't find out how to fix it (in VBA or SQL Server I would just say,
date()-1:
 
$today = getdate(); 
$month = $today['month'] ; 
$mday = $today['mday'] -1; 
$year = $today['year']; 
echo Data is current  as of  b$month $mday, $year/bbr;

--

The mktime() function is your friend for this kind of date arithmetic. For
example, this is one possible way to do what you want:

  $yesterday = mktime(12, 0, 0, $today['mon'], $today['mday']-1,
$today['year']);
  echo Data is current as of b.date(F j, Y, $yesterday);

(Note the use of time 12:00:00 to avoid daylight savings oddities!)

The examples on the date() and mktime() manual pages may suggest other
possibilities to you.

Cheers!

Mike
 


-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

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



RE: [PHP-DB] More problems with searching

2004-07-01 Thread Ford, Mike [LSS]
On 01 July 2004 18:36, Justin Patrin wrote:

 On Thu, 1 Jul 2004 12:28:46 -0500, Shiloh Madsen
 [EMAIL PROTECTED] wrote:
  
  After the very kind help i was given last night I have the query
  being built right, however the query does not work. Just to
  refresh, the gentlemen who had helped me suggested creation of a
  query that looks like: 
  
  SELECT * FROM table1 where 1 or cat or dog...and so forth. Now,
  this query is building fine, but the where 1 is causing it to
  return rows even if it has none of the search terms. When i run it
  in sql without the where 1 it works as it should, but with that, i
  get all rows returned. Is there a way i can reword this query or am
  I doing something wrong? 
  
  this was Mr Holmes's solution (in part):
  $query = SELECT * FROM keyword WHERE 1 
  $words = explode(' ',$_GET['search_text']);
  foreach($words as $word)
  { $query .=  AND keyword = '$word' ; }
 
 Shouldn't that be OR?

... and, if it should, that should be a 0 instead of a 1 (although I'm not a huge fan 
of this technique!).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] [PHP]: session problem

2004-06-25 Thread Ford, Mike [LSS]
On 24 June 2004 16:44, H. J. Wils wrote:

 this is the code, but this code works on my hosting provider but not
 on my own server. I think i have to change settings in php.ini but
 dont know which...
 first page:
 
 session_start();
 
 include connect.php;
 include functions.php;
 
   $user= $_GET[email];
   $ww = $_GET[ww];
 
   $check_user_query = select id,email, password from user where
 email='$user' and password='$ww';
   $check_user_res = mysql_query($check_user_query) or
 die(mysql_error().: $check_user_query);
 
   if (mysql_num_rows($check_user_res) == 1){
  //user is ingelogd
 
$userdata =
 mysql_fetch_array($check_user_res);
$sid=session_id();
$uid=$userdata[id];
$_SESSION['logged_in'] = true;
$_SESSION['sid'] = $sid;
$_SESSION['user'] = $uid;
 
$dt = date(Y-m-d H:i:s);
 
  header(location: user.php?action=0);
   }else{
  header(location: user.php?action=9);
   }

Redirecting like this will not pass the session id in the URL if that is
necessary, which it would be if cookies are not being used.  Since you say
it works for you from your provider's system but not your local one, this
suggests that your provider has session.use_cookies turned on, but you have
it turned off.

If this is so, you can solve your immediate problem by turning that option
on in your php.ini, but the redirects will still not work correctly for
anyone who has cookies turned off in their browser.  If you are bothered
about this, you need to make use of the handy-dandy SID constant that PHP
helpfully provides, thusly:

  header(Location: user.php?action=0.SID);

or, if you're a tidy-URL geek, something like:

  header(Location: user.php?action=0.(SID?.SID:));

(BTW, notice the correct spelling of the Location header, with a capital
L; and, yes, others are right when they say it should be a full absolute
URL.  These things have been known to matter to some browsers, so it's best
to make a habit of getting them right!)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP-DB] Sample Code

2004-06-15 Thread Mike Koponick
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



  1   2   3   4   >