Re: [PHP-DB] PHP with Javascript

2003-07-15 Thread Peter Monk
I have a problem
Chris, JavaScript is what you need.  I can recommend this site to you:
http://developer.irt.org/faq.htm
It has a huge amount of info on JavaScript (and other languages, too).

Peter.

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


[PHP-DB] problem with starting a session

2003-07-15 Thread Ahmed






hi,
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 89Warning: 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 :

? $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();if (!filled_out($HTTP_POST_VARS)){ echo "You Haven't filled your registeration details correctly, Please go back and try again"; exit; }

if (!valid_email($email)){ echo "That is not a valid email address. Please go back and try again."; exit; }if ($passwd != $passwd2){ echo "The passwords you entered do not match - please go back and try again."; exit; }

if (strlen($passwd)6 || strlen($passwd) 16){ echo "Your password must be between 6 and 16 characters Please go back and try again."; exit;}



can anyone tell me please where is the problem and how to solve it,

i test those scripts on my local server IIS, i use windows XP and last version of PHP and MYSQL,




thanks 







 IncrediMail - Email has finally evolved - Click Here

[PHP-DB] problem with starting a session

2003-07-15 Thread Ahmed Abdelaliem
hi,
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 :

?
$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();

if (!filled_out($HTTP_POST_VARS)){
   echo You Haven't filled your registeration details correctly, Please go 
back and try again;
   exit;
   }

if (!valid_email($email)){
   echo That is not a valid email address. Please go back and try again.;
   exit;
   }
if ($passwd != $passwd2){
   echo The passwords you entered do not match - please go back and try 
again.;
   exit;
   }

if (strlen($passwd)6 || strlen($passwd) 16){
   echo Your password must be between 6 and 16 characters Please go back 
and try again.;
   exit;
}



   can anyone tell me please where is the problem and how to solve it,

i test those scripts on my local server IIS, i use windows XP and last 
version of PHP and MYSQL,



thanks

_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

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


[PHP-DB] Multiple same values only wanting one

2003-07-15 Thread Ron Allen
How do I select * from a table, but I do not want it to return the same
value if two fields are the same.  Example

test
test
test
test
new
new
new

Results that I want are just

test
new

Any suggestions?



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



[PHP-DB] how to generate oci8.so ?

2003-07-15 Thread lok
hi all,

i have installed oracle9i client tools on RedHat7.3 (x86 machine)
and i compiled php4.1.2  apache1.3 successfully
but when i execute php script in browser, error occured:
Fatal error:  Call to undefined function:  ocilogon()

i found no oci8.so in the whole system. i think this is the reason why the
error occured

follow are my commands to compile php4  apach1.3:
(in php source path, /tmp/php-4.1.2)
# /tmp/php-4.1.2/configure --prefix=/usr/local/php4 \
  --with-oci8=/home/lok/OraHome1/ \
  --with-apache=/tmp/apache_1.3.23/ \
  --enable-track-vars \
  --enable-sigchild
# make
# make install
#cp /tmp/php-4.1.2/libs/libphp4.a /tmp/apache_1.3.23/src/modules/php4/

(in apache sourcepaht, /tmp/apache_1.3.23)
#/tmp/apache_1.3.23/configure --prefix=/usr/local/apache \
  --activate-module=src/modules/php4/libphp4.a \
  --sysconfdir=/usr/local/apache/conf \
  --includedir=/usr/local/apache/include \
  --libexecdir=/usr/local/apache/libexec \
  --htdocsdir=/var/www/html \
  --enable-module=php4 \
  --enable-shared=max
# LIBS=-lpthread ./config.status \
  --prefix=/usr/local/apache \
  --enable-module=most \
  --enable-shared=max
# make
# make install

also, i have add these environment varable:
# ORACLE_HOME=/home/lok/OraHome1
# export ORACLE_HOME
# LD_LIBRARY_PATH=/home/lok/OraHome1/lib
# export LD_LIBRARY_PATH

are these command not correct ?
or i miss something ?

regards,
lok



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



[PHP-DB] Re: Multiple same values only wanting one

2003-07-15 Thread Nadim Attari
 How do I select * from a table, but I do not want it to return the same
 value if two fields are the same.  Example

- DISTINCT
- GROUP BY



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



[PHP-DB] MySQL connection

2003-07-15 Thread Igor
I have:
WinNT_4.00 Server
Apache
PHP_5
MySQL_4

[myscript.php]
...
$link = mysql_pconnect();
...
-

If you run php.exe myscript.php,
you'll get message: Fatal error: Call to undefined function:
mysql_pconnect()...

HOW TO DECIDE THIS PROBLEM ?



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



Re: [PHP-DB] MySQL connection

2003-07-15 Thread Lester Caine
I have:
WinNT_4.00 Server
Apache
PHP_5
MySQL_4
[myscript.php]
...
$link = mysql_pconnect();
...
-
If you run php.exe myscript.php,
you'll get message: Fatal error: Call to undefined function:
mysql_pconnect()...
HOW TO DECIDE THIS PROBLEM ?
Have you installed the php_mysql module in PHP5, it is not 
included by default now.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: problem with starting a session

2003-07-15 Thread Ben Tauler
You cannot write anything out before the session_start() call.
The error tells you that you have written something at:

output started at c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25

Check for any echo, print or html output before session_start()

Hope that helps,

Ben


Ahmed Abdelaliem [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 hi,
 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 :

 ?
  $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();


 if (!filled_out($HTTP_POST_VARS)){
 echo You Haven't filled your registeration details correctly, Please
go
 back and try again;
 exit;
 }

 if (!valid_email($email)){
 echo That is not a valid email address. Please go back and try
again.;
 exit;
 }
 if ($passwd != $passwd2){
 echo The passwords you entered do not match - please go back and try
 again.;
 exit;
 }

 if (strlen($passwd)6 || strlen($passwd) 16){
 echo Your password must be between 6 and 16 characters Please go back
 and try again.;
 exit;
 }




 can anyone tell me please where is the problem and how to solve it,

 i test those scripts on my local server IIS, i use windows XP and last
 version of PHP and MYSQL,




 thanks

 _
 MSN 8 with e-mail virus protection service: 2 months FREE*
 http://join.msn.com/?page=features/virus




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



[PHP-DB] how to do this processing....

2003-07-15 Thread Aaron Wolski
Hi all,
 
Would anyone have some logic ideas on how to do this processing given
the following HTML?
 
form action=insert_threads_patterns.php method=POST
tr
td class=adminthreadsDisplayHeader
align=centerSelected?/td
td class=adminthreadsDisplayHeader
align=leftManufacturer/td
td class=adminthreadsDisplayHeader
align=leftColour #/td
td class=adminthreadsDisplayHeader
align=leftColour/td
td class=adminthreadsDisplayHeader align=centerCan
Order?/td
/tr
input type=hidden name=thread_index value=1
input type=hidden name=pattern_index value=2
 
tr valign=top
td class=adminthreadsDisplayText
align=centerinput type=checkbox name=select[] value=1 /td
td class=adminThreadsDisplayText
align=leftDMC/td
td class=adminthreadsDisplayText
align=leftB5200/td
td class=adminthreadsDisplayText align=leftSnow
white/td
td class=adminthreadsDisplayText
align=centerinput type=checkbox name=avail[] value=1 /td
/tr
 
input type=hidden name=thread_index value=2
input type=hidden name=pattern_index value=2
 
tr valign=top
td class=adminthreadsDisplayText
align=centerinput type=checkbox name=select[] value=1
checked/td
td class=adminThreadsDisplayText
align=leftDMC/td
td class=adminthreadsDisplayText
align=left001/td
td class=adminthreadsDisplayText
align=leftwhite/td
td class=adminthreadsDisplayText
align=centerinput type=checkbox name=avail[] value=1
checked/td
/tr
 
input type=hidden name=thread_index value=3
input type=hidden name=pattern_index value=2
 
tr valign=top
td class=adminthreadsDisplayText
align=centerinput type=checkbox name=select[] value=1 /td
td class=adminThreadsDisplayText
align=leftDMC/td
td class=adminthreadsDisplayText
align=leftecru/td
td class=adminthreadsDisplayText
align=leftecru/td
td class=adminthreadsDisplayText
align=centerinput type=checkbox name=avail[] value=1 /td
/tr
 
input type=hidden name=thread_index value=4
input type=hidden name=pattern_index value=2
 
tr valign=top
td class=adminthreadsDisplayText
align=centerinput type=checkbox name=select[] value=1 /td
td class=adminThreadsDisplayText
align=leftDMC/td
td class=adminthreadsDisplayText
align=left150/td
td class=adminthreadsDisplayText align=leftultra
very dark .../td
td class=adminthreadsDisplayText
align=centerinput type=checkbox name=avail[] value=1 /td
/tr
tr valign=top
td colspan=5input type=submit value=Save
name=addIt class=adminInputBox/td
/tr
/form
 
If a displayed record was selected (select[]) then store the
corresponding pattern_index and thread_index into a table.
 
Additionally, if the avail{} checkbox was selected for the corresponding
records then store the value of 1 in the table as well.
 
Sample table output would look like:
 
++---+--+---+
| id | pattern_index | thread_index | avail |
++---+--+---+
|  1 | 2 |2 | 1 |
|  2 | 2 |5 | 0 |
|  3 | 2 |   14 | 1 |
++---+--+---+
 
Any ideas? *begging here*
 
Thanks!
 
Aaron


Re: [PHP-DB] MySQL connection

2003-07-15 Thread Igor
 Have you installed the php_mysql module in PHP5, it is not
 included by default now.

Where can I find this Library?



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



[PHP-DB] PHP MySQL news display probs

2003-07-15 Thread phpuser
Dear All,

I have created a simple news system and am having a problem in that all the code 
compiles so I think it is correct and the news headlines display but when you point to 
the link to read the article (for example http://localhost/news/user/story.php?id=2) 
nothing displays, it returns that there is nothing in the database and prints out the 
arm of the else statement, no records.

I am convinced that I need to enable something somewhere in the php.ini file but may 
be wrong. Any help would be really really appreciated.

This is the code which displays the news headlines which displays them OK:

html
head
basefont face=Verdana
/head

body

!-- standard page header begins --
pnbsp;p

table width=100% cellspacing=0 cellpadding=5
tr
td/td
/tr
tr
td bgcolor=Navyfont size=-1 color=WhitebReuters Inc : Press 
Releases/b/font/td
/tr
/table
!-- standard page header ends --

ul
?
// includes
include(../conf.php);
include(../functions.php);

// open database connection
$connection = mysql_connect($host, $user, $pass) or die (Unable to connect!);

// select database
mysql_select_db($db) or die (Unable to select database!);

// generate and execute query
$query = SELECT id, slug, timestamp FROM news ORDER BY timestamp DESC LIMIT 0, 5;
$result = mysql_query($query) or die (Error in query: $query.  . mysql_error());

// if records present
if (mysql_num_rows($result)  0)
{
// iterate through resultset
// print article titles
while($row = mysql_fetch_object($result))
{
?
lifont size=-1ba href=story.php?id=? echo $row-id; ?? 
echo $row-slug; ?/a/b/font
br
font size=-2? echo formatDate($row-timestamp); ?/font
p
?
}
}
// if no records present
// display message
else
{
?
font size=-1No press releases currently available/font
?
}

// close database connection
mysql_close($connection);
?
/ul

!-- standard page footer begins --
p
table width=100% cellspacing=0 cellpadding=5
tr
td align=centerfont size=-2Everything here is copyright copy; 
/tr
/table
!-- standard page footer ends --


/body
/html

This is the code to Display the corresponding article, its driving me nuts!

/ story.php - display contents of selected press release
?
html
head
basefont face=Verdana
/head

body

!-- standard page header begins --
pnbsp;p

table width=100% cellspacing=0 cellpadding=5
tr
td/td
/tr
tr
td bgcolor=Navyfont size=-1 color=WhitebReuters Inc : Press 
Releases/b/font/td
/tr
/table
!-- standard page header ends --

?
// includes
include(../conf.php);
include(../functions.php);

// open database connection
$connection = mysql_connect($host, $user, $pass) or die (Unable to connect!);

// select database
mysql_select_db($db) or die (Unable to select database!);

// generate and execute query
$query = SELECT slug, content, contact, timestamp FROM news WHERE id = '$id';
$result = mysql_query($query) or die (Error in query: $query.  . mysql_error());

// get resultset as object
$row = mysql_fetch_object($result);

// print details
if ($row)
{
?
p
b? echo $row-slug; ?/b
p
font size=-1? echo nl2br($row-content); ?/font
p
font size=-2This press release was published on ? echo 
formatDate($row-timestamp); ?. For more information, please contact ? echo 
$row-contact; ?/font
?
}
else
{
?
p
font size=-1That press release could not be located in our database./font
?
}

// close database connection
mysql_close($connection);
?

!-- standard page footer begins --
p
table width=100% cellspacing=0 cellpadding=5
tr
td align=centerfont size=-2Everything here is copyright copy; /tr
/table
!-- standard page footer ends --

/body
/html

Thanks Again
PHPUSER


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



Re: [PHP-DB] PHP MySQL news display probs

2003-07-15 Thread CPT John W. Holmes
 I have created a simple news system and am having a
 problem in that all the code compiles so I think it is
 correct and the news headlines display but when you
 point to the link to read the article (for example
 http://localhost/news/user/story.php?id=2) nothing
 displays, it returns that there is nothing in the database
 and prints out the arm of the else statement, no records.

So what's the value of $id on the story.php page? What's the value of
$_GET['id']? Print out your query before you execute it to make sure it
looks right. Do some debugging and read about register globals (if my
assumption is correct).

---John Holmes...



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



Re: [PHP-DB] PHP MySQL news display probs

2003-07-15 Thread jeffrey_n_Dyke

you'll need to use $_GET['id'] or you'll need to set register_globals = On.

I would use the first method, and replace

$query = SELECT slug, content, contact, timestamp FROM news WHERE id
= '$id';
with --
$query = SELECT slug, content, contact, timestamp FROM news WHERE id = '.
$_GET['id'].';

i bet it will work straight away.

hth
Jeff


   
 
  [EMAIL PROTECTED]
 
  on.co.uk To:   [EMAIL PROTECTED] 
  
   cc: 
 
  07/15/2003 10:44 Subject:  [PHP-DB] PHP MySQL news 
display probs  
  AM   
 
   
 
   
 




Dear All,

I have created a simple news system and am having a problem in that all the
code compiles so I think it is correct and the news headlines display but
when you point to the link to read the article (for example
http://localhost/news/user/story.php?id=2) nothing displays, it returns
that there is nothing in the database and prints out the arm of the else
statement, no records.

I am convinced that I need to enable something somewhere in the php.ini
file but may be wrong. Any help would be really really appreciated.

This is the code which displays the news headlines which displays them OK:

html
head
basefont face=Verdana
/head

body

!-- standard page header begins --
pnbsp;p

table width=100% cellspacing=0 cellpadding=5
tr
 td/td
/tr
tr
 td bgcolor=Navyfont size=-1 color=WhitebReuters Inc : Press
Releases/b/font/td
/tr
/table
!-- standard page header ends --

ul
?
// includes
include(../conf.php);
include(../functions.php);

// open database connection
$connection = mysql_connect($host, $user, $pass) or die (Unable to
connect!);

// select database
mysql_select_db($db) or die (Unable to select database!);

// generate and execute query
$query = SELECT id, slug, timestamp FROM news ORDER BY timestamp DESC
LIMIT 0, 5;
$result = mysql_query($query) or die (Error in query: $query.  .
mysql_error());

// if records present
if (mysql_num_rows($result)  0)
{
 // iterate through resultset
 // print article titles
 while($row = mysql_fetch_object($result))
 {
 ?
  lifont size=-1ba href=story.php?id=? echo $row-id; ??
  echo $row-slug; ?/a/b/font
  br
  font size=-2? echo formatDate($row-timestamp); ?/font
  p
 ?
 }
}
// if no records present
// display message
else
{
?
 font size=-1No press releases currently available/font
?
}

// close database connection
mysql_close($connection);
?
/ul

!-- standard page footer begins --
p
table width=100% cellspacing=0 cellpadding=5
tr
 td align=centerfont size=-2Everything here is copyright copy;
/tr
/table
!-- standard page footer ends --


/body
/html

This is the code to Display the corresponding article, its driving me nuts!

/ story.php - display contents of selected press release
?
html
head
basefont face=Verdana
/head

body

!-- standard page header begins --
pnbsp;p

table width=100% cellspacing=0 cellpadding=5
tr
 td/td
/tr
tr
 td bgcolor=Navyfont size=-1 color=WhitebReuters Inc : Press
Releases/b/font/td
/tr
/table
!-- standard page header ends --

?
// includes
include(../conf.php);
include(../functions.php);

// open database connection
$connection = mysql_connect($host, $user, $pass) or die (Unable to
connect!);

// select database
mysql_select_db($db) or die (Unable to select database!);

// generate and execute query
$query = SELECT slug, content, contact, timestamp FROM news WHERE id
= '$id';
$result = mysql_query($query) or die (Error in query: $query.  .
mysql_error());

// get resultset as object
$row = mysql_fetch_object($result);

// print details
if ($row)
{
?
 p
 b? echo $row-slug; ?/b
 p
 font size=-1? echo nl2br($row-content); ?/font
 p
 font size=-2This press release was published on ? echo formatDate
 ($row-timestamp); ?. For more information, please contact ? echo
 $row-contact; ?/font
?
}
else
{
?
 p
 font size=-1That press release could not be located in our
 database./font
?
}

// close database connection
mysql_close($connection);
?

!-- standard page footer begins --
p
table width=100% cellspacing=0 cellpadding=5
tr
 td align=centerfont size=-2Everything here is copyright copy;
/tr
/table
!-- standard page footer 

[PHP-DB] Re: any Help !! the only way have to ODBC to Linux

2003-07-15 Thread Pete Morganic
Have you looked at Pear DB
http://pear.php.net/manual/en/package.database.php
This is what i use all the time and allows me to easily switch between 
mysql, mssql and postresql which i do all the time

pete

Nabil wrote:
I have an Linux server running Apache/PHP/MySQL.
and I need to connect to another server running  MSSQL server 7
THE POINT IS  the only way I have to connect is throu ODBC connection
because the network administrator only allowed me to connect thru port 1433
that ODBC uses..
I tried to make it direct connection, but this way uses many ports that the
firewall won't allowed..
He said for security reasons that he can't open those ports to prevents
hackers to use them ... do u think this is a true ? any advice what port the
direct connection uses??? does it uses NetBIOS?
if he was right ... so I have to change to ODBC
I heard about FreeDTS and iODBC, but I need some advice and notes to make it
easy for me..
Please HELP.. and your valuable comments will be appreciated..

Nabil




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


[PHP-DB] Getting a date in number form

2003-07-15 Thread Rick Dahl
I need to get the month in a number format; July =7.  Right now it is returning the 
string: July.

This is what I am doing.

$today = getdate(); 
$month = $today['month']; 
$mday = $today['mday']; 
$year = $today['year']; 

What can I do to get the number instead of the word?

- Rick


RE: [PHP-DB] Getting a date in number form

2003-07-15 Thread Jennifer Goodie
 I need to get the month in a number format; July =7.  Right now
 it is returning the string: July.

 This is what I am doing.

 $today = getdate();
 $month = $today['month'];
 $mday = $today['mday'];
 $year = $today['year'];

 What can I do to get the number instead of the word?

http://www.php.net/manual/en/function.getdate.php says to use mon as the
array index rather than month


-- 
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 Sourabh G
To make it little more clear, always write session_start() on the top of the 
page. Because if you output some thing to the browser without starting a 
session will show you these kind of error.

-Sourabh


From: Ford, Mike   [LSS] [EMAIL PROTECTED]
To: 'Ahmed Abdelaliem' [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [PHP-DB] problem with starting a session
Date: Tue, 15 Jul 2003 10:29:06 +0100
 -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
_
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus

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