[PHP-DB] odbc into associative arrays

2002-07-16 Thread Gabor Niederlaender

Hi all!


Is it possible to fetch the odbc results into an associative array?

Regards,
Gabor

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




RE: [PHP-DB] Select a subset?

2002-07-16 Thread joakim . andersson

 From: Clive Bruton [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 15, 2002 5:01 PM
 
 How do I get both the number of rows found (5,000) and get a 
 subset of 
 the records (ie 0-9, 10-19, 20-29...) so that a user can 
 browse through 
 the records rather than getting 5,000 at a time (but still 
 know that a 
 total of 5,000 were found).

I think you need to do two querys. At least that's how I do it...
First SELECT COUNT(*) FROM table
and then SELECT whatever FROM table LIMIT 0,10

list.php:
?php
  $rows_to_list = 10; // Number of rows per page
  if(isset($_GET['offset'])) // Find out which row to start with
  $offset = $_GET['offset'];
  else
  $offset = 0;

  $result = mysql_query(SELECT COUNT(*) as numrows FROM
table,$db);
  $row = mysql_fetch_array($result);
  $num_rows = $row['num_rows'];

  echo Displaying rows  . $offset + 1 .  to $rows_to_list (total
$num_rows rows)\n;

  $result = mysql_query(SELECT * FROM table LIMIT $offset,
$rows_to_list,$db);

  echo table border=1;
  echo trtdName/tdtdPosition/tr\n;

  while ($myrow = mysql_fetch_row($result)) {

   printf(trtd%s %s/tdtd%s/tr\n, $myrow[1], 
$myrow[2], $myrow[3]);
   }

  echo /table\n;
?
a href=list.php?offset=?php echo $offset - $rows_to_list; ?Previous
?php echo $rows_to_list ?/abr
a href=list.php?offset=?php echo $offset + $rows_to_list; ?Next ?php
echo $rows_to_list ?/a

This oughta do it...
Regards
Joakim Andersson

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




[PHP-DB] escaping line brakes

2002-07-16 Thread Andy

Hi there,

I am putting text into a mysql db from a form field. I do include the
linebrakes with line2br.

Now I would like to create an interface where I could load the text into the
form again to edit it. Unfortunatelly it includes some wired chars like \br
into the text. How can I get rid of that?

Thanx for any help,

Andy



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




RE: [PHP-DB] header function

2002-07-16 Thread Gary . Every

You'll have to get rid of ALL html, including the BR in your code below.

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: Mohammad Forouhar-Fard [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 15, 2002 4:51 PM
To: 'Steve Cayford'
Cc: [EMAIL PROTECTED]
Subject: AW: [PHP-DB] header function


Nothing it is only header function.
No I don't have anything outside.
In this case  I am connected to the DB.

if($v_action ==delete){
$DBquery($cfgDB[data],UPDATE $cfgTbl[accounts] SET acc_service='' WHERE
acc_id='$v_id') or die(cannot
UPDATE$cfgTbl[accounts]:br.mysql_error());
header(Location: list.php?message='T');
}

-Ursprüngliche Nachricht-
Von: Steve Cayford [mailto:[EMAIL PROTECTED]] 
Gesendet: Montag, 15. Juli 2002 23:18
An: Mohammad Forouhar-Fard
Cc: [EMAIL PROTECTED]
Betreff: Re: [PHP-DB] header function

What's on line 3 of Auth_user.php ?

If you have anything outside of the ?php ... ? tags it will start the 
html output. Even just an empty line.

-steve

On Monday, July 15, 2002, at 04:09  PM, Mohammad Forouhar-Fard wrote:


 Hi,
 I have a problem with   function  header(Location:xy.php?var=2).
  I have not any text (print echo or display any text) at all before I
 set a cookie
 If I try to execute this function of Apache server in my Company it is
 all OK. But if I try to run at home I have even the same error
 Cannot add header information - headers already sent by (output
started
 at
 C:\httpd\HTDOCS\Auth_user.php on line 3
 Can somebody help my I have at home  this configuration:
 I have Winxp  OmniHTTPd/2.09 Server.




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



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



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



RE: [PHP-DB] escaping line brakes

2002-07-16 Thread joakim . andersson

 From: Andy [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 16, 2002 2:45 PM

 Hi there,
 
 I am putting text into a mysql db from a form field. I do include the
 linebrakes with line2br.
 
 Now I would like to create an interface where I could load 
 the text into the
 form again to edit it. Unfortunatelly it includes some wired 
 chars like \br
 into the text. How can I get rid of that?

When did you use nl2br() (which I assume you mean)? Before you store the the
data in the database or when you retrive it?

If before then use echo str_replace(br /, \n, $your_string)
If when you retrieve the data for output to the form, then just don't use
nl2br().

Regards
Joakim Andersson

 
 Thanx for any help,
 
 Andy

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




[PHP-DB] PHP and Oracle 7.0

2002-07-16 Thread Chip Atkinson

Greetings,

Has anyone gotten oracle 7.0 to work with the latest php?  I'm having
trouble reliably getting anything back.

Thanks in advance,

Chip



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




[PHP-DB] Data Synchronization...

2002-07-16 Thread NIPP, SCOTT V (SBCSI)

This is actually more of a MySQL question, but here goes...

I have two servers, one production and one development.  I would
like to use the development server as a backup for the production server.
Is there a way to synchronize the MySQL databases between these two servers?
I imagine that I could just copy over the MySQL data directory on a nightly
basis, but is there a more elegant way of doing this?  Thanks.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



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




RE: [PHP-DB] Select a subset?

2002-07-16 Thread Clive Bruton

[EMAIL PROTECTED] wrote at 16/07/02 09:44

  $result = mysql_query(SELECT COUNT(*) as numrows FROM
table,$db);
  $row = mysql_fetch_array($result);
  $num_rows = $row['num_rows'];

Joakim, thanks, that sorted it. Just one note, numrows in the sql query 
should be num_rows? That's how I got it to work anyway.


-- Clive

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




[PHP-DB] Keeps prompting to download php page???

2002-07-16 Thread NIPP, SCOTT V (SBCSI)

I just upgraded to Apache 1.3.26, and everything it fine except PHP.
Whenever I try to load a PHP page in the browser, the browser attempts to
download the page.  I know that I am missing something simple here.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



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




Re: [PHP-DB] Keeps prompting to download php page???

2002-07-16 Thread Adam Alkins

Wrong list. This is for Databases.

Try the php-install list.

--
Adam Alkins
http://www.rasadam.com
--


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




[PHP-DB] Bypass Trigger on a Query?

2002-07-16 Thread Ryan Jameson (USA)

Anyone know if there is a way to bypass the update trigger on a table for one query, 
without having to remove the trigger all together?

 Ryan

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




RE: [PHP-DB] Bypass Trigger on a Query?

2002-07-16 Thread Ryan Jameson (USA)

it's MS SQL btw... :-)

-Original Message-
From: Ryan Jameson (USA) 
Sent: Tuesday, July 16, 2002 4:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Bypass Trigger on a Query?


Anyone know if there is a way to bypass the update trigger on a table for one query, 
without having to remove the trigger all together?

 Ryan

-- 
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] change data before its sent to db?

2002-07-16 Thread Beau Lebens

Chip, a couple ideas

1. why not display the select list something like this
select name=month
option value=00Please Select/option
option value=01January/option
option value=02February/option
...
/select

That way the user sees the names of the months, but your database gets sent
nice, easy-to-deal-with numbers?

2. What didn't work with your monthname=number assignment routine? you
should be able to make a function to do it, something like;

function month_name_to_number($name) {
switch ($name) {
case Jan :
return 1;
break;
case Feb :
return 2;
...
default :
return false;
}
}

Using this, if the functions returns false, then they haven't selected a
valid name, otherwise it will return a number from 1-12, indicating the
month.

PS - none of that code is tested, but it should work if you finish it off :)

HTH

Beau

// -Original Message-
// From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
// Sent: Wednesday, 17 July 2002 5:20 AM
// To: PHP_DB
// Subject: [PHP-DB] change data before its sent to db?
// 
// 
// I have a form with a select box of the 12 months + one for 
// none. It (and
// more) are sent to a mysql
// database. On another web page a list is displayed and can be 
// sorted by
// date, but of course
// the month names are not alphabetical. I tried to assign each month a
// number, 01,02,03, etc in a
// if-elseif statement, then send it to the database but that 
// wouldn't work.
// 
// if ($month == 'jan') { $month = '01';}
// elseif ($month == 'feb') {$month = '02'};
// 
// etc, so I can then sort numerically, and it will display in 
// the correct
// order on the web page.
// I have tried various versions of the above but it will not work.
// I know I could use numbers instead of names for the months - 
// but for this
// application that
// would not be appropriate.
// 
// The sort code ---
// 
// if ($orderby == 'month_num'):
// $sql = select * from releases order by 'month';
// elseif ($orderby == 'month_num2'):
// $sql = select * from releases order by 
// 'month' desc;
// 
// The html select 
// 
// td valign=bottomMonth:br /
// select name=month
// option value=000None
// option value=JanJan
// option value=FebFeb
// etc
// /select
// 
// --
// Chip Wiegand
// Computer Services
// Simrad, Inc
// www.simradusa.com
// [EMAIL PROTECTED]
// 
// There is no reason anyone would want a computer in their home.
//  --Ken Olson, president, chairman and founder of Digital 
// Equipment
// Corporation, 1977
//  (They why do I have 9? Somebody help me!)
// 
// 
// -- 
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, visit: http://www.php.net/unsub.php
// 

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




[PHP-DB] Re: escaping line brakes

2002-07-16 Thread David Robley

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
says...
 Hi there,
 
 I am putting text into a mysql db from a form field. I do include the
 linebrakes with line2br.
 
 Now I would like to create an interface where I could load the text into the
 form again to edit it. Unfortunatelly it includes some wired chars like \br
 into the text. How can I get rid of that?
 
 Thanx for any help,
 
 Andy

It sounds like you are using nl2br to all breaks _before_ you insert your 
data into a table. Don't do this, for this very reason.

Only use nl2br _after_ you extract the data to format it for display in a 
browser; you don't need to use nl2br to display the data in a TEXTAREA 
of course.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




Re: [PHP-DB] Data Synchronization...

2002-07-16 Thread Jason Wong

On Wednesday 17 July 2002 01:52, NIPP, SCOTT V (SBCSI) wrote:
 This is actually more of a MySQL question, but here goes...

   I have two servers, one production and one development.  I would
 like to use the development server as a backup for the production server.
 Is there a way to synchronize the MySQL databases between these two
 servers? I imagine that I could just copy over the MySQL data directory on
 a nightly basis, but is there a more elegant way of doing this?  Thanks.

mysql manual  replication

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
I'm having fun HITCHHIKING to CINCINNATI or FAR ROCKAWAY!!
*/


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