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



RE: [PHP-DB] Image / file uploader

2004-04-30 Thread Ford, Mike [LSS]
On 30 April 2004 01:10, Craig Hoffman wrote:

 When I put single quotes in the PHP_SELF and I get this error:
 Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
 expecting T_STRING or T_VARIABLE or T_NUM_STRING
 
 and I can't use double quotes because its in an echo statement.  What
 am I missing?

Curly braces:

   echo (form method='post' action='{$_SERVER['PHP_SELF']}'
encType='multipart/form-data'

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] quotations in value field

2004-04-14 Thread Ford, Mike [LSS]
On 14 April 2004 15:21, Mikael Grön wrote:

 On Apr 14, 2004, at 15:14, H-Mac Moderator wrote:
 
  Mikael-
  
  I suspect you want htmlspecialchars, Not stripslashes. See:
  http://us4.php.net/manual/en/function.htmlspecialchars.php

 Well, I guess a combination of htmlspecialchars and some
 other function
 to convert it back, before it gets sent of in the _plain text mails_.

You don't need to convert it back -- that happens automatically when the
form is resubmitted.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] How to redirect after a valid login

2004-03-15 Thread Ford, Mike [LSS]
On 14 March 2004 02:14, Benjamin wrote:

 What kind of error does it give you?  Because in the snippet you gave
 us you wrote
 
   include mainmenu.php; // Which gives me an error !
 
 And that should give you an error because it should be
 
 include( mainmenu.php );  //note parenthesies

Nope.  Perfectly valid without the parentheses -- do it all the time.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] win32 Timestamp problem

2004-03-10 Thread Ford, Mike [LSS]
On 09 March 2004 20:36, J. Kevin C. Burton wrote:

 Hey all, after reading documentation on the Win32 bug
 regarding Timestamps
 not being able to go prior than 1970..
 
 I am in need of a way to calculate someone's age.
 
 Has anyone found a fix or workaround for this bug? Or a way
 to calculate age
 without using the timestamp?
 
 They say that v5 of PHP will fix this issue, but I've been using every
 stable release of PHP5 and it's a no go.

No, it won't.  It's an operating system issue, and nothing PHP *can* fix.

 Any help would be appreciated.

Have you looked at the Calendar extension? http://www.php.net/calendar

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Two Column Sort

2004-03-05 Thread Ford, Mike [LSS]
On 04 March 2004 19:04, [EMAIL PROTECTED] wrote:

 On Thu, 4 Mar 2004 10:55:20 -, Ford, Mike   [LSS]
 [EMAIL PROTECTED] wrote:
 
  On 03 March 2004 17:07, [EMAIL PROTECTED] wrote:
  
   Here's the php code for the sort command:
   
   echo tddiv align='center'font size='3'bCBC a
   href='contributions22504.php?sort_field=cbc,
   net_receiptssort_order=desc'
   target='_self'font size='2'Sort/a/b/font/div/td\n;
   
   Here's the basic setup that begins the script:
   
   # get sort order (if any) passed to script
   $sort_field = $_REQUEST['sort_field'];
   if (! $sort_field) {$sort_field = State;}
   $sort_order = $_REQUEST['sort_order'];
   if (! $sort_order) {$sort_order = asc;}
  
  Well, you're going to need an order phrase that looks like this:
  
  ORDER BY CBC DESC, NET_RECEIPTS ASC
  
  so you may need a little rethink about how you're passing those
  arguments. 
  
  Cheers!
  
  Mike
  
 Thanks, but you're past my level.  Can you show me the exact coding I
 should use?

Well, not really, as there are several ways you could approach this and the one you 
choose will depend on your exact application, personal preference, and whether there's 
an r in the month ;)

  Apparently I can't just replace SORT_FIELD=CBC,
 NET_RECEIPTSSORT_ORDER=DESC with ORDER BY CBC DESC, NET_RECEIPTS ASC

Well, you can, but the question is more whether that's what you want to do.

My original point was that if your URL has a query string that looks like

?sort_field=cbc, net_receiptssort_order=asc

then you're going to get your variables set like this:

$sort_field = 'cbc, net_receipt';
$sort_order = 'asc';

but you need to interpolate an additional 'desc' into the sort order string to get the 
CBC column to sort the way you want, so that the query ends up like:

SELECT ... ORDER BY cbc DESC, net_receipts asc

Whilst this is possible using PHP string functions (or regexes), it doesn't seem like 
the easiest or most flexible method.  A couple of alternatives off the top of my head 
might be:

(i) just pass the full ORDER BY phrase (...?sort_order=cbc desc, net_receipts asc)

(ii) pass multiple parameters each with one column name and sort order (either 
...?sort1=cbc descsort2=net_receipts asc, or ?sort[]=cbc descsort[]=net_receipts asc)

(iii) pass a parameter with a set of column names, and another with a matching set of 
sort orders (...?sort_field=cbc,net_receiptssort_order=desc,asc).  This requires you 
to break each set apart (by explode()ing on the comma, say), then reassemble them into 
a suitable ORDER BY phrase.  This option probably also requires you to do the most 
validation, as you have to decide what happens when one set has more items in it than 
the other, or is misformed in some other way, and so on.

Of course, you might decide that column CBC always wants to be sorted descending 
regardless, in which case looking for it in the parameters and interpolating the 
required DESC keyword is probably the way to go after all...!!

At the end of the day, only you can decide which of these is appropriate (or if some 
other solution is), but I hope I've given you some pointers to help you make that 
decision.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] ocistatement

2004-03-05 Thread Ford, Mike [LSS]
On 05 March 2004 09:38, Torsten Lange wrote:

 Hello,
 I receive an array from an OCIFetchStatement() and want to
 address its
 elements by indices, which fails. The original select has two columns.
 How do I have to visualize that array? I want to load it into an
 option list.  I tried also some examples with
 while(list...), but it
 can not work until I don't know the structure.

If your column names are, say, ID and NAME, then the array looks like this:

Array ('ID' = Array ('id1', 'id2', 'id3', ...),
   'NAME' = Array ('name1', 'name2', 'name3', ...)
  )

So the rows of your query result are:

$arr['ID'][0], $arr['NAME'][0]
$arr['ID'][1], $arr['NAME'][1]
$arr['ID'][2], $arr['NAME'][2]
... etc. ...

HTH

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Two Column Sort

2004-03-05 Thread Ford, Mike [LSS]
On 05 March 2004 14:49, Ken Colburn wrote:

 Mike -
 
 I've tried your options and I get either an error message, no
 sorting, or sorting that does not do both columns with B's at the
 top.  It's my understanding that I must still use sort_field and
 sort_order (though I tried just ORDER BY).  It does seem simple, but
 nothing 
 works.  It would
 be a great help if you could plug something (anything) into
 the url that
 works at
 http://congress.techpolitics.org/contributions22504.php/
 Hope this isn't
 asking too much.

Right, this is what I plugged in that I think gives the result you're asking
for:

 
http://congress.techpolitics.org/contributions22504.php?sort_field=cbc%20des
c,%20net_receiptssort_order=asc

I've had to contrive the parameters a bit to work around the way you're
processing them, but hopefully you get the idea.

Just to over-egg the pudding a bit, I thought I'd extend the idea slightly
and give you one more example:

 
http://congress.techpolitics.org/contributions22504.php?sort_field=cbc%20des
c,state%20asc,%20net_receiptssort_order=desc

Cheers!

Mike

P.S. please keep the discussion on the list so others can chip in if they
want -- and any final resolution gets into the list archives for anyone
reading the thread in the future.

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Two Column Sort

2004-03-04 Thread Ford, Mike [LSS]
On 03 March 2004 17:07, [EMAIL PROTECTED] wrote:

 I'm re-raising an issue I never quite resolved which has become more
 critical.  I want to sort a table on two columns.  There are
 about 440
 rows of which about 400 are blank in the first sort column (CBC); the
 other rows show B in that column.  When I use the coding
 below, the two
 column sort takes place but the rows designated B are at the
 bottom of the
 (long) table and I want them at the top.  Neither asc nor desc
 accomplishes this (just reverses the second factor order,
 still at the
 bottom below the blanks).
 
 Here's the php code for the sort command:
 
 echo tddiv align='center'font size='3'bCBC a
 href='contributions22504.php?sort_field=cbc,
 net_receiptssort_order=desc'
 target='_self'font size='2'Sort/a/b/font/div/td\n;
 
 Here's the basic setup that begins the script:
 
 # get sort order (if any) passed to script
 $sort_field = $_REQUEST['sort_field'];
 if (! $sort_field) {$sort_field = State;}
 $sort_order = $_REQUEST['sort_order'];
 if (! $sort_order) {$sort_order = asc;}

Well, your going to need an order phrase that looks like this:

ORDER BY CBC DESC, NET_RECEIPTS ASC

so you may need a little rethink about how you're passing those arguments.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] oracle: fetch a query result into an array

2004-02-18 Thread Ford, Mike [LSS]
On 18 February 2004 18:22, Torsten Lange contributed these pearls of wisdom:

 
   while(OCIFetch($stmt))
  {
  $column_name = OCIResult($stmt,'COLUMN_NAME');

missing [] here -- should be:

  $column_name[] = OCIResult($stmt,'COLUMN_NAME');

  $counter++; }

You might also want to look up ocifetchstatement
(http://www.php.net/ocifetchstatement).

Cheers!

Mike

-- 
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Inserting querydata as default value in form

2004-01-28 Thread Ford, Mike [LSS]
On 28 January 2004 18:05, Georg Herland wrote:

 Hi!
 
 I hav made a simle page to insert update and delete data in MYSQL.
 I try to put existing data into a standard form field to make editing
 easyer: input name=link TYPE=TEXT cols=40 value=$query_data[4]
 Problem is when the text data contains a space ie Look
 here. Then only the
 first word show.

Oh dear, it's HTML 101 time again.

Quote your attribute values!

input name=link TYPE=TEXT cols=40 value=?php echo $query_data[4]
?


Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Quick Question: Line Breaks

2004-01-09 Thread Ford, Mike [LSS]
On 09 January 2004 03:58, Jacob Hackamack wrote:

 Hello,
 
 I have a couple of quick questions.  When I execute this code on my
 php page (I know that the .PSD image isn¹t web ready, but Safari does
 what I need it to do :) ) it displays the entire source as one line. 
 Is there anyway to have it be broken.  I have read places (internet
 sites) that say that the following solutions might work:
 echo OE¹;\n\n
 echo OE¹\n\n ;
 echo OE\n\n¹;
 
 None of them seem to work, am I doing something wrong?
 
 
 echo 'meta http-equiv=content-type content=text/html;
 charset=utf-8'; echo 'html';
 echo 'head';
 echo 'title';
 echo 'FilmCanister Desktops';
 echo '/title';
 echo '/head';
 echo 'body';
 echo 'center';
 echo 'img src=images/Rotating.psd';
 echo 'h2';
 echo 'Coming SoonDesktop Pictures (2.83 GB Worth)/h2'; echo
 '/center'; echo '/body';
 echo '/html';

The reason you have it all on one line is because you haven't echoed any
newlines.  You have a number of options to do this.  As there is no variable
interpolation anywhere in there, you could just break out of PHP and do it
as straight HTML:

...
?
meta http-equiv=content-type content=text/html; charset=utf-8
html
head
title
FilmCanister Desktops
/title
/head
body
center
img src=images/Rotating.psd
h2
Coming SoonDesktop Pictures (2.83 GB Worth)/h2
/center
/body
/html
?php
...

Or you could echo the whole thing in one go (since you can have newlines in
a PHP string):

echo 'meta http-equiv=content-type content=text/html; charset=utf-8
html
head
...
/body
/html
';

If you plan to have variables in there at some point, you can either use
?php echo $var ? segments, or use a heredoc:

echo END
meta http-equiv=content-type content=text/html; charset=utf-8
html
head
body
center
img src=images/$name.psd
...
/body
/html
END;

or, again, you could use a multi-line string -- but this time double-quoted
to give interpolation (but note that you now have to escape all your
embedded double quotes):

echo 
meta http-equiv=\content-type\ content=\text/html; charset=utf-8\
html
head
body
center
img src=\images/$name.psd\
...
/body
/html
;

Which route you choose is pretty much personal taste -- personally, if I
have a page that's mostly straight HTML with not much PHP code, I write it
as HTML with embedded PHP snippets, but I know some people think that looks
weird or ugly...!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] inserting dynamic drop down menu data into mysql

2004-01-07 Thread Ford, Mike [LSS]
On 07 January 2004 15:12, Duane Barnes contributed these pearls of wisdom:

 I'm having a problem with a standard html form.  I'm using a
 php function to
 populate a drop down menu on a standard form.  I want the
 contents of the
 submitted form to insert into a mysql table. All of the
 variables are inserted correctly except for the data from the
 drop down 
 menu.  For some
 reason it will only insert the first word in the variable.
 It cuts off
 everything after the frist word.

This sounds like an unquoted multi-word attribute problem.

[snip]

 function build_dropdown() {
 $sql = select category from categories ORDER BY category;
 $result = mysql_query($sql) or DIE(mysql_error(). -
 .mysql_errno()); 
 
 while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {   
 extract($row); $output .= option
 value=$category$category/option;

Yup, here it is -- quote the argument to the value= attribute, and everything should 
be hunky dorey.

Cheers!

Mike

-- 
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Search Query

2003-12-18 Thread Ford, Mike [LSS]
On 18 December 2003 05:26, Ng Hwee Hwee wrote:

 Dear all,
 
 i need help with my search query statement.. what is wrong
 with my code?

Nothing obvious that I can see, except a little inefficiency.  Where do
$keyword and $table come from? -- is this a register_globals issue?

 
 snip
   $word = split( , $keyword);
   $num_words = count($word);
   $word_str = ;
   $criteria = ;
 
   for ($i=0; $i$num_words; $i++)
   {
   if ($i)
  $word_str .= and colName like '%.$word[$i].%' ; 
  else $word_str .= colName like '%.$word[$i].%' ;
 } 
   $word_str .= and col2 = '$foo' ;
 
   $criteria .= $word_str ;

I'd replace all of the above with:

$criteria = colName like '%
   . str_replace(' '
, %' and colName like '%
, $keyword)
   . %'
   .  and col2 = '$foo' 

   $table .= db_table;
 
   $query = select * from .$table. where .$criteria; /snip
 
 when i try to echo $query, i get ---  select * from where
 
 and so of course MySQL gives me an error 1064 near ' where '
 
 what happened?

What's your error_reporting level?  HAve you tried cranking it up to E_ALL
to see if any relevant warnings are being generated that you're not
currently seeing?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] How do I get quotes around strings to display?

2003-10-22 Thread Ford, Mike [LSS]
On 22 October 2003 00:41, [EMAIL PROTECTED] wrote:

 $fieldarray = array(one,Two, three, four);
 $line = \.implode(\,\,$fieldarray) .\;

Eck, eck, eck!!  Definitely a construct crying out for single quotes rather than 
double:

$line = ''.implode(',',$fieldarray) .'';

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Dynamic sites, to appear static...?

2003-09-04 Thread Ford, Mike [LSS]
On 04 September 2003 11:18, [EMAIL PROTECTED] wrote:

 I've been building web sites that use a database backend for
 some time
 now.
 I typically use the format.
 http://www.mysite.com/index.php?page=contact
 http://www.mysite.com/index.php?page=home
 http://www.mysite.com/index.php?page=aboutus
 etc
 
 My most recent job wants to use differnt pages, so the search engines
 will pick up the url's as clearly defined, and not dynamic, as I
 normally do...
 
 Is there a way I can still admin the pages, and allow my client to
 add/delete pages, but use static links , without '?page=home' etc...
 
 I hope I've made sence...
 I've discused this with my client, and he said a friend of
 his claimed
 'that webserver software should have a module or plugin that
 will do this'
 I've never heard of that, have I been living under a rock?

Not even a module (well, except for php!) or plugin.  If you're using Apache as your 
Web server with mod_php, anything looking like path information following the script 
name is passed to your script in $_SERVER['PATH_INFO'].  Take a look at, for example:

http://www.lmu.ac.uk:8082/lco/php/support.php/visitors/welcome

Note the position of support.php in that URL -- this URL is processed by running 
support.php with $_SERVER['PATH_INFO'] set to '/visitors/welcome', which the script 
decodes to decide what it actually needs to display.

There's nothing particularly special in my httpd.conf file to make this work -- the 
relevant section is simply:

Directory /lco/php/
AddType application/x-httpd-php .php
Order allow,deny
/Directory

As a refinement, if you don't want people to see the .php on the script name, so that 
the URL could be (say):

http://www.lmu.ac.uk:8082/lco/php/support/visitors/welcome

you can tweak this to:

Directory /lco/php/
AddType application/x-httpd-php .php
DefaultType application/x-httpd-php  # or ForceType if you prefer
/Directory

Then you either need a relevant AliasMatch or Rewrite so the above still gets to call 
support.php, or you simply upload all your scripts to the server with their bare name 
to match.

I believe IIS is capable of passing PATH_INFO information, too, if you set it up 
right, but as I don't use it I can't be sure (or tell you how it might work!).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] include_path problem

2003-09-03 Thread Ford, Mike [LSS]
On 03 September 2003 01:32, Bruce Levick contributed these pearls of wisdom:

 Well yes I have restarted my webserver, and the php.ini file
 is under the
 windows directory (shown in phpinfo page) and I am
 definatelty editing it.
 
 The current value for my include_path is .;c:\php\includes
 which is different to whats showing up on the phpinfo page and
 also 
 the error that is
 coming up.
 
 The wierd thing is I can change anything else in the php.ini
 file and it
 updates on the phpinfo page. Just not the include_path
 attributes. Its as if
 I am not changing the correct service as there is nothing in
 the php.ini
 file that relates to the directory .;c:\php4\pear.

Couple more stabs in the dark, then:

- Check there is only one entry for include_path.
- Make sure it's not commented out! (No ; at the start of the line.)

Also, just to be absolutely sure, can you post exactly what your phpinfo shows for the 
php.ini setting?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Consider upgrading MySQL client .... how do I do this?

2003-09-03 Thread Ford, Mike [LSS]
On 03 September 2003 10:51, Vinoaj Vijeyakumaar contributed these pearls of
wisdom:

 Hi,
 
 Just this morning I upgraded to MySQL 4.1.0 alpha and PHP
 4.3.3.  I'm also
 running Apache 2 on a WinXP machine.  The main reason for the
 upgrade was so that I could make use of 4.1.0's sub-select
 feature rather than attempt learning JOINs.  It is now 7 hours
 later, and I keep getting the following error when trying to
 connect to my database: 
 
 Warning: mysql_connect(): Client does not support
 authentication protocol
 requested by server. Consider upgrading MySQL client
 
 
 My question, therefore, is - is there a way to upgrade the
 MySQL client in PHP 4.3.3?  If not, what are the alternatives
 (apart from reverting back to MySQL 4.0.x of course).

I don't believe so, although I'm not absolutely certain as I don't use MySQL
myself.  My understanding, however, is that support for MySQL 4.1 will not
be available until PHP 5.0.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] include_path problem

2003-09-03 Thread Ford, Mike [LSS]
On 03 September 2003 14:10, Bruce Levick contributed these pearls of wisdom:

 There is an include_path for unix and an include_path for
 windows. They both
 differ slightly but aren't of the same value that is being
 returned in the
 php info page or the error that I am receiving.
 
 This is the info displayed for my php.ini file. My OS is on G:.
 
 G:\WINDOWS\php.ini
 
 This is the Include_path directory shown in the phpinfo page.
 .;c:\php4\pear 
 
 Thanks very much for your help on this. Let me know if you
 need me to post
 anything else that might help.

Well, I think I'm about out of ideas then -- so long as the ini file you're editing is 
G:\WINDOWS\php.ini, this all looks spot on.

Just as a very last resort, can you post an extract from your G:\WINDOWS\php.ini that 
shows the lines which set include_path, plus a few lines either side -- just to check 
that there's nothing in their context that might be mucking things up.

I suppose it might also be interesting to see the entire line from your phpinfo that 
shows the include_path settings (i.e. both master and local values).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] include_path problem

2003-09-02 Thread Ford, Mike [LSS]
On 02 September 2003 08:00, Bruce Levick wrote:

 Hi guys,
 I am re-developing the look and feel of a site and trying to set it up
 localy. Its all setup and ready to go but I am getting a
 pear.php include
 failure.
 
 Warning: main(/PEAR.php): failed to open stream: No such file
 or directory
 in G:\Inetpub\wwwroot\DB.php on line 25
 
 Fatal error: main(): Failed opening required '/PEAR.php'
 (include_path='.;c:\php4\pear') in G:\Inetpub\wwwroot\DB.php
 on line 25
 
 
 The include path c:\php4\pear is incorrect. This is showing up in my
 phpinfo file and I can't seem to get it to change in my
 php.ini file. There
 are include_path options in the php.ini file but nothing like
 the directory
 path in the error I am receiving.

OK; '.;c:\php4\pear' is the default value for include_path, so PHP is not
seeing your edited php.ini.  Let's try a couple of basic questions (forgive
me if these are obvious to you, but you haven't covered them in your
message):

1) Did you restart your Web server after editing php.ini?

2) Where does the phpinfo() output say your php.ini file should be (look at
the Configuration File (php.ini) Path entry right near the top)?  And is
your php.ini there?

If the answer to both of these is yes, and you're still having problems, get
back to the list with some more detail and maybe someone will have some
other bright ides.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] To slash or not to slash....

2003-09-02 Thread Ford, Mike [LSS]
On 02 September 2003 16:45, Craig Cameron wrote:

 Ok simple problem I hope.
 
 
 Have the following code, used to store the location and a few
 details about meeting minutes.
 
 snip
   $connection = mssql_connect(server,user,password);
   mssql_select_db(DocumentManager,$connection);
 
   $AlteredMinutesLocation =
 str_replace(\\,\,$MinutesLocation);
 
   $SQL_STRING = INSERT INTO tblMeetingMinutes
 VALUES('$Date','$Type','$AlteredMinutesLocation','$Centre');
 
   $Result = mssql_query($SQL_STRING,$connection);
   mssql_close($connection);
 
 /snip


This script cannot possibly run -- it should have a parse error.  Due to the
way PHP handles backslashes in literal strings, the function call

   str_replace(\\,\,$MinutesLocation);

has a string containing 1 (one) backslash, and an unterminated string
containing
a double-quote and then everything up to the next double-quote (which is
actually part-way through the next line).

 Problem is the backslashes. When I collect the filepath
 ($Location) it puts \\ into the db. However, when I change
 this it stops dead. Basically due to the escape
 charateristics of the backslash. I can get around this with
 single quotes of course but can't put these in the SQL_STRING
 as it falls down there then!

I'm not sure I exactly follow what you're saying, but yes, there is
definitely a problem caused by the escape characteristics of the \.
However, I'm not sure it's where you think it is.  The problem I can see in
your supplied script is that you haven't properly expressed in the replace()
call strings representing \\ and \.  Since \ is the escape character, every
\ has to be escaped by itself, so the correct way of writing this is:

  $AlteredMinutesLocation = str_replace(,\\,$MinutesLocation);

(Note that single-quotes make no difference here, as ' (and \ itself, of
course) are just about the only characters escaped by \ in a single-quoted
string!!)

None of this should be relevant to the interpolation of
$AlteredMinutesLocation into $SQL_STRING, since variable interpolation just
inserts whatever is in the variable, without any backslash escaping or other
fancy footwork.

Or another option might be stripslashes().

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Beta 2 of plPHP released.

2003-08-29 Thread Ford, Mike [LSS]
On 29 August 2003 05:27, Joshua D. Drake wrote:

 Hello,
 
   Beta 2 of plPHP has been released. This version contains many bug
 fixes. For example, if you write bad plphp code and try to
 execute it,
 the code will no longer crash PostgreSQL ;).

It would be nice if you told us what plPHP actually is as part of this message -- save 
those of us who have no interest in whatever it is having to make an unnecessary click 
through to your Web site.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] weird php error

2003-08-29 Thread Ford, Mike [LSS]
On 29 August 2003 06:39, OpenSource wrote:

 Hi guys,
 
 This is weird to me..
 I got this script
 --- ?php
 
 if ($_GET[login] == 'forgot')
 {
 echo Sorry  I forgot my password;  
 } else { echo you are good to go; }
 
  
 -
 when ran, it gives me this error
 
 
 Notice: Use of undefined constant login - assumed 'login' in
 G:\Inetpub\wwwroot\test\index.php on line 3

This is because you haven't quoted the array subscript -- PHP thinks you're
trying to refer to a constant called login, but on not finding that assumes
that you meant the string 'login' instead.  To suppress this notice, supply
the subscript correctly as a string:

if ($_GET['login'] == 'forgot')

 
 Notice: Undefined index: login in G:\Inetpub\wwwroot\test\index.php
 on line 3

This means that there was no login= parameter on the URL that called this
script.  If this is a permissible condition, you need to allow for it in
your code.  One way is simply to suppress the error message with the @
operator:

if (@$_GET['login'] == 'forgot')

Another is to do more explicit checking:

if (isset($_GET['login'])  $_GET['login'] == 'forgot')

Which you use is really down to personal preference.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Populating an array from mysql db

2003-08-28 Thread Ford, Mike [LSS]
On 28 August 2003 17:25, mike karthauser wrote:

 on 28/8/03 5:00 pm, CPT John W. Holmes at
 [EMAIL PROTECTED] wrote:
 
   Thanks for this - I ended up rehashing my query to this:
   
   ?
   $result = mysql_query(SELECT * FROM dates WHERE bookcode =
   '$bookcode' ORDER BY date1,$db); 
   
   
   // loop to populate array
   
   $myrow = mysql_fetch_array($result);
   
   $i = 1;
   while ($i = '30') {
   
   if ($myrow['date'.$i]  '-00-00')
  
  You're making PHP do some extra work here. You're testing to see if
  one string is greater than another... how can strings be greater
  than or less than? Why don't you just check for $myrow['date'.$i]
  != '-00-00' ?? 
 
 Thanks. I'll make your change.

While you're about it, remove the quotes from

while ($i = '30') {

as well -- saves a conversion from string to integer each time round the loop (well, 
unless PHP optimises it out of the loop, but why take the chance?!).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Maximum execution time of 30 seconds exceeded

2003-08-14 Thread Ford, Mike [LSS]
On 11 August 2003 07:02, Michael Cortes wrote:

 I am using the Konqueror browser and browing to
 http://localhost/my.php
 
 Howerver, the script I wrote, doing various queries and lookups,
 inserts, etc..  takes a while to complete.   That is fine with
 me.  I'll wait. However, the server and/or browser will not wait.
 
 I believe the server is the one which will not wait because I have
 one echo line at the beginning of the script which put a title
 Udate Students athe the top center of the page and that writes then
 there is a pause while the queries are run and then I get the
 following error in my browser 
 
 Fatal error: Maximum execution time of 30 seconds exceeded in
 /var/www/html/student_info/ps2follett.php on line 139

That's your PHP script timing out.  Take a look at
http://www.php.net/set_time_limit

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Searching a file for text surrounded by brackets

2003-07-16 Thread Ford, Mike [LSS]
 -Original Message-
 From: Jamie Saunders [mailto:[EMAIL PROTECTED]
 Sent: 16 July 2003 11:20
 
 Hi, I need a way of searching a file for text between two 
 brackets, below
 is an example of a couple of lines from the file I'm searching:
 
 trtdfont size=2{L_LOGIN}/font/td/tr
 trtdfont size=2{L_LOGOUT}/font/td/tr
 
 So I'll need to search the above for text between the '{' and 
 '}' brackets
 and read each into an array.

preg_match_all() (see http://www.php.net/preg_match_all) should do what you
want -- something like:

 preg_match_all('/{([^}])+}/', $file_contents, $matches);

should give you an array of matched tags (excluding the braces) in
$matches[1].

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] problem with starting a session

2003-07-15 Thread Ford, Mike [LSS]
 -Original Message-
 From: Ahmed Abdelaliem [mailto:[EMAIL PROTECTED]
 Sent: 15 July 2003 08:54
 
 i have a problem with starting a session in the page that 
 validates the user 
 input and sends it tothe database,
 when the user clicks register he gets this error
 
 Warning: session_start(): Cannot send session cookie - 
 headers already sent 
 by (output started at 
 c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25) in 
 c:\inetpub\wwwroot\ads4u\register_new.php on line 89
 
 Warning: session_start(): Cannot send session cache limiter - headers 
 already sent (output started at 
 c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25) in 
 c:\inetpub\wwwroot\ads4u\register_new.php on line 89
 
 
 and here is the code i wrote :

There must be  approximately 73 lines before this, as the error message says
the session_start() is on line 89.  Your problem is that one of those lines
is an include/require for data_valid_fns.php, and line 25 of that file
outputs something that can't be output before the session_start().  Take a
look there and work out how you can fix that.
 
 ?
  $email=$HTTP_POST_VARS['email'];
  $passwd=$HTTP_POST_VARS['passwd'];
  $passwd2=$HTTP_POST_VARS['passwd2'];
  $title=$HTTP_POST_VARS['title'];
  $name1=$HTTP_POST_VARS['name1'];
  $name2=$HTTP_POST_VARS['name2'];
  $phone=$HTTP_POST_VARS['phone'];
  $mobile=$HTTP_POST_VARS['mobile'];
  $address1=$HTTP_POST_VARS['address1'];
  $address2=$HTTP_POST_VARS['address2'];
  $town=$HTTP_POST_VARS['town'];
  $pb=$HTTP_POST_VARS['pb'];
  $country=$HTTP_POST_VARS['country'];
  $occupation=$HTTP_POST_VARS['occupation'];
 
 session_start();


Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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 checking question

2003-06-27 Thread Ford, Mike [LSS]
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: 26 June 2003 20:22
 
 What I would like to do is somehow have a redundant error 
 check on the server
 side and then display an error message above the form on the 
 main page should
 fields be left blank or forbidden characters entered. Since I 
 have access to the
 $_POST['variables'] on the form processing page, I've already 
 written some code
 to detect the presence of error characters, etc...and no 
 query is performed if
 there is an error.  But how do I pass a flag variable back 
 to the main page to
 echo an appropriate message above the form?

One simple way:

   header(Location: http:/your.server.name/path/to/main_page.php?err=$errcode);
   exit();

And then emit an error in main_page.php if $_GET['err'] is set.

If you're using sessions, another way would be to set an error variable in the session.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] latest version of php only cgi?

2003-06-27 Thread Ford, Mike [LSS]
 -Original Message-
 From: Doug Finch [mailto:[EMAIL PROTECTED]
 Sent: 26 June 2003 21:12
 
 Is the newest version of php 4 only available as a cgi-based program?
 DF

No.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] moving though an array..SOLVED

2003-06-26 Thread Ford, Mike [LSS]
 -Original Message-
 From: Aaron Wolski [mailto:[EMAIL PROTECTED]
 Sent: 26 June 2003 16:12
 
 Solved my problem!
 
 Here's the code in case anyone really cares :P
 
   $col = explode(,,$threadsColumn);
 
   $col_search = (;
   for ($i=0;$icount($col);$i++) {
   
   $col_search .= $col[$i]. LIKE
 '%$threadsName%';
   if ($i != (count($col) - 1)) {
   $col_search .=  OR ;
}
   }
 
   $col_search .= );

Yes, that's about how I'd do it -- you may, however, be interested in this variation 
on the theme:

$col = explode(,,$threadsColumn);

$col_search = array();

foreach ($col as $col_name) {   
$col_search[] = $col_name LIKE '%$threadsName%';

$col_search = ( . implode(' OR ', $col_search) . );


A completely different approach might be to do it like this:

$col_search = (
 . str_replace(',',
  LIKE '%$threadsName%' OR ,
 $threadsColumn)
 .  LIKE '%$threadsName%'
 . );

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] setting session variables via a form

2003-06-16 Thread Ford, Mike [LSS]
 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
 Sent: 16 June 2003 17:08
 
   session_start();
   session_register(isRegistering);
 
   $_SESSION[isRegistering] = true;

B't!  If you're using the $_SESSION array, then you MUST NOT use 
session_register() and friends.

(Well, ok, maybe that's overstating it a bit, but you still shouldn't do it!)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Help Please!! Oracle/PHP connection

2003-06-11 Thread Ford, Mike [LSS]
 -Original Message-
 From: Matthew Moldvan [mailto:[EMAIL PROTECTED]
 Sent: 11 June 2003 01:03
 
 Have you tried the built in Oracle functions in PHP?
 
 http://us3.php.net/oracle

That's only for Oracle up to version 7.

For Oracle 8 or 9, use the OCI extension http://www.php.net/oci8.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Is this query even possible?

2003-06-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: Susan Ator [mailto:[EMAIL PROTECTED]
 Sent: 10 June 2003 16:18
 
  This is what I am trying to do:
  
  if ($FUNC==(USERPOST) || $FUNC==(MODU)) {
  $sql = UPDATE newdacs
  SET emailfwd='$emailfwd',
  mformat='$mformat',
  filter_code='$filter_code'
  if ($FUNC=='USERPOST') {
  ,unote='$unote'
  }
  WHERE user_id='$user_id';
  $set_newdacs_result = mysql_query($sql) or print
  mysql_error();
  }

Well, you're burying a PHP conditional inside what should be the SQL query,
which ain't gonna work very well.  Try separating it out -- two possible
ways are to (i) use the ?: conditional operator, like this:

$sql = UPDATE newdacs
.  SET emailfwd='$emailfwd'
. ,mformat='$mformat'
. ,filter_code='$filter_code'
. ($FUNC=='USERPOST' ? ,unote='$unote' : '')
.  WHERE user_id='$user_id';

or (ii) a fully-blown if(), like this:

$sql = UPDATE newdacs
.  SET emailfwd='$emailfwd'
. ,mformat='$mformat'
. ,filter_code='$filter_code';
if ($FUNC=='USERPOST'):
$sql .= ,unote='$unote'
endif;
$sql .=  WHERE user_id='$user_id';

There are probably umpteen other ways of approaching this -- use whatever
floats your boat! ;)


Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Count database-values

2003-06-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: 10 June 2003 12:15
 
 I screwed up my own code.  Silly me.  It should read:

Surely your first attempt is the right one?  There's only ever going to be 1 Total, so 
why waste a while loop trying to read more than one result row?
 
 $query = SELECT SUM(bedrag) AS Total FROM finance WHERE 
 posneg = 'af';
 $result = mysql_query( $query );
 while ( $total = mysql_fetch_array( $result ) )
 {
 $total = $total['Total'];
 }
 
 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com
 
 
 - Original Message - 
 From: Becoming Digital [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, 10 June, 2003 06:43
 Subject: Re: [PHP-DB] Count database-values
 
 
  So far no problems, but I want to count all these values.
  I tried with SUM but with the following code it doesn't work:
 
  $squery = SELECT SUM(bedrag) AS Total FROM finance WHERE 
 posneg = 'af';
 
  any suggestions how to do? I want to store it in a 
 variabele ($total)
  so I can echo it. (E.g.: $total = 93.63 in this case)
 
 If you want the total, you need to do something like the following:
 
 $query = SELECT SUM(bedrag) AS Total FROM finance WHERE 
 posneg = 'af';
 $result = mysql_query( $query );
 $total = mysql_fetch_array( $result );
 $total = $total['Total'];
 

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Is this query even possible?

2003-06-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: Matthew Moldvan [mailto:[EMAIL PROTECTED]
 Sent: 10 June 2003 16:50
 
 As for the line breaks, I've used SQL formatted that way before and it
 hasn't cause me any problems.

It's a matter of preference, but I prefer to keep my query strings as lean as possible 
-- bear in mind that this version:

 $sql = UPDATE newdacs
 SET emailfwd='$emailfwd',
 mformat='$mformat',
 filter_code='$filter_code';

will include not only the linebreaks but also all the leading whitespace on every line.

Personally, I like the technique of breaking my query up logically onto multiple 
lines, but I also prefer not to include unnecessary whitespace in the constructed 
query.  In addition, it seems to me that the repetitive inclusion of $sql .=  on 
every line is not only distracting but also slightly inefficient, as you perform a 
concatenation and assignment for every line -- by using the form I showed in my 
previous response, you can reduce this to just a concatenation per line, and a single 
assignment:

$sql = UPDATE newdacs
  . SET emailfwd='$emailfwd',
  . mformat='$mformat',
  . filter_code='$filter_code';

Of course, this is all completely IMHO, and I wouldn't say that any of the other ways 
of doing it is absolutely wrong.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] while - if - problem

2003-06-05 Thread Ford, Mike [LSS]
 -Original Message-
 From: Earl [mailto:[EMAIL PROTECTED]
 Sent: 04 June 2003 22:04
 To: PHP-DB
 
 FYI
 this was beginning to bug me out... so I decided to try the 
 trim function
 and walla... it worked.
 
 Thanks for ya'll assistance.

I was going to say this even before you added the trim() calls in , but this
really does look like an excellent situation for using the switch construct
(just look at all those trim() calls and array accesses you save!):


while($cols=ifx_fetch_row($eventQuery)) 
{
  switch (trim($cols['out_type']))
  {
case '0': 
  $r_away['linetype']='L';
  $r_home['linetype']='L';
  break;
  
case '1':
  $r_away['linetype']='H';
  $r_home['linetype']='H';
  break;
  }
  
  switch (trim($cols[s_acro]))
  {
case 'CF':
case 'PF': 
  $r_away['sport']='1';
  $r_home['sport']='1';
  $s_lt='PS';
  $t_lt='TP';
  break;

case 'PB':
case 'CB':
  $r_away['sport']='2';
  $r_home['sport']='2';
  $s_lt='PS';
  $t_lt='TP';
  break;

case 'B':
  $r_away['sport']='3';
  $r_home['sport']='3';
  $s_lt='ML';
  $t_lt='TM';
  break;
   
case 'H':
  $r_away['sport']='4';
  $r_home['sport']='4';
  $s_lt='ML';
  $t_lt='TM';
  break;
  }

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Array Pointer

2003-06-04 Thread Ford, Mike [LSS]
 -Original Message-
 From: Ian Fingold [mailto:[EMAIL PROTECTED]
 Sent: 03 June 2003 16:58
 
 Ok I'm trying to write this function to up date some fields 
 in my database
 so i'm grabbing some info from a query and throwing it into 
 an array (with
 mysql_fetch_array).
 
 one of the values i'm puting into that array is the table id. I'm then
 comparing the table id with the value of $i in my loop. Now 
 my problem is
 when I loop through and the table id is not equal to $i I 
 need to add 1 to
 $i but I need to move the array pointer back one.
 
 In the code below I used prev() but i'm getting warnings 
 about the Passed
 variable is not an array.
 http://55yardline.cflmain.com/55main/2003/fantasy/tests/update.php
 
 I'm thinking that prev() must not view an array fetch from a 
 database the
 same or something. But what else can I use besides prev() to 
 rewind the
 pointer by 1?
 
 Thanks,
 
 
 ?php
 
 include function.php;
 connect1();
 
 //query roster database and put results into an array.
 $num1 = mysql_query(SELECT * FROM roster);
 $num2 = mysql_fetch_array($num1);
 //set i to zero
 $i = 0;
 
 //start loop to determine if $i matches the current roster id
 do {
   $i = $i + 1;
   if ($num2[ros_id] == $i) {
 //if a match is found, query the fan_roster database 
 where the play_id =
 $i
 //and put the results into a array
 $upd = mysql_query(SELECT * FROM fan_roster WHERE play_id='$i');
 $updr = mysql_fetch_array($upd);
 //loop through the passing field and add them up
 do {
 $passing = $passing + $updr[pass_yrd1];
 } while($updr = mysql_fetch_array($upd));
 
 //Print feedback
 echo Player:$i total Passing: $passing $updr[play_id]br;
 
 //update the roster table with the total $passing where ros_id=$i
 $upd1 = mysql_query(UPDATE roster SET pass_yrd='$passing' WHERE
 ros_id='$i');
 //reset passing for next loop
 $passing = 0;
   } else {
 //if there isn't a match, add 1 to $i
 $i = $i + 1;
 
 //print feedback
 echo $i no playerbr;
 
 //put the array pointer back one for next loop
 $num2 = prev($num2[ros_id];

(1) prev() takes an array as its argument, not an individual element, so prev($num2) 
would be syntactically correct (but I doubt it's what you really mean).
(2) anyway, this whole statement is pointless as you immediately do:

   }
 } while($num2 = mysql_fetch_array($num1));

Which promptly overwrites the value of $num2 you just put there!

What are you *really* trying to do?
 ?
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



RE: [PHP-DB] PHP sort from a database variable..?

2003-06-04 Thread Ford, Mike [LSS]
 -Original Message-
 From: heilo [mailto:[EMAIL PROTECTED]
 Sent: 03 June 2003 23:35
 
 sorry, needed some time to hack this one ::)
 
 as your print_r shows that you have to sort an array which 
 includes objects
 (in this case an ingress-class - whatever this is). i tried 
 to simulate your
 environement and endet up with this:

This looks a bit like a sledgehammer to crack a nut -- why not just use
usort, like this:

   function obj_date_compare($a, $b) {
  return strcmp($a-publisertLang, $b-publisertLang);
   }

   ...

   if($ingresser = array_merge($i1 ,$i2))
   {
  $ingresser = usort($ingresser, 'obj_date_compare');
  listIngresser($ingresser);
   }

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Multiple inserts revisited

2003-05-29 Thread Ford, Mike [LSS]
 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: 28 May 2003 23:38
 
 My other option, as I saw it, was to loop through the items, 
 appending value
 data to the query text with each iteration.  If that seems 
 cryptic, here's a
 basic idea of what I mean.
 
 ?
 $query = INSERT INTO specials VALUES (
 foreach ( $specials as $item ) {
 $query = substr_replace( $query, $item., , strlen( $query ) );
 }
 $query = substr_replace( $query, ), strlen( $query )-2 );
 ?
 
 If $specials was an array with the values spec1, spec2, and 
 spec3, the final
 value of $query would be:
 INSERT INTO specials VALUES (spec1, spec2, spec3)

I'm actually slightly dubious that this query *does* do what you want, but if you've 
double-checked it and it does, then this is a somewhat more compact way of producing 
it:

  $query = INSERT INTO specials VALUES ( . implode(',', $specials) . ')'

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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: deleting records using a checkbox

2003-03-21 Thread Ford, Mike [LSS]
 -Original Message-
 From: Paul Burney [mailto:[EMAIL PROTECTED]
 Sent: 20 March 2003 15:22
 
 on 3/20/03 1:45 AM, olinux at [EMAIL PROTECTED] appended the 
 following bits to
 my mbox:
 
  [ and ] are illegal characters. #javascript
 
 I'm coming into this a bit late, so I'm not sure exactly what 
 you wish to
 do.
 
 You can use JavaScript to refer to checkbox items in the format:
 
 document.forms[formindex].elements[elementindex].property

You can also use the form and element names in the brackets, so:

  document.forms[formname].elements[elementname].property

This is more human-friendly, and doesn't require you to change the index
number if you add or remove elements (or forms!).

However, if you prefer, you don't even need the .forms or .elements
parts.  Since, in JavaScript, *by definition*

  x.y === x[y]

if you have a form element defined as:

  form name=example ... 

  input type=checkbox name=delete ... /

   /form

you can refer to this as

   document.example.delete

or

   document.example[delete]

or

   document[example].delete

or

   document[example][delete]

And, of course, an obvious extension of this is that if the input element on
your form is:

  input type=checkbox name=delete[] ... /

you can refer to this as:

   document.example[delete[]]

This is just a basic recipe -- add your own ingredients, and mix and cook to
suit!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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: Does Php support Flash files ?

2003-03-20 Thread Ford, Mike [LSS]
 -Original Message-
 From: Matthew Moldvan [mailto:[EMAIL PROTECTED]
 Sent: 19 March 2003 18:32
 
 I am assuming English isn't your first language.
 
 Yes, fuck is definitely swearing, cursing, or whatever else 
 you would like
 to call it.  And yes, it is considered rude in our culture. :D

Not only rude, but, to someone of my age and upbringing, extremely offensive.  Even 
though it has become more commonly used over the 30 years since the one and only time 
I used it in the presence of my father, I still wince mentally every time I hear or 
see it.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Final Date Question :-)

2003-02-20 Thread Ford, Mike [LSS]
 -Original Message-
 From: Chris Payne [mailto:[EMAIL PROTECTED]]
 Sent: 20 February 2003 01:52
 
 OK here is a final date question.  It's complex (Atleast to 
 me :-( but i'm totally stumped.  Here's what I need to do.  
 Say September is Summer and October is winter, now getting 
 the dates for each month is easy.
 
 Now, say in September each day is worth $50 but in October 
 each day of the month is worth $70.
 
 Now finally, say you choose 2 days in September and 2 in 
 October (And this is what stumps the living crap out of me - 
 pardon les francais :-) the system has to know He chose 2 in 
 september so that's $100 in total, but hold on, wait a 
 minute, he chose 2 in october and these are worth $140 for 2 
 days) - so how can I get it to do that?  I know how to get it 
 to do the september, but finding that it ran into October and 
 that Octobers 2 days are worth more than septembers just 
 totally goes over my head :-(

Well, you must have a start date and an end date -- and you must be able to
work out in which season each one lies.  So check whether the start date is
in the same season as the end date -- if it is, all is hunky-dory; if not,
then you have to work out how many days are in each season, calculate the
subtotals for each group of days, and then add them back together to get a
grand total.

I would commend to you the construction mktime(12, 0, 0, 0, $month+1, $year)
for finding the timestamp for midday of the last day of $month in $year --
works even when $month represents December!  (Note: you need to watch out
for daylight savings timeshifts if appropriate; you may prefer to do all
your day-offset calculations using an appropriate time of day with
gmmktime() so as to eliminate DST shift vagaries entirely!)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] More help with mysql -- solved (bizarre)

2003-02-18 Thread Ford, Mike [LSS]
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 18 February 2003 08:26
 
 If I remove the '|| die' part from the mysql_query() 
 statement, it works
 fine. This is bizarre, but there it is.
 
 ie, if I have:
 
 $result = mysql_query(SELECT * FROM SOME_TABLE);
 
 it works.
 
 If I have:
 
 $result = mysql_query(SELECT * FROM SOME_TABLE) || die 
 (Unable to execute
 SQL query);
 
 it doesn't work. It gives me:  Supplied argument is not a valid MySQL
 result resource

The || and OR operators, although both doing a Boolean or, have different priorities, 
so:

  $result = mysql_query(...) or die(...);

is the same as

  ($result = mysql_query(...)) or die(...);

whilst

  $result = mysql_query(...) || die(...);

is the same as

  $result = (mysql_query(...) || die(...));

In the first case, the result of mysql_query() is assigned into $result, and if it 
returns FALSE the die() is performed.  In the second case, the result of applying the 
|| operator to the mysql_query() and the die() is assigned to $result; because PHP 
uses short-circuit evaluation, the die() is still only executed if mysql_query returns 
FALSE, but the || operator still returns a simple Boolean to be assigned to $result -- 
which, if the die() hasn't fired, must be TRUE (which PHP generally prints as 1).  QED.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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: problems with variables

2003-02-04 Thread Ford, Mike [LSS]
 -Original Message-
 From: Mark [mailto:[EMAIL PROTECTED]]
 Sent: 04 February 2003 14:38
 
 Just a quick correction... if the q part is static, I believe you
 should use $(q$i) rather than ${$q . $i} 

Well, actually, I think you want ${'q'.$i} -- or even ${q$i}

Cheers!

Mike

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

 --- [EMAIL PROTECTED] wrote:
  OK, now I get it:
  
  $input = 'input type=hidden name=q' . $i . ' value=' .
   ${$q . $i} . ' . \n;
  
  print($input);
  
  This one isn't well known so don't forget it!!  ;)
  
  Larry
  
  
  Marcel [EMAIL PROTECTED] wrote:
   Sorry, I see that I've got the a's and q's mixed up.
   I'll try to clarify it some more by giving an example with 2
  variables.
  
   $q1 = first_var;
   $q2 = second_var;
   for($i=1;$i=2;$i++)
   {
  echo input type=\hidden\ name=\q$i\ value=\$q$i\\n;
   }
   The output should now be:
   input type=hidden name=q1 value=first_var
   input type=hidden name=q2 value=\second_var
  
   Hope you can help me,
   Marcel
  
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 =
 Mark Weinstock
 [EMAIL PROTECTED]
 ***
 You can't demand something as a right unless you are 
 willing to fight to death to defend everyone else's right to 
 the same thing.
 -Stolen from the now-defunct Randy's Random mailing list.
 ***
 
 __
 Do you Yahoo!?
 Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
 http://mailplus.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




RE: [PHP-DB] getting client browser info

2003-01-20 Thread Ford, Mike [LSS]
 -Original Message-
 From: Mignon Hunter [mailto:[EMAIL PROTECTED]]
 Sent: 20 January 2003 16:32
 
 Question:  Why is it that from an IE client I get the following:
 
 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
 
 Why does it say mozilla ???

The clue here is in the next word: compatible -- that's Microsoft Internet Explorer 
(MSIE) 6.0 claiming it's compatible with Mozilla 4.0 browsers (of course, it's not, 
but that's MS for you!).

 
 Here's my code:
 
 Your are currently using: br
 ?printf ($_SERVER[HTTP_USER_AGENT]); ?br
 
 You are using : ?printf ($HTTP_USER_AGENT);? browser 
 
 
 btw - Both produce the same.  Is it because the apache webserver uses
 Mozilla in a default sort of way ???   hum .

Absolutely nothing to do with Apache -- it's just reporting what the user's browser is 
telling it.  They're the same because they *are* the same: $HTTP_USER_AGENT is the 
register_globals copy of the $_SERVER[] element.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] getting client browser info

2003-01-20 Thread Ford, Mike [LSS]
 -Original Message-
 From: Mignon Hunter [mailto:[EMAIL PROTECTED]]
 Sent: 20 January 2003 17:05
 
 Does anyone know of script or tutorial to point me to that can obtain
 client browser info, (got that part)
 
 but then using php, be able to use if statements to distinguish what
 they're using.  example msie 5.1 - netscape - aol...And act upon it.

Perhaps you might want to look at the get_browser() function: 
http://www.php.net/get-browser

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] getting client browser info

2003-01-20 Thread Ford, Mike [LSS]
 -Original Message-
 From: Mignon Hunter [mailto:[EMAIL PROTECTED]]
 Sent: 20 January 2003 18:40
 
 Ah, but I wasnt at a mozilla browser, I was accessing this 
 script from a
 ie browser client.

Let me repeat -- that was the IE browser *masquerading* as Mozilla-compatible.  ALL 
versions of IE do exactly the same -- you have to look at the end of the parenthesis 
following it to get the real version information (in this case, MSIE 6.0).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Concatenate two strings

2003-01-15 Thread Ford, Mike [LSS]
 -Original Message-
 From: Bruno Pereira [mailto:[EMAIL PROTECTED]]
 Sent: 15 January 2003 14:48
 
 How can i join two strings.
 My code is something like:
 $valor1=bruno;
 $valor2=Pereira;
 $valor=$valor1 +   + $valor2
 
 Can someone help me. Thanks.

http://www.php.net/manual/en/language.operators.string.php

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Sessions problems

2003-01-06 Thread Ford, Mike [LSS]
 -Original Message-
 From: Sabina Alejandr Schneider [mailto:[EMAIL PROTECTED]]
 Sent: 05 January 2003 20:17
 
 Hello everybody
 I was trying to use Sessions, but I had some problems. 
 
 I have an old version of the Apache, that comes with the 
 Red Hat 7.2.
 
 when executing this in my page:
 
 session_start();
 if(!isset($_SESSION['s_test'])){
 $_SESSION['s_prueba']=1;
 }
 
 There appear this in the page:
 Warning: Cannot send session cookie - headers already sent 
 by (output started at /var/www/html/prueba/index.php:8) in 
 /var/www/html/prueba/index.php on line 10

Well, the error message really says it all, it's just worded a bit opaquely!  
Basically, setting a cookie uses an HTTP header, and all HTTP headers have to be sent 
before your actual page content -- and the error message is saying that you can't send 
an HTTP header at line 10 of your script, because you started outputting your page 
content at line 8.

 Warning: Cannot send session cache limiter - headers 
 already sent (output started at 
 /var/www/html/prueba/index.php:8) in 
 /var/www/html/prueba/index.php on line 10

Same thing, but for a cache limiter header.

You need to re-order your script so that the header requests come before the start of 
real output.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Final question of the week :-)

2002-12-11 Thread Ford, Mike [LSS]
 -Original Message-
 From: Chris Payne [mailto:[EMAIL PROTECTED]]
 Sent: 10 December 2002 23:10
 
 I use the following code to collect date from multiple 
 tickboxes on my form:
 
 if (count($selection) = 1) {
 for ($i=0;$icount($selection);$i++) {
 
 echo $selection[$i];
 
 }};
 
 $selection is the ID number and passes fine, but what I need 
 it to do is
 query my DB via the above query displaying the results from 
 the multiple
 ID's, how can I do this from this array?  I know from a 
 single ID / string
 but not this way.

   $sql = 'SELECT ... WHERE id IN (' . implode(',' $selection) . ')';

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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: adding in arrays

2002-12-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: Martin Allan Jensen [mailto:[EMAIL PROTECTED]]
 Sent: 10 December 2002 12:41
 
 But, now i need to make another loop where it takes the key 
 [2000] and put's it into $year and takes the value 300 and 
 put it into $value
 Can you help me with it, am really not good at arrays.

Is this what you want:

   foreach ($array as $year=$value):
  // do stuff
   endforeach;

 
 Array ( [2000] = 300 [2002] = 740 [2003] = 200 [2004] = 
 150 [2005] = 250 ) 

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Global variables

2002-12-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: Jim [mailto:[EMAIL PROTECTED]]
 Sent: 10 December 2002 18:51
 
 Can I define a global variable in a function and then 
 successfully reference 
 it in the rest of the page?

Yes.

(Why didn't you just try it?)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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

2002-12-02 Thread Ford, Mike [LSS]
 -Original Message-
 From: Chris Barnes [mailto:[EMAIL PROTECTED]]
 Sent: 02 December 2002 02:14
 
 On Mon, 2002-12-02 at 02:43, John W. Holmes wrote:
  
  No, it shouldn't.
  
  So, the links are correct on one page, and they disappear 
 on the second
  page? Is there a reason you're passing the SID in the URL 
 and not using
  cookies? 
  
  Hmmm, found this in the manual. Maybe it applies?
  
  ---
  The constant SID can also be used to retrieve the current name and
  session id as a string suitable for adding to URLs. Note that SID is
  only defined if the client didn't sent the right cookie. See also
  Session handling. 
  ---
  
  You may have to call session_id() with the passed value of
  $_GET['PHPSESSID'] so that PHP knows what session to restart. 
  
  ---John Holmes...
  
 
 The reason I'm not using cookies is because i don't really know enough
 about them yet (i don't really know enough about sessions 
 either :p). Do
 you think it would be better for me to generate my own unique 
 number and
 set that in the cookie? Will i have to keep calling 
 SetCookie() on every
 page?
 
 One thing i should have mentioned in my previous email, even though it
 isn't that relevant i don't think, is that if i omit the SID constant
 from the URL string then PHP automatically appends the SID to the URL
 its self, but again it disappears after a link has been clicked.

All of the evidence you have presented, and especially this, suggests that
PHP is automatically using cookies to store the SID.  When this is the case,
you see the SID on the first page served by PHP (because it hasn't set the
cookie yet!), but on all subsequent pages it disappears and the SID is
propagated using a cookie.  You *can* configure this to work differently,
but, speaking purely personally, I don't see the point.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] RE: Access to Oracle db from PHP script

2002-11-28 Thread Ford, Mike [LSS]
Sorry, I think you'd be better off asking this on the php-db mailing list, so I've 
copied it into this reply -- I didn't set up the Oracle I connect to, and I just make 
use of connect functions written for the purpose by the Oracle expert on the next desk!

  I have find your e-mail at this link:
  http://marc.theaimsgroup.com/?l=php-dbm=103286983831446w=2

... which is in the archives of the php-db list, so why didn't you just post directly 
to the list?!

  Sorry for my english it is not good.
 
  I have this problmes.
 
  I have a script PHP to connect to Postgresql db. I attach 
 to my msg my
  script.
 
  I have to change the action of the PHP instaed to access to 
 Postgresql
  to oracle.
 
  The script work in the linux system RH and the Postgresql are in the
  same system.
 
  in the new platform Oracle are in the unix system and I 
 think, but I am
  not sure at this momement, it is install also the web server apache.
 
  I ask to you if yuo can explain in very sample english for 
 me how to do
  to make.
 
  Can you have same sample code to connect to Oracle db  for me.
 
  At this moment I do not know how it is the version of the 
 oracle but I
  think it is 8.i
 
  I hope do not trouble you and thanks for your help.
 
  Ciao franco
  www.infocamere.it


Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] HTML Forms question...

2002-11-19 Thread Ford, Mike [LSS]
 -Original Message-
 From: Rich Gray [mailto:[EMAIL PROTECTED]]
 Sent: 20 November 2002 01:13
 
 If you name the checkbox as name=system[] then PHP will 
 automatically
 create an array of the checkbox values which can be 
 subsequently accessed
 via $_POST['system'][n] - be warned however that the '[]' can 
 screw up any
 JavaScript code that refers to the checkbox object...

G' -- not this old chestnut again!

It only screws up your JavaScript if you don't write your JavaScript to
allow for it.

It's really very simple: *by* *definition* in JavaScript, the notation

a.b

is *identical* to

a[b]

Thus, if you have a single checkbox named with name=system, then you can
access it in either of these ways:

document.form.system
document.form[system]

By extension, if you have multiple checkboxes all named with
name=system[], you can refer to them as:

document.form[system[]][0]
document.form[system[]][1]
document.form[system[]][2]

etc...

I know this works because I've been using it for years (even before I
started programming with PHP!).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Passing multiple form variable in PHP

2002-11-12 Thread Ford, Mike [LSS]
 -Original Message-
 From: Stephen Rhodes [mailto:stephen.rhodes;scils.co.uk]
 Sent: 12 November 2002 16:32
 
 Wanting to use select multiple ...  in a html form and pass 
 multiple value
 into a php variable but does
 not work. I only get a single value. Can you tell me what I 
 am doing wrong
 ?

You're not telling PHP to expect multiple values -- this is done by putting array 
brackets [] on the end of the field name.

 
 Does the multiple value get passed correctly in php 

Yes.

 select multiple name=icon

Needs to be:

  select multiple name=icon[]

and $_POST['icon'] will be an array of the selected values.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] losing my session variables

2002-10-30 Thread Ford, Mike [LSS]
 -Original Message-
 From: Peter Beckman [mailto:beckman;purplecow.com]
 Sent: 30 October 2002 04:09
 To: Seabird
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] losing my session variables
 
 
 Put session_start() somewhere in your code.

.. but make sure that somewhere is before you do any real output to your page!

 $_SESSION isn't set until you start your session.
 
 And don't set session variables by $_SESSION[foo] = bar;
 
 DO this:
 
 $foo = bar;
 session_register(foo);
 
 Much better.

No -- this is fraught with problems in current releases of PHP (most, if not all, of 
which will be fixed in 4.3).  Most particularly, the following caution appears at 
http://www.php.net/manual/en/ref.session.php:

  If you are using $_SESSION and disable register_globals, do not use 
session_register(), session_is_registered() and session_unregister(), if your scripts 
shall work in PHP 4.2 and earlier.

Since the default for 4.2.x is register_globals=off, this is a very pertinent warning!

Even with register_globals=on, there are other problems which make it best to stick to 
manipulating the values in $_SESSION directly, rather than using the equivalent 
global variables.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Oracle problem

2002-10-16 Thread Ford, Mike [LSS]

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 16 October 2002 08:51
 To: [EMAIL PROTECTED]
 
 Has anyone out there using PHP and Oracle come across this 
 problem?  I have
 a text area that allows free-form text that I store in a 
 varchar2 column.  I
 have problems with apostrophes in the free-form text.

Uh-oh!  Standard can of worms no. 3!

  When 
 users put in an
 apostrophe the SQL fails.  If I force 3 apostrophes (the 

Shouldn't that be *two* apostrophes?  That's how it works here, anyway!

 usual Oracle method
 of embedding apostrophes) the SQL fails.  The only way to get 
 round the
 problem is to strip them out (which I consider a work-around 
 not a fix).

You may also want to investigate the php.ini settings magic_quotes_gpc, 
magic_quotes_runtime and magic_quotes_sybase -- although personally I prefer not to 
use these as I'm averse to magic (well, other people's, anyway!).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] echo printing a cookie

2002-10-15 Thread Ford, Mike [LSS]

 -Original Message-
 From: Steve Dodkins [mailto:[EMAIL PROTECTED]]
 Sent: 15 October 2002 14:22
 To: Php-Db (E-mail)
 
 Hi I'm trying to print the contents of a cookie (php 4.2.3) 
 the syntax below
 is wrong but what should it be?
 
 if ($_cookie[cookiename]== TRUE) {
 echopyour cookie is $_COOKIE[cookiename]/p;
 }

  if (isset($_COOKIE['cookiename'])) {
echo pyour cookie is {$_COOKIE['cookiename']}/p;
  }

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Session understanding

2002-09-26 Thread Ford, Mike [LSS]

 -Original Message-
 From: Griffiths, Daniel [mailto:[EMAIL PROTECTED]]
 Sent: 26 September 2002 16:09
 
 as long as that same session code is present at the top of 
 all the included files that are  put in later. basicaly you 
 need to put the session code in every page (even if you only 
 intend use it as an include) you wish to protect otherwise 
 its contents can be read by directly typing in the url in the 
 same way that you can read included .js and .css files.

... and this is precisely why all your include files should be in directories which 
are not servable by your Web server -- if your Web server can't serve them, then they 
can't be accidentally served by someone typing their URL in directly, because they 
don't have a URL!

Personally, I don't put *any* files with live code in http-servable directories.  All 
of my PHP scripts that Apache can serve as top-level scripts look pretty much like 
this:

?php
   ini_set('include_path', '../../dir-not-in-http-space/include');
   require 'the_real_script.php';
?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Current row of query

2002-09-26 Thread Ford, Mike [LSS]

 -Original Message-
 From: Patrick Lebon [mailto:[EMAIL PROTECTED]]
 Sent: 26 September 2002 16:20
 
 This is how im currently doing it...
 
  $rowNum = 0;
  while ( $row = mysql_fetch_array($result) )
  {
  $rowNum++;
  if ($rowNum % 2) { $bgCol = #EADBC6; } else { $bgCol = #EFE1CE; }
 echo ..;
 }

Looks like a good 'un to me, although I wonder why you're incrementing
$rowNum and then doing a separate access to it, when the ++ operator is
designed precisely to avoid the need for this; the following is identical in
functionality to the above:

  $rowNum = 0;
  while ( $row = mysql_fetch_array($result) )
  {
if ($rowNum++ % 2) { $bgCol = #EADBC6; } else { $bgCol = #EFE1CE; }
echo ..;
  }

And, having got this far, I'd probably then go on to rewrite the if line
using the ?: operator instead:

$bgCol = ($rowNum++ % 2) ? #EADBC6 : #EFE1CE;

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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/PHP dropping characters

2002-09-24 Thread Ford, Mike [LSS]

 -Original Message-
 From: Micah Stevens [mailto:[EMAIL PROTECTED]]
 Sent: 23 September 2002 18:09
 
 I've been running into a strange problem on my server with 
 scripts that 
 take form input and reformat it into SQL. It only happens 
 with statements 
 that insert or update data, the first four characters of the 
 POST variables 
 starting at the fourth variable passed are dropped.

There are several bug reports at http://bugs.php.net for this -- basically, it seems 
to be related to transparent multi-byte string encoding (or something like that).  If 
you don't need that support, you should turn it off -- search the bug database for the 
appropriate bugs, which will give you more information than my brain can!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] getting mysql_fetch_row into array

2002-09-24 Thread Ford, Mike [LSS]

 -Original Message-
 From: LSC Exhibits Department [mailto:[EMAIL PROTECTED]]
 Sent: 23 September 2002 18:17
 
 Going through brain-lock here. From this query Select 
 count(deptid) from
 maintenance group by deptid ,I get 11 rows. What I need to 
 do is get an
 array like $a=array(315,11,43,67,415,32,25,63,93,46,76) from 
 this query, so
 that 
 $a[0]=315
 $a[1]=11
 $a[2]=43 
 and so on. The best I can get is ;
 $a[0][0]=315
 $a[0][1]=11
 $a[0][2]=43 and so on. Does anyone have any ideas???

Won't that do?  If you don't want to refer to it using the additional first
subscript every time, just create a reference to it:

   $b = $a[0];

then $b[$x] is the same as $a[0][$x].

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Oracle connection problem after call to unserialize()

2002-09-24 Thread Ford, Mike [LSS]

 -Original Message-
 From: Valantis Kamayiannis [mailto:[EMAIL PROTECTED]]
 Sent: 24 September 2002 12:37
 
 I made a class called OracleCon that is used to connect to an 
 Oracle server
 and provide some certain queries to the database
 When i create an object of that class and serialize it to add it to a
 cookie, if i echo the $object-connection attribute i get a 
 Resource id #2
 
 When after redirection due to succefull login, i need to use 
 this object to
 run the queries i get an error like this:
 
 Warning: ociparse(): supplied argument is not a valid OCI8-Connection
 resource in c:\program files\apache 
 group\apache\htdocs\php\OracleCon.inc on
 line 66
 
 What is wrong with this?

You can't carry a connection resource from one page to another -- you have
to script an OCILogon (or OCIPLogon) in every page that needs to access your
database.  (This is true not just for Oracle -- all the databases supported
in PHP that I've looked at work the same way.)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Retrieving a date from Oracle. Please help!

2002-05-23 Thread Ford, Mike [LSS]

 -Original Message-
 From: maxim [mailto:[EMAIL PROTECTED]]
 Sent: 23 May 2002 17:00
 
 Hi all!
 The problem is I can't get expected datetime value from 
 SELECT query on
 Oracle table that has a field of type DATE. Seems like 
 datetime looses its
 time part.

The default format for dates returned from Oracle tends to be something like 
'DD-MON-YY', thus giving only a short-form date.  There are several ways of changing 
this:

  * Use the TO_DATE function in your select, e.g.
$sql = select TO_DATE(A_DATE, 'DD-Mon- HH24:MI:SS') as DATE_TIME from 
A_TABLE

  * Use ALTER SESSION to set the default format for the current session (NOTE: I 
haven't tried this (yet!)):
$stmt = OCIParse(ALTER SESSION SET NLS_DATE_FORMAT = 'DD-Mon- HH24:MI');
OCIExecute($stmt);

  * Change the default value of the Oracle initialization parameter NLS_DATE_FORMAT (I 
haven't tried this either, as I don't have administrative control of my Oracle 
database!).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Retrieving a date from Oracle. Please help!

2002-05-23 Thread Ford, Mike [LSS]

 -Original Message-
 From: maxim [mailto:[EMAIL PROTECTED]]
 Sent: 23 May 2002 17:00
 
 Hi all!
 The problem is I can't get expected datetime value from 
 SELECT query on
 Oracle table that has a field of type DATE. Seems like 
 datetime looses its
 time part.

The default format for dates returned from Oracle tends to be something like 
'DD-MON-YY', thus giving only a short-form date.  There are several ways of changing 
this:

  * Use the TO_DATE function in your select, e.g.
$sql = select TO_DATE(A_DATE, 'DD-Mon- HH24:MI:SS') as DATE_TIME from 
A_TABLE

  * Use ALTER SESSION to set the default format for the current session (NOTE: I 
haven't tried this (yet!)):
$stmt = OCIParse(ALTER SESSION SET NLS_DATE_FORMAT = 'DD-Mon- HH24:MI');
OCIExecute($stmt);

  * Change the default value of the Oracle initialization parameter NLS_DATE_FORMAT (I 
haven't tried this either, as I don't have administrative control of my Oracle 
database!).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Using OCI, can I retrieve multiple values from DELETE/UPDATE RETURNING?

2002-05-01 Thread Ford, Mike [LSS]

Using the Oracle OCI interface, as far as I can see if I do the following:

$stmt = OCIParse($conn, 'DELETE FROM TITLES'
   . ' WHERE TAG0'
   . ' RETURNING ID INTO :T_ID');

there seems to be no way of picking up more than one ID when multiple rows are 
deleted.  The obvious

   OCIBindByName($stmt, ':T_ID', $t_id, 10);

only returns one ID, and not an array of IDs as I might have expected.  No other 
method I can think of is able to return even that!  (Including any OCIFetch variation, 
which doesn't surprise me as they're labelled as being for SELECT results only!)

I would be very grateful for any suggestions of how to do this, or confirmation that 
it can't be done (in which case I'll submit a Feature/Change request to ask for it!).

It seems ridiculous that I should have to do a SELECT/DELETE pair, when Oracle 
provides such a useful feature to get the same result in a single statement.

Cheers!

Mike


Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Beckett Park
Tel: extn 4730Fax: extn 3211 

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




RE: [PHP-DB] Re: Array not supported for strings???

2002-01-08 Thread Ford, Mike [LSS]

 -Original Message-
 From: Andy [mailto:[EMAIL PROTECTED]]
 Sent: 04 January 2002 20:24
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: Array not supported for strings???
 
 $stmt= 
   SELECT country
   from  $DB2.$geo_T1
   where country_code = '$country_id[$i]'
  ;

Well, this should be

where country_code = '${country_id[$i]}'

to be sure of doing what you want.

  This code:
  $country[] = $row-country;
 
  Creates following error msg:
Fatal error: [] operator not supported for strings

Is this error coming from PHP or your database?  And does it definitely refer to this 
particular line?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Oracle date conversion

2002-01-08 Thread Ford, Mike [LSS]

 -Original Message-
 From: David C. Norris [mailto:[EMAIL PROTECTED]]
 Sent: 26 December 2001 17:00
 
 Oracle DATEs are retrieved (by ora_fetch_into($cursor, $row,
 ORA_FETCHINTO_NULLS), for example) as plain dates (e.g., '26-DEC-01'),
 losing the time of day (as in '26-DEC-01 12:34:56').  Is this 
 a bug?

No, this is the default ORACLE format for retrieved dates.

  Is
 there a workaround that doesn't involve rewriting the query?

No, but modifying the query to use a date format is actually the best solution.  This 
would give you something like:

SELECT TO_CHAR(DATE, 'DD-MON-YY HH:MI:SS') AS DATE_TIME FROM TBL

Look up the definition of the TO_CHAR function for the full list of format elements 
available for formatting DATEs.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] oracle connectivity problem

2002-01-08 Thread Ford, Mike [LSS]

 -Original Message-
 From: Rajiv Khandelwal [mailto:[EMAIL PROTECTED]]
 Sent: 27 December 2001 10:59
 
 hi,
  I am facing a strange problem.
  I have oracle 8.1.6 (server) installed on linux and am 
 trying to access
 it thru PHP from a client machine (again Linux).
 I was successful in making connections to the Oracle Server through
 programs written in C and Perl. But everytime i execute some program
 written in PHP it throws back an error.
 
 Fatal error: Call to undefined function: ocilogon() in
 /usr/local/apache/htdocs/test.php 
 
 in test.php i am calling ocilogon as:
 ocilogon (scott,tiger,$db);
 
 I have installed PHP with oracle support.
 phpinfo() shows that oracle support is enabled and it identifies
 ORACLE_HOME and ORACLE_SID.

Have you installed Oracle 8 support (--with-oci8), which gives you the OCI functions, 
or only the older Oracle support (--with-oracle) which gives you the ORA_ series of 
functions?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] mysql_num_rows

2002-01-08 Thread Ford, Mike [LSS]

 -Original Message-
 From: Gurhan Ozen [mailto:[EMAIL PROTECTED]]
 Sent: 06 January 2002 20:10
 
 I am pretty sure that the query is correct. here is the actual query:
   $query=select  distinct(nodeid), nodename  
 from books where
 bookid=$bookid;
   $result=mysql_query($query);
   $num_results=mysql_num_rows($result);
 
snip
   The funny thing is that if i write the same query without where
 bookid=$bookid then the mysql_num_rows works but with where 
 statement it
 doesn't.

Have you echoed $result to see what it contains?  My guess is that it contains 
something unexpected which, when inserted into the query, causes it to fail (or at 
least return no rows!).  Otherwise, I can see no reason for the addition of the WHERE 
clause to cause this error.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] mysql_num_rows

2002-01-08 Thread Ford, Mike [LSS]

  -Original Message-
  From: Gurhan Ozen [mailto:[EMAIL PROTECTED]]
  Sent: 06 January 2002 20:10
  
  I am pretty sure that the query is correct. here is the 
 actual query:
  $query=select  distinct(nodeid), nodename  
  from books where
  bookid=$bookid;
  $result=mysql_query($query);
  $num_results=mysql_num_rows($result);
  
 snip
The funny thing is that if i write the same query without where
  bookid=$bookid then the mysql_num_rows works but with where 
  statement it
  doesn't.
 
 Have you echoed $result to see what it contains?  My guess is 

Sorry, that should be $bookid...!!

 that it contains something unexpected which, when inserted 
 into the query, causes it to fail (or at least return no 
 rows!).  Otherwise, I can see no reason for the addition of 
 the WHERE clause to cause this error.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] mysql_num_rows

2002-01-08 Thread Ford, Mike [LSS]

 -Original Message-
 From: matt stewart [mailto:[EMAIL PROTECTED]]
 Sent: 08 January 2002 14:10
 
 don't know if this makes a difference, but i've always used 
 WHERE bookid =
 '$bookid'; - single quote round the $bookid variable - not 
 sure if that's
 the problem, or if it's just good practice?

Depends on whether $bookid is a string or a number.  If your id values are always 
numeric, there's really no point in quoting them in the query.  On the other hand, if 
they can be strings it's pretty vital to quote them!!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]