RE: [PHP-DB] variables gone?

2002-05-29 Thread Mark Roedel


Beginning in PHP 4.2.0, the normal behavior with respect to preloaded
variables was changed (specifically, the default value of the
register_globals configuration entry was changed from on to off).

For details, see
http://www.php.net/manual/en/language.variables.predefined.php


---
Mark Roedel   | Blessed is he who has learned to laugh
Systems Programmer|  at himself, for he shall never cease
LeTourneau University |  to be entertained.
Longview, Texas, USA  |  -- John Powell


 -Original Message-
 From: Rob Fraser [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, May 29, 2002 8:49 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] variables gone?
 
 
 I am probably doing something silly but I don't know what (story of
 my life). I have just upgraded to 4.2.1 and now all the variables I
 post in forms or in query strings are now coming up undefined errors 
 and are in absent. I'm running PHP under IIS 4.

 What am I doing wrong?

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




RE: [PHP-DB] Informix + PHP any gotcha's to watch out for?

2001-10-23 Thread Mark Roedel

 -Original Message-
 From: davemacgb [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, October 22, 2001 12:12 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Informix + PHP any gotcha's to watch out for?
 
 
 I've only used MySQL via PHP until now, does anyone know of 
 any gotchas that I should watch out for?
 
 The web site will hopefully run on Linux using Apache and PHP.

A few things that I've run into so far:

Make sure that your INFORMIXDIR environment variable is set.  Apache
would segfault on my systems when I tried to use any of the informix
functions otherwise.  I added a line to my apachectl script just to be
sure.

Ifx_connect() doesn't take quite the same parameters as mysql_connect().
The server you're connecting to is specified via either the
INFORMIXSERVER environment variable or one of the ifx default settings
in your php.ini.  (In either case, it's a pointer to an entry in your
INFORMIXDIR/etc/sqlhosts, not a hostname.)  Ifx_connect() also expects
the database name that you're connecting to.

Obviously, in light of the above, there is no ifx_select_db().

Ifx_num_rows() doesn't do the same thing as mysql_num_rows().  It counts
the number of rows that you've viewed from the result set, not the total
number of rows returned.

If you use mysql_fetch_array(), the equivalent Informix function is
ifx_fetch_row().


---
Mark Roedel |  Blessed is he who has learned to laugh
Systems Programmer  |   at himself, for he shall never cease
LeTourneau University   |   to be entertained.
Longview, Texas, USA|   -- John Powell 

--
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] Bug in new PHP Version?

2001-10-04 Thread Mark Roedel

 -Original Message-
 From: Luditus [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, October 03, 2001 3:13 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Bug in new PHP Version?
 
 
 I just downloaded the new 4.06 PHP Version and installed it on a new
 machine.
 
 My application does not work properly anymore, nor does mysqladmin.
 
 This are some warnings:

 [snip]
 
 Does anybody have an idea?

You don't say what version you were upgrading from, but if you jumped
forward a few versions, I believe there was a change in the default
value of the error_reporting configuration option that'd result in the
display of more non-fatal warning messages (things like the unitialized
variable message you posted).

Note that, for the most part, your application should still behave the
way it did before (except for the printing of those messages).  I didn't
see anything in either of the messages you posted that appeared to
indicate a change in functionality...do you have some reason to believe
that things aren't working the same behind the scenes as they did
before?


---
Mark Roedel |  Blessed is he who has learned to laugh
Systems Programmer  |   at himself, for he shall never cease
LeTourneau University   |   to be entertained.
Longview, Texas, USA|   -- John Powell 

--
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] PHP vs. 2 database softwares

2001-10-01 Thread Mark Roedel

 -Original Message-
 From: Scott Fletcher [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, October 01, 2001 11:11 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] PHP vs. 2 database softwares
 
 
 I found that PHP can be compiled and work with only one
 database software.  You won't be able to have PHP to work
 with 2 seperate database softwares.  (You can compile it
 but it will work only with one databse software, not both,
 no matter what).  

For the record,

I've successfully built PHP to work with MySQL, Informix, and
Sybase/MSSQL and am able to successfully use all three -- even within
the same script when it's called for.

What's the error message you get when you try to build with multiple
DB's supported?


---
Mark Roedel   | Blessed is he who has learned to laugh
Systems Programmer|  at himself, for he shall never cease
LeTourneau University |  to be entertained.
Longview, Texas, USA  |  -- John Powell 

--
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] MSSQL error codes :/

2001-10-01 Thread Mark Roedel

 -Original Message-
 From: Charles Butler [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, October 01, 2001 12:56 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] MSSQL error codes :/
 
 
 I'm getting funky error codes, even with doing 
 addslashes($variable); but its not escaping the
 's, I have even resorted to str_replace() and 
 still nothing
 
 below is error output.
 Warning: MS SQL message: Line 1: Incorrect syntax near 'b'. 
 (severity 15) in 
 \jtron\home\admin\functions.php on line 82
 
 Warning: MS SQL message: Unclosed quotation mark before
 the character string ')'. (severity 15) in
 \jtron\home\admin\functions.php on line 82
 
 Warning: MS SQL: Query failed in 
 \jtron\home\admin\functions.php on line 
 82

I posted in another thread earlier today that the Sybase database engine
likes to have a single quote escaped by another single quote, not by a
slash.

Perhaps this is a case where MSSQL is showing its Sybase roots...do you
get the same errors if you change \' to ''?


---
Mark Roedel |  Blessed is he who has learned to laugh
Systems Programmer  |   at himself, for he shall never cease
LeTourneau University   |   to be entertained.
Longview, Texas, USA|   -- John Powell 

--
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] MS SQL 6.5 connection

2001-08-07 Thread Mark Roedel

 -Original Message-
 From: Sommai Fongnamthip [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 07, 2001 4:00 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] MS SQL 6.5 connection
 
 
 I've been setting PHP 4.0.6 with apache 1.3.20 in Linux 
 Red Hat 6.2 to connect MS SQL 6.5 via TDS4.2 (freetds-0.51). 

Have you tried editing the PWD file in your FreeTDS directory and
running 'make check' to verify that everything's behaving normally
there?

Is your SYBASE environment variable set correctly, so that PHP can find
your interfaces file?  (Check the output of a phpinfo() call to verify
that...)

 here my code in php

 ?
 
 $conn = SQLSERVER;   // host or connection name in 
 /usr/local/freetds/interf$
 $myuser = sa;
 $mypass = ;
 
 $dbc=mssql_connect($conn, $myuser, $mypass) or die (Unable 
 to connect MS SQL);

Does mssql_get_last_message() say anything interesting when this line
fails?  


---
Mark Roedel ([EMAIL PROTECTED]) | There cannot be a crisis next week.
Systems Programmer / WebMaster |  My schedule is already full.
 LeTourneau University |   -- Henry Kissinger 

--
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] ms sql connect

2001-08-06 Thread Mark Roedel

 -Original Message-
 From: Sommai Fongnamthip [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 06, 2001 2:45 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] ms sql connect
 
 
 Hello,
 I'd like to use MS SQL 6.5 on NT from PHP-4.0.6 from Linux. 
 I was config FreeTDS (use ver 4.2) and setup interfaces file 
 already.  I'm still cannot login to MS SQL 6.5.

 [snip]

  interface file in /usr/local/freetds
  myserver
  query tcp tds4.2 127.0.0.1 1433
  master tcp tds4.2 127.0.0.1 1433

Is '127.0.0.1' actually what you have in your file, or is that just a
placeholder because you don't want to give out the real IP?  (If that's
actually what's in the file, then FreeTDS will be trying to connect to a
copy of MS SQL Server running on your Linux box, which seems like sort
of a futile exercise.  Try changing it to the IP of the NT machine.)


---
Mark Roedel   | The most overlooked advantage to owning a
Systems Programmer|  computer is that if they foul up there's no
LeTourneau University |  law against whacking them around a little.
Longview, Texas, USA  |  -- Owen Porterfield 

--
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] Re: Making a new row in HTML tables

2001-07-25 Thread Mark Roedel

 -Original Message-
 From: Ian Grant [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 25, 2001 11:28 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: Making a new row in HTML tables
 
 
 Yeah, but if I had 31,
 I'd want 6x5 and then 1 over, or something

What about 16?  2x8, 4x4, or 8x2?  And how would we decide which?
Would 34 be 2x17, or 6x5 with 4 over?
 
I'm with Hugh...unless you can define more clearly the rules you want
this thing to operate under, the easiest thing is probably going to be
to just pick a standard width and pad the last row.  If you wanted to
define special exceptions for total counts less than some arbitrary
number (30?), that ought to be simple enough to do manually.  Something
like...

   switch ($picture count) {
.
.
.
 case 4: $row_width=2; break;
 case 6: $row_width=3; break;
 case 8: $row_width=4; break;
 case 9: $row_width=3; break;
 default: $row_width=6;
   }

should do the trick.


---
Mark Roedel   | The most overlooked advantage to owning a
Systems Programmer|  computer is that if they foul up there's no
LeTourneau University |  law against whacking them around a little.
Longview, Texas, USA  |  -- Owen Porterfield 

 
 Hugh Bothwell [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Umm... 31 entries, 1 x 31...
 
  You might be better to choose a standard width and pad the 
 last row with
  empty cells.
 
  Ian Grant [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hi,
  
   Can anyone help me with this - I have a database of 
 people, that I want
 to
   print into an HTML table - how can I make the table wrap 
 into an equal
   number of rows.
   i.e. if there are 4 entries, a 2x2 table, 6 a 2x3, 8 a 
 2x4, 9 a 3x3,
 etc.
 

--
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] Production: Linux/Apache/PHP -- FreeTDS -- W2K/MSSQL 7.0

2001-07-12 Thread Mark Roedel

 -Original Message-
 From: E. Peter K. Chan [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 11, 2001 11:32 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Production: Linux/Apache/PHP -- FreeTDS --
 W2K/MSSQL 7.0
 
 
 When I switch to production I intend to use: Linux/Apache/PHP 
 -- FreeTDS -- W2K/MSSQL7.0

I'm currently using this combination (except with FreeBSD instead of
Linux).
 
 I am particularly concerned about the mssql_next_result 
 function (such a function doesn't exist for Sybase and I
 don't know enough about how FreeTDS works).

The mssql functions that get enabled by the FreeTDS library are
specified as aliases for the equivalent sybase functions in
$PHPDIR/ext/sybase/php_sybase_db.c.  It doesn't look like
mssql_next_result is among those that have an equivalent, so it's not
included.  (The ones that exist are: mssql_connect, mssql_pconnect,
mssql_close, mssql_select_db, mssql_query, mssql_free_result,
mssql_get_last_message, mssql_num_rows, mssql_num_fields,
mssql_fetch_row, mssql_fetch_array, mssql_fetch_object, mssql_data_seek,
mssql_fetch_field, mssql_field_seek, mssql_result, mssql_affected_rows,
mssql_min_error_severity, and mssql_min_message_severity.)


---
Mark Roedel   | The most overlooked advantage to owning a
Systems Programmer|  computer is that if they foul up there's no
LeTourneau University |  law against whacking them around a little.
Longview, Texas, USA  |  -- Owen Porterfield 

--
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] Random Password Generation/MSSQL

2001-07-12 Thread Mark Roedel

 -Original Message-
 From: Ryan Marrs [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 12, 2001 1:54 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Random Password Generation/MSSQL
 
 
 Having an issue with this script, the generator works if I 
 just echo out the password, however when I attempt to update
 the table, it times-out in IIS.  I've bumped the IIS Timeout
 up to over 20 minutes, and it still times out.  This is on a
 database with approximately 29,000 entries.  Any ideas?

 [snip]

 for($i=1;$i=$count;$i++){
 $DUNSNumber=$row-DUNSNumber;
 
 echo rand_pass().br;

I bet if you 

  echo $insertquery

right here, you won't see what you were expecting to.  (Hint: $password
and $DUNSNumber aren't set when you give $insertquery its value; neither
is the string updated for each iteration of this loop.)

 MSSQL_QUERY($insertquery);
 }

Perhaps that's not the entire problem, but it can't be helping...if
nothing else, once that's corrected maybe you can start looking at doing
those updates in smaller batches.  20 minutes does seem a bit extreme,
but then it's hard to make much of a judgment on that without knowing
more about the machine in question, what else it's being used for
besides sql services, how heavily it's being utilized, etc.


---
Mark Roedel   | Nothing in life is so bad that it cannot be
Systems Programmer|   made much, much worse by the addition of
LeTourneau University |lots of spikes and razors.
Longview, Texas, USA  |-- Sean Kozma 

--
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_query returns nothing?

2001-07-05 Thread Mark Roedel

 -Original Message-
 From: Stefan Siefert [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 04, 2001 9:07 AM
 To: PHP Mailingliste
 Subject: [PHP-DB] mysql_query returns nothing?
 
 
 Hm, since we are using PHP 4.0.6 we do get sometimes no
 returnvalue...(function mysql_query) I think, this is always 
 then, when we are executing update oder delete syntax hm,
 does anyone know anything about it?

Does mysql_error() tell you anything interesting in those cases?  (A
zero/false result from a mysql_query usually means either a syntax error
in the query or a problem with your database access or connection.)


---
Mark Roedel ([EMAIL PROTECTED])  ||  There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full.
 LeTourneau University  ||-- Henry Kissinger


--
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 Error???

2001-06-28 Thread Mark Roedel

 -Original Message-
 From: Brian Grayless [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 27, 2001 11:24 AM
 To: PHP DB list (E-mail)
 Subject: [PHP-DB] MySQL Error???
 
 
 Is anyone familiar with this MySQL error?
 
 1062: Duplicate entry '127' for key 1
 I wrote a great bookmark management program that works fine, 
 but everytime I insert bookmarks, I insert somewhere over 120
 and I start getting this error, and it won't add them anymore. 
 Any suggestions???

The error message is telling you that you have a key field defined
(that is, a field that must uniquely identify a row in your database),
and that you're trying to insert a row that has a value in that field
that you've already used.

Given that everything seems to work until you get to 127, I'd venture to
guess that it might be an autoincrement column of type 'tinyint'.  If
that's the case, consider changing it to a type with a higher capacity
(see http://www.mysql.com/doc/C/o/Column_types.html for more
information).  If not, then perhaps we might be able to provide more
useful suggestions if you could give a little more information about
your database structure and the source for the part of the program
that's causing problems...


---
Mark Roedel ([EMAIL PROTECTED]) | There cannot be a crisis next week.
Systems Programmer / WebMaster |  My schedule is already full.
 LeTourneau University |   -- Henry Kissinger 

--
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] Is MySQL in 4.0.6?

2001-06-26 Thread Mark Roedel

 -Original Message-
 From: Adam Lundrigan [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 25, 2001 5:46 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Is MySQL in 4.0.6?
 
 
 Is MySQL included in the 406kb version of PHP 4.0.6?
 When I try to connect to MySQL (after adding localhost  
 paswords to php.ini) using this version it says:
 Warning: Can't connect to MySQL server on 'localhost' (10061) 
 in mysql_local_test.php on line 2

If that's the message you're getting, that would indicate to me that

(1) your copy of PHP *does* include the MySQL client functionality, and

(2) it isn't successfully connecting to a MySQL server.

 From what i've heard, MySQL is included in PHPbut why 
 doesn't the connect work if it is included?

Do you actually have a MySQL server running?


---
Mark Roedel ([EMAIL PROTECTED])  ||  There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full.
 LeTourneau University  ||-- Henry Kissinger


--
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] Informix question

2001-06-22 Thread Mark Roedel

 -Original Message-
 From: Bård Farstad [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 19, 2001 11:45 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Informix question
 
 
 I'm writing an application which uses the PHP interface to 
 informix. I'm having trouble with newlines in char/varchar
 or lvarchar fields.
 
 How can I store newlines (\n) to an informix database without 
 using blobs?

I just got back from a conference for some software we use that's
Informix-driven, and it was mentioned in one of the sessions that
there's a setting to enable this *if* you're using Informix 11.x (we're
still on 9.x here).

The speaker didn't know the setting off the top of his head, but
indicated it was in Informix's online documentation, searchable at

http://www.informix.com/answers/


---
Mark Roedel ([EMAIL PROTECTED])  ||  There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full.
 LeTourneau University  ||-- Henry Kissinger


--
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] How I can use multiple results in MySQL

2001-04-23 Thread Mark Roedel

 -Original Message-
 From: Yevgeny Dyatlov [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 23, 2001 8:05 AM
 To: PHP-DB
 Subject: [PHP-DB] How I can use multiple results in MySQL
 
 
 I'm cann't using query to MySQL like this:
 
 SELECT name FROM cia WHERE region =
 (SELECT region FROM table WHERE name = 'Brazil');
 
 And
 
 SELECT name FROM table WHERE count =
 (SELECT max(count) FROM table);
 
 I want to select COLUMN_NAME in TABLE where ID is max,
 how I can do it?

MySQL doesn't support sub-selects.  

However, in many cases you can get the same result by either
reorganizing your queries or creating a temporary table.  For more info,
see

http://www.mysql.com/doc/M/i/Missing_Sub-selects.html

For example, your first query, rearranged to use joins, might wind up
looking something like

SELECT cia.name
FROM cia, table
WHERE cia.region = table.region 
AND table.name='Brazil'

For the second, I'd do something like

SELECT name
FROM table
ORDER BY count DESC
LIMIT 1


---
Mark Roedel ([EMAIL PROTECTED])  ||  There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full.
 LeTourneau University  ||-- Henry Kissinger


--
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] Supplied argument is not a valid MySQL result resource...

2001-04-23 Thread Mark Roedel

 -Original Message-
 From: Klaus Haberkorn [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, April 21, 2001 6:18 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Supplied argument is not a valid MySQL result
 resource...
 
 
 Looks like many reasons cause this error-message,
 but I cannot find a problem in the Query:
 ie.:
  $db_handle = mysql_connect(localhost, mysql, mysql);
  if($db_handle)
  {
   $result = mysql_db_query(mysql, select * from user, $db_handle);
   if($result = TRUE)

if ($result == TRUE)


---
Mark Roedel ([EMAIL PROTECTED])  ||  There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full.
 LeTourneau University  ||-- Henry Kissinger


--
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_result()

2001-04-04 Thread Mark Roedel

 -Original Message-
 From: Jordan Elver [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 04, 2001 10:46 AM
 To: PHP Database Mailing List; PHP General Mailing List
 Subject: [PHP-DB] mysql_result()
 
 
 If I knnow that a query will only retrun one row, can I do 
 this (below) rather than using a while loop for one record?
 
 $id = @mysql_result($result, 0, 'id');
 $name = @mysql_result($result, 0, 'name');
 $email = @mysql_result($result, 0, 'email');
 $address1 = @mysql_result($result, 0, 'address1');
 $address2 = @mysql_result($result, 0, 'address2');
 $town_city = @mysql_result($result, 0, 'town_city');
 $postcode = @mysql_result($result, 0, 'postcode');

Looks reasonable to me...what happens when you try it?


---
Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
 LeTourneau University  ||-- Henry Kissinger


--
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] array_diff usage

2001-04-02 Thread Mark Roedel

 -Original Message-
 From: Martin Skjoldebrand [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, March 31, 2001 10:52 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] array_diff usage
 
 
 I'm daft. I don't understand the PHP Manual.
 
 I have two arrays:
 Open[0] contains 1 2 3 4 5
 Closed[0] contains 1 2
 
 Now:
 $test = array_diff($Open, $Closed);

Given the setup you've described, I think you might actually want

$test = array_diff($Open[0], $Closed[0]);

 $lines = count($test);
 print $lines;
 
 Gives me: 1
 I thought it should be 3.

Seems appropriate, given the information you've provided.  $Open and
$Closed each have only one element (0).

 While:
 for ($counter =0; $counter = $lines -1; $counter++)
 {
 print $test[0];
 }
 
 gives me "5".

This, on the other hand, makes me suspect that the arrays themselves
don't actually contain what you think they do.  How are you assigning
the values you described at the top of your message?
 

---
Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
 LeTourneau University  ||-- Henry Kissinger


--
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] array_diff usage

2001-04-02 Thread Mark Roedel

 -Original Message-
 From: Martin [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 02, 2001 10:48 AM
 To: Mark Roedel; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] array_diff usage
 
 
 
 This, on the other hand, makes me suspect that the arrays themselves
 don't actually contain what you think they do.  How are you 
 assigning the values you described at the top of your message?
 
 I get them from a database by two select queries.
 Then I do
 
 $noOpened=mysql_num_rows($jobresult1);
 $noClosed=mysql_num_rows($jobresult2);
 $getlargest = strcmp($noOpened, $noClosed);
 
 switch ($getlargest) {
   case $getlargest  0:
 $counttickets = $noOpened;
 while($sumOpen=mysql_fetch_row($jobresult1)) {   
  $Open = $sumOpen;
  // DEBUG
  print $Open[0] . "br";
 
}
while($sumClosed=mysql_fetch_row($jobresult2)) {   
  $Closed = $sumClosed;
  // DEBUG
  print "c" . $Closed[0] . "br";

}
 
 Which produces:
 1
 2
 3
 4
 5
 c1
 c2
 
 So the arrays are correctly set up (I think).

Actually, no.  It looks to me as if each only contains, at any given
time, the most recent value you assigned.  (That is, $Open[0] only
contains the value "5" at the end of the run, and $Closed[0] only
contains the value "2".)

That, in fact, explains the results of your array_diff() quite nicely.

For what you apparently really mean to do, you'll want to replace
$Open = $sumOpen;

with something that looks more like
$Open[] = $sumOpen;

(That'll append the value of $sumOpen to the end of the $Open array,
rather than overwriting the entire $Open variable with the value of
$sumOpen.

Make sense?


---
Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
 LeTourneau University  ||-- Henry Kissinger


--
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] Please help me with this script...

2001-04-02 Thread Mark Roedel

 -Original Message-
 From: Slider [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 02, 2001 9:27 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Please help me with this script...
 
 
 Hello,
 
 I've been working on this script all day, but I'm getting the 
 same failure
 report each time:
 
 Warning: Supplied argument is not a valid MySQL result resource in
 c:\program files\apache 
 group\apache\htdocs\motoerit\toon_alles.php on line 23
 
 What could be wrong? This is the code I have:

This usually means there was a problem with your query.  For more info,
including some useable sample code that should help you troubleshoot
exactly what went wrong, see

http://www.php.net/FAQ.php#7.12

---
Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
 LeTourneau University  ||-- Henry Kissinger


--
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] HERE doc

2001-03-29 Thread Mark Roedel

 -Original Message-
 From: houston [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 29, 2001 8:40 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] HERE doc
 
 
 In his excellent book "Core PHP Programming", Leon Atkinson 
 says that PHP supports Perl-style "HERE docs".  I have tried
 to make this work with PHP4.04 with no success.  I also haven't
 found any reference to HERE docs in the PHP documentation.  Is
 this really supported in PHP?

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

---
Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
 LeTourneau University  ||-- Henry Kissinger


--
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] php/linux/mssql

2001-03-19 Thread Mark Roedel

 -Original Message-
 From: Miles Scruggs [mailto:[EMAIL PROTECTED]]
 Sent: Monday, March 19, 2001 11:17 AM
 To: PHP Mailing
 Subject: FW: [PHP-DB] php/linux/mssql
 
 
 
 Well from what I can tell php treats sybase and mssql the same.  Am I
 wrong on this, or how do I fix this?

That's correct...
 
 I have setp php/linux/mssql and everything works except the MS SQL 
 connection.  I don't get any errors returned to me, but it doesn't
 connect.  As far as I can tell it doesn't even try, but I can't tell
 at what point it is breaking.  I have used the freetds 0.51 libs to
 make this connection since I can't get the sybase libs.  Here is
 what I have installed

 php-4.0.4pl1
 apache_1.3.14
 freetds-0.51
 mysql-3.22.32  (connection to mysql works fine)

 On a remote site I have MS SQL server 2000 installed

 [ snip ]

 So I don't get an error until I try to select a db.  I run tcpdump
 at the same time just to make sure that it wasn't trying to connect
 to the remote server and there was no attempt to even make a
 connection.

Have you tried running a 'make check' in your FreeTDS directory to run
the library's self-tests?  I know I had to tweak a couple of things
before I got PHP to work with a MS SQL server, and most of them came in
the stages of getting FreeTDS working correctly before I even tried to
build it into PHP.

Is your SYBASE environment variable set correctly?  Have you
double-checked the sybase-related settings in your php.ini?  Are you
using the --enable-dbmfix flag for configure when building FreeTDS?  (If
so, have you made the appropriate changes in PHP's code or applied the
patches from the FreeTDS website?)


---
Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
 LeTourneau University  ||-- Henry Kissinger


--
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] Getting last row, moving backwards..

2001-01-19 Thread Mark Roedel

 -Original Message-
 From: Chad Day [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 19, 2001 9:15 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] Getting last row, moving backwards..


 I need some help selecting the last row in my database, and then
 moving backwards.. I can't just get mysql_num_rows and go back by
 1, as some of the records are missing.. the ID field might have #'s
 like 1950, 1948, 1947, 1944, etc, and I don't want it to break by
 mistakingly trying to grab 1949.  Can someone provide some help or
 a link to where in the manual what I'm doing might be explained?
 Been searching, no luck yet.  Thanks!

Wouldn't it be easier to just get them from the database in the order that
you want?

In your example, something like

select * from mytable order by id_field desc

would likely do the trick (sorting your results by the value of the ID
field, in descending order).


---
Mark Roedel| "A wise man once told me that everything in
Systems Programmer |  life is either a lesson or a joke.  Our task
LeTourneau University  |  is to figure out which is which..."
Longview, Texas, USA   | -- Chris Savage



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