RE: [PHP-DB] checking for results return from mysql

2001-08-05 Thread Cody

At Sunday, 5 August 2001, olinux [EMAIL PROTECTED] wrote:

try this

$result = mysql_query($sql_query);

if ($result) {
  while ($row = mysql_fetch_array($result)) {
  $var_1 = $row['var_1'];
  $var_2 = $row['var_2'];
  }
}

olinux

This might work:

$result = mysql_query($sql_query);

$num_rows = mysql_num_rows($result);

 if($num_rows  0) {
  *** code to execute if any rows were returned ***
 } else {
  *** code to execute if zero rows were returned ***
 }

Hope this helps!

Cody







-- 
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, please can we stop this kind of thing ..... !

2001-08-20 Thread Cody

At Monday, 20 August 2001, Pitcher, George [EMAIL PROTECTED]
uk wrote:

Guys,

If the purpose of the first message which prompted this thread was 
to reduce
bandwidth, then it gives the impression that its ok to waste bandwidth
having a meaningless debate like this but not if it's to deal with a
newbie's request.

just my 2c

George, an English newbie in Scotland


I definetly agree with you, George!

Cody







-- 
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] More on trying to get started with Oracle

2001-01-19 Thread Cody Caughlan

This seems to be a common problem, I dont know why PHP doesnt make a note of
this on their website under the Oracle documenation.

The problem is that PHP/Apache needs to know these variables upon server
startup, not when it loads the specific PHP page.

So what you need to do is set these variables in your apache httpd.conf like
this:

SetEnv TNS_ADMIN ???
SetEnv ORACLE_HOME ???
SetEnv ORACLE_SID ???

That is all I set in my config and it works great. Then you use the
user/password on the php page, and it should work..

good luck
/cody caughlan

John Coonrod wrote:

 OK, I've now figured out how to activate the oracle commands and get php4 to
 recognize them, but I cannot get the connection to connect.  This is under
 windows 2000: I've putenv oracle_home, oracle_sid and tns_admin and
 ora_logon with the same name@tns and password that work under sqlplus - and
 ora_logon fails.

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


-- 
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] insert - hours of time - help

2001-02-10 Thread Cody Caughlan

It looks like you are getting a error in your INSERT statement and not
catching it. The statement is not correct, missing ' on the values line..:

   $query="INSERT INTO table values('$last_name)";

^ closing ' here...

Change it to:

   $query="INSERT INTO table values('$last_name')";

It always a good idea to catch errors, at least while developing...if you
dont want to see the errors, maybe email them to yourself..

/cody

Marc Bragg wrote:

 Help,

 I have a data input form which collects information from users, and then
 transmits to a page for user to view. How do I pass the input date into
 the table. Have tried the following:

 input.php3
form name='frmAttyApp' method=post action="app.php3"

 Please enter your last name (irequired/i):
 input name="last_name" type="text"
 br
 /form

 This then displays to user through app.php3:
 ?php
 echo (
  "bThank You for submitting the following:/bbrPlease double check
 your answers.brPlease click back and fix any errors prior to
 submitting." . NL . NL . // new line constant.
  "Last Name: $last_name" . NL
 )

 form  method=post action="attydb.phtml"
 ?php
 "$last_name,
 /form

 This then hits the attdb.phtml and phtml does connect to the database as
 follows:
 --attydb.phtml--

 ?php
mysql_connect(localhost, test);
@mysql_select_db(trial) or die("Unable to select database");
 $query="INSERT INTO table values('$last_name)";
   $result=mysql_query($query);
 mysql_close();

 ?

 From my logs, I am connecting fine to the database. But the information
 in the last_name is not being passed to the database. The app.php3
 displays only as follows when brought into the browser:

 Last Name: Braggbr

 How do I retain the $last_name information so it passes to the database
 and at the same time displays in the browser so user can be sure entry
 is correct? Or, how do i pass the input to the database in the first
 place?

 Thanx

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


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




[PHP-DB] Clock struggles

2001-07-12 Thread Taylor \Cody\ Fletcher

Im running PHP off of Win2k. The clock on the server is set correctly, but somehow PHP 
timestamps are adding 7 hours to that. Is there a time zone property that needs to be 
changed?



Re: [PHP-DB] Converting MS Access to MySQL

2001-07-19 Thread Taylor \Cody\ Fletcher

yeah, cut and paste, jk, im curious too

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 19, 2001 2:15 PM
Subject: [PHP-DB] Converting MS Access to MySQL


 Can anyone suggest a good utility for converting database from MS Access
to MySQL?
 Thanks.


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


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