RE: [PHP-DB] Another dynamic sql.

2002-01-25 Thread Gurhan Ozen

Seems like it will NOT work because you are selecting  $car which is already
chosen by the user (i.e. which is a known value). I don't know how you laid
out your table but shouldn't your query be something like "SELECT price from
FROM varetabell where carid=$car"  ??

Gurhan

-Original Message-
From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 1:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Another dynamic sql.


Hi all!

I have this form with some choices:


Enter how many cars you want:

ford
bmw
mercedes


And then I am trying to get the price out of a table in my database with
this code:


$sql = mysql_query("SELECT '$car' FROM varetabell where carid='$carid' ");
$myrow= mysql_fetch_array($sql);
$x = $myrow["$car"];

$price = $x * $number;


Shouldn't this work?  Or am I missing something here?



Best regards Raymond



--
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] fwrite()

2002-01-25 Thread Gurhan Ozen

You don't have anything to write to the file.. mysql_query() function
returns true or false, it doesn't return the actual qurey result you'd see
in mysql monitor. You have to use some other functions such as
mysql_fetch_array(), mysql_num_rows() to retrieve the data before you can
write it into a file.

Gurhan

-Original Message-
From: James Kupernik [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 3:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] fwrite()


I'm trying to take the contents of a table and write them to a file on my
server. Everything seems to function ok (AKA no errors) but no file gets
written ... I can't figure out why. Can anyone shine some light on this dark
problem?

  $db = mysql_connect("localhost","cloft","spring");

  mysql_select_db("countryloft");

  // get requests from table
  $result = mysql_query("SELECT * FROM catalogreq WHERE PROCESSED IS
NULL");

  $fp = fopen("$DOCUMENT_ROOT/catalogreq/catalogs.txt","w");

  fwrite($fp, $result);

  fclose($fp);

  $updatereq = mysql_query("UPDATE catalogreq SET PROCESSED = 'Y'");

  echo "Thank you!";


Thanks for any help!



--
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] fwrite()

2002-01-25 Thread Gurhan Ozen

Jamie,
The main problem here is , you are selecting the rows that are some null
values. mysql_fetch* doesn't return any null columns. Yes, you read it
right, if you have a table with say, 5 columns and if 3 columns in a row are
null then you'll only have 2 columns that are not null .
  Make sure that this is not causing any problem for you.
  What does your table look like and and what values do your columns have
when processed is null anyway?

Gurhan


-Original Message-
From: Jamie Kupernik [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 4:22 PM
To: 'daniel'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] fwrite()


  $prefilename = date("m-d-y");

  $filename = "$prefilename.txt";

  $db = mysql_connect("localhost","cloft","spring");

  mysql_select_db("countryloft");

  // get requests from table
  $result = mysql_query("SELECT * FROM catalogreq WHERE
PROCESSED IS NULL");

  $row = mysql_fetch_array($result);

  $fileresults = "$row[0],$row[1]\n";

  $fp = fopen("$DOCUMENT_ROOT/catalogreq/$filename","w");

  fwrite($fp, $fileresults);

  fclose($fp);

  $updatereq = mysql_query("UPDATE catalogreq SET PROCESSED =
'Y'");

-Original Message-
From: daniel [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 4:15 PM
To: James Kupernik
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] fwrite()


> Still when I make the changes suggested the file will not be created,
> yet I get no form of an error message.
>
> Is there something else I'm missing?

Please post your new code for review.


Daniel J. Lashua




This message has been scanned for computer
viruses and none were found.

Country Curtains Information Systems Department






This message has been scanned for computer
viruses and none were found.

Country Curtains Information Systems Department




--
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] Pictures+MySQL+PHP

2002-01-25 Thread Gurhan Ozen

Kamil,
If getting info in your private email is making you so pleased maybe you
shoudl never post any questions here, it is contradictory to the philisophy
of the list.
  I have also asked about inserting / retrieving pictures in mysql database
in past and I have received so many con replies that I changed my mind.
Storing images in the database is not a good idea , just store the path of
the images in the database and keep your images in your hard disk...

Gurhan


-Original Message-
From: K [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 9:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Pictures+MySQL+PHP


Hello,

last time I asked about inserting pictures into MySQL, but how can I do it
(inserting into BLOB column, picutures) using PHP? After inserting it into
table I would also like to select and display the picutre (I inserted
before) using my Internet browser. Any suggestion how to do it using
PHP+MySQL?

Best regards
Kamil
PS. I'll be pleased for all info on my private e-mail :)


-- 
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] Save generated page locally

2002-01-25 Thread Gurhan Ozen

Hi Howard,
I didn't fully understand your question.. Wouldn't you rather have the
server upload the file automatically without asking the user where to save
it?
 You can do it by using PHP's FTP functions.. See:
http://www.php.net/manual/en/ref.ftp.php

Gurhan

-Original Message-
From: Howard Picken [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 8:02 PM
To: PHP DB List
Subject: [PHP-DB] Save generated page locally


Hi guys

I have a local server being used to generate page
which are then uploaded as static pages to
another server.

I would like have the script call up the Windows save as
dialog when a new page has generated so a folder on
the local unit can be selected etc.

I've been looking for an example or a function to do this
but haven't seen one.  Any Ideas?

TIA

regards

Howard Picken
[EMAIL PROTECTED]
Launceston, Tasmania, Australia

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

2002-01-25 Thread Gurhan Ozen

Hi Shelly,
It is just the old trick. You can get the time at the beginning of the page
and at the end of the page and just calculate the difference in between two.
Since the default timeout value in PHP is 30secs. it will probably be a
short timeperiod so you can probably you use time() function which returns
the time in second since UNIX epoch time.

Gurhan

-Original Message-
From: Shelly Wilds [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 6:33 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] help plz


hi yall,
   i've been searching for the command that prints back how long page took
to process.  i found the command that prints @mysql_rows_affected().

but i can't seem to find how i print out how long it took for page to be
processed.

any ideas?
tx,
shelly

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
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] [PHP] PHP and MYSQL Security`

2002-01-27 Thread Gurhan Ozen

The actual content of the .php files won't be seen from the net since it is
server side scripting language.. But if you are still concerned you can put
database connection info into another file (preferably .php file) and place
it somewhere outside your web directory and access it thru require() or
include() functions inside your actual web page.
  But if your concern is for local users' access to those file , just set
your file/directory permissions accordingly.

Gurhan

-Original Message-
From: Duky Yuen [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 27, 2002 7:38 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] [PHP] PHP and MYSQL Security`


How can I secure my username and password? In 1 of my files, it contains
the following:

$conn = mysql_connect( "12.34.56.78", "username", "password");
mysql_select_db("database",$conn);

What should I do, so people can't get this information?

Duky


--
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] arrays and email

2002-01-29 Thread Gurhan Ozen

Hi kevin,
Seems like in your while loop, you are not populating your list array
correctly with all the emails you have.
Try to have a count value and populate the array list accordingly such as:

$count = 0;
while ($row = mysql_fetch_row($result))
 {
  $real_name = $row[1];
  $email = $row[12];
  $list[$count] = $email;
  $count = $count + 1;
 }

Hope this helps.
Gurhan


-Original Message-
From: Kevin Ruiz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 2:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] arrays and email


I'm working on an application that will allow someone to view all attendees
for a specific webinar that my company is hosting.  I want to allow the user
to send one group email to all participants scheduled for that particular
webinar.

After I connect to my database my code looks like this:

\n";
   echo "\n";
   echo "\n";
   echo "To:\n";
   echo "\n";
   foreach ($list as $value)
 {
 print "$value, ";
 $to = $value;
 }
   echo "\n";
  echo "\n";

echo "\n";
echo "\n";
  echo "\n";
   echo "Subject:\n";
   echo "\n";
  echo "\n";
  echo "\n";
   echo "Message:\n";
   echo "\n";
  echo "\n";
  echo "\n";
   echo "\n";
  echo "\n";
echo "\n";
  echo "\n";
  ?>

The $to, $subject, & $message variables then get sent to a page that
actually mails the message.  The problem I'm having is that it's only being
sent to the last person in the array.  I understand why this is happening
but don't know enough about arrays to find a solution.  As my code shows I
ambitiously tried setting $to to the entire array but that doesn't work.

If anyone would be kind enough to help me out I'd greatly appreciate it.

Thank you.
Kevin

www.worktiviti.com



--
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] MySQL Connection Class

2002-01-30 Thread Gurhan Ozen

Are you trying to write classes to connect to the database using PHP's
native DB connection functions?? If yes, you should only check those
database functions' tutorials and just use them inside your class..

Gurhan


-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 12:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Connection Class


I know this may seem a little vague but I would like to know where a good
tutorial on creating database connection class files would be.  I have been
looking and as of yet I have not found one that deals specifically with this
question.  Thanks in advance.
Jas



--
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] MySQL Connection Class

2002-01-30 Thread Gurhan Ozen

Jas,
I can't know whether or not that's right for you. It all depends on what you
need to do.. If you only have one database connection with one userid/pass
combination, then yes it might be the solution you are looking for. But if
you want to  be able to reuse your code for different types of databases,
userids, then you can write a class with different functions and variables
to do so.
  For example you can something like
class myDBConnClass {
  var $user;
  var $pass;
  var $host;
  var $database;

   function setUser($username)
   {
   $this -> user = $username;
   }
   function setPass($password)
   {
   $this -> pass = $password;
   }
   function setHost($hostname)
   {
$this -> host = $hostname)
   }
   function setDatabasename($databasename)
   {
$this  -> database= $databasename;
   }

   function mySQLconn($username, $password, $hostname, $databasename)
   {
  mysql_pconnect("$username", "$password", "$hostname");
  mysql_select_db($databasename);
}
function mySQL()
{
mysql_pconnect("($this -> host).", ".($this -> user).",
".($this -> pass)." );
mysql_select_db($this -> database);
}
 .
 .
 .
 .
   } // end of class myDBConnClass

   Say you have saved this into myDBConnClass.php .. Then in your php pages
you would first require this file with require("myDBConnClass.php");
statement, and then you would create another class extending this or just an
instance of this class (depending upon what you actually have in your class
and pages.
  Keep in mind that this is a very primitive and kind of useless class.. You
can always have more properties of the class and more functions..
  If you prefer you can hardcode the login, databasename info to the class
and call the connection fucntions without arguments, or you can set the
variables of the class and use it so, you can also have more functions to
connect to the different databases (PostGreSQL, Oracle, etc.) .
   Does this help???

Gurhan
-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 12:33 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Connection Class


So all I would need to do is create a file named db_connection.php3 and put
in the functions $db = mysql_connection("localhost","username","password")
or die("could not connect");
and then put an include statement on the top of each page that needs the db
connectiong?  Please correct me if I am wrong, I have never really used
class files for my own scripts before.
Thanks again.
"Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Are you trying to write classes to connect to the database using PHP's
> native DB connection functions?? If yes, you should only check those
> database functions' tutorials and just use them inside your class..
>
> Gurhan
>
>
> -Original Message-
> From: jas [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 30, 2002 12:09 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] MySQL Connection Class
>
>
> I know this may seem a little vague but I would like to know where a good
> tutorial on creating database connection class files would be.  I have
been
> looking and as of yet I have not found one that deals specifically with
this
> question.  Thanks in advance.
> Jas
>
>
>
> --
> 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 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] DB Connections

2002-01-31 Thread Gurhan Ozen

Jas...
What errors are you getting? What do you have inside your db_connection.inc
file? Do you have the path for db_connection.inc inside the require()
function correct?
  Give us more insights to be able to find out what the problem is..

Gurhan

-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 26, 2002 1:21 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] DB Connections


Ok, I am having a hard time coming up with a mysql connection class that
simply allows me to setup a require(db_connection.inc) at the top of my php
pages that allows a consistent connection to the mysql db and allows
multiple queries thoughout the php page in question.  I have read a few
tutorials on it and as of yet they all seem to go over my head.  If someone
could give me some more insight into this area I would greatly appriciate
it.
Jas



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

2002-02-04 Thread Gurhan Ozen

mysql_connect() function only takes 3 arguments (servername, username, pass)
.
Select your database by using mysql_select_db() function...
Try to rewrite the code as:

mysql_connect($db["host"],$db["user"],$db["password"]);
mysql_select_db($db["database"]);

Refer to:
http://www.php.net/manual/en/ref.mysql.php

Gurhan


-Original Message-
From: J Leonard [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 12:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL connect


Hi all,

Ok I am learning this on my own but I could use some help.
I have started these two pages test.php and config.php here is the code:

test.php



config.php



All I'm trying to do is successfully connect to the database but it returns
"sorry not successful". What have I done wrong?
I have gone straight from the php pocket reference manual and it doesn't
work. Would someone please explain what has happened?

Thanks
J Leonard





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

2002-02-04 Thread Gurhan Ozen

Try it without quotes around days_member and 1.

Gurhan 


-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 4:51 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Update


Hi,

I am having problems with this code. I want to update a members number of
days they have been a member can anyone help?

$query["days"]=("UPDATE users set days_member VALUES = ('days_member' +
'1'));
$result=mysql_query($query["days"]);

Thanks in advance
JD



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

2002-02-04 Thread Gurhan Ozen

Yeah I didn't notice that..
VALUES must not be there . it should be :

set days_member=days_member+1 

thanks for pointing that out:)

Gurhan 


-Original Message-
From: Lokesh Verma [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 5:12 PM
To: Gurhan Ozen
Subject: Re: [PHP-DB] Update


i don't know why that 'VALUES' is there?

Lokesh
- Original Message - 
From: "Gurhan Ozen" <[EMAIL PROTECTED]>
To: "Jennifer Downey" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, February 05, 2002 3:28 AM
Subject: RE: [PHP-DB] Update


> Try it without quotes around days_member and 1.
> 
> Gurhan
> 
> 
> -Original Message-
> From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 04, 2002 4:51 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Update
> 
> 
> Hi,
> 
> I am having problems with this code. I want to update a members number of
> days they have been a member can anyone help?
> 
> $query["days"]=("UPDATE users set days_member VALUES = ('days_member' +
> '1'));
> $result=mysql_query($query["days"]);
> 
> Thanks in advance
> JD
> 
> 
> 
> --
> 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] if variable is equal to 2 through 4

2002-02-06 Thread Gurhan Ozen

if ( ($variable > 1 ) && ($variable < 5) )
   echo "hello";

or alternatively,

 for ($i=2; $i < 5; $i++)
 { 
  if ($variable=$i)
     echo "hello";
  }

Gurhan Ozen
MCI WorldCom
Quality Assurance Team
[EMAIL PROTECTED]
ph:   703-449-4754
Vnet: 228-4754
1-800-PAGE-MCI pin: 1927052
AIM:  Greywolf1923

-Original Message-
From: Jay Fitzgerald [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 4:10 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: [PHP-DB] if variable is equal to 2 through 4


i am currently using this code:

if ($variable == 2) || ($variable == 3) || ($variable == 4)
{
echo "hello";
}

how would I write it if I wanted to say this:

if $variable == 2 through 4 ???



Should you have any questions, comments or concerns, feel free to call me 
at 318-338-2034.

Thank you for your time,

Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A
==
Bayou Internet..(888) 
30-BAYOUhttp://www.bayou.com
Mississippi Internet...(800) 
MISSISSIPPI...http://www.mississippi.net
Vicksburg Online..(800) 
MISSISSIPPIhttp://www.vicksburg.com
==
Tel: (318) 338-2034ICQ: 38823829 Fax: 
(318) 323-5053


-- 
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] Converting upper case letters to lower case because ofdb??

2002-02-07 Thread Gurhan Ozen

Andy,

You can do it with PHP's strtolower() function..
See:

http://www.php.net/manual/en/function.strtolower.php

Gurhan

-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 11:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Converting upper case letters to lower case because of
db??


Hi there,

I have a tabel with 250 entries showing a country code lik "CA"

Now my application does not work on linux, because they have to be in lower
case.

Can I make anyhow an bufix, or even better creating a php function to change
all 250 entries to lower case.

I could not find the propper function on the php site.

Can anybody please help on changing this thing into lower case?

Thanx

ANdy



--
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] Select rows where ?

2002-02-12 Thread Gurhan Ozen

SELECT * FROM table WHERE COLUMN_NAME NOT LIKE '%unwanted_String%';

when the field type is number you can use

SELECT * FROM table WHERE COLUMN_NAME != unwanted_number;
or
SELECT * FROM table WHERE COLUMN_NAME <> unwanted_number;

Gurhan


-Original Message-
From: Dave Carrera [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 1:39 PM
To: php List
Subject: [PHP-DB] Select rows where ?


Hi All
How do I select the rows that DO NOT contain a certain character.

I.e. : select * from tablename where field dose not contain "A"

Any pointers as always appreciated.

davec

Dave Carrera
Website Designer
http://www.davecarrera.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] Connecting to ms acces dbase from php

2002-02-13 Thread Gurhan Ozen

You need to install data source name at :
 Start --> Settings --> Control PAnel --> Data Sources(ODBC)

Gurhan

-Original Message-
From: Renaldo De Silva [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 2:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connecting to ms acces dbase from php


Anyone know how this is done, I know it has something to do with installing
ODBC drivers, I downloaded them but I don't understand what I'm doing, Also
can you use an acces database on the same machine or do you have to connect
to a remote machine over some kind of network to use odbc.

Can anyone help.

Thanks

--
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: Logging visits using a database

2002-02-13 Thread Gurhan Ozen

Hi
I have never used it but sounds like analog would fit your needs pretty
well. Check them out at:
http://analog.sourceforge.net/

Hope this helps..

Gurhan


-Original Message-
From: Peter Lovatt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 6:29 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Logging visits using a database


Hi

Excuse the cross post

I am thinking about building a logging tool to do visit analysis using SQL,
rather than doing log file analysis.

The aim is to analyse requests for dynamic pages called via php as well as
static pages. Static pages will use an include for logging. Php calls may
have two or three extra parameters which relate to products that are
displayed (this is for ecommerce) which I also want to log. I am looking
particularly at HTTP_REFERER, paths through the site, and most viewed
products.

Questions

1. Am I reinventing the wheel? and would it be better to buy a package
(Spending money brings me out in a nasty rash, and leaves me feeling a
little unsteady on my feet, but is sometimes the best option), or use a free
one. The intended audience is non technical managerial type bods so nothing
too difficult to understand :)

2. If I do use an existing package, are there any that are good with dynamic
sites and the parameters passed to scripts, rather than just logging static
pages?

3. Writing a database driven stats package on a medium traffic site (3-500
visits a day, Average 8-12 pages per visit=6000 inserts a day, peaking at
2-3 per second ) will mean lots of inserts, and a few reads when the
analysis is run. Running MySql on a 1.5GHz 512MB machine, is it better to
leave the table unindexed and put up with slow analysis, or will the machine
cope with indexes? The data could be aggregated periodically, but if
possible left intact for up to a year to follow trends.

4. Is a (MySql?) database driven system a good answer, or just the wrong way
to go??

Any thoughts and experience much appreciated before I commit to hours of
work and gallons of coffee

Thanx

Peter


---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
---


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


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




RE: [PHP-DB] Form Validation

2002-02-14 Thread Gurhan Ozen

addslashes(), stripslashes(), strip_tags(), nl2br() , htmlspecialchars()
etc. etc ...
check PHP online documentation for more info on them..

But even without those functions, the data inserted thru form wouldn't crash
MySQL .. The worst that can happen is if the data has quotes or wrong format
etc. the data wouldn't be inserted into MySQL database..

Gurhan
-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 2:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Form Validation


Anyone know of a good function to strip characters and stuff that would
cause mysql to crash from forms?
Jas



--
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] mysql and auto_increment

2002-02-20 Thread Gurhan Ozen

Yes you sure can,..
When you insert a row just use one of the older values that no longer exists
on the table.. Alternatively, you can insert a blank value, mysql will
automatically set it to the next value after the highest one in the table
and then you can update it to one of the older values.

Gurhan


-Original Message-
From: Nautilis [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 10:26 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql and auto_increment


Hi everyone

My question is very simple, so i hope the answer will too :)

Well i have an index field in my table which is set as auto_increment. Well
question is, it's possible that mysql use values that have alredy been
deleted from older regs?

Thx in advance!




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

2002-02-21 Thread Gurhan Ozen

Hi Jenn,
The code looked ok to me , so I copied and pasted the code you posted and it
worked for me.. Where are you getting the parsing error? Is it the whole
code anyway?

Gurhan


-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 9:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Parse error


Can someone tell me why I am getting a parse error in this little snip?

Original value is $origVar";

$origVar += 25;
echo "Added a value, now it's $origVar";

$origVar -= 12;
echo "Subtracted a value, now it's $origVar";

$origVar .= " chickens";
echo "Final answer: $origVar";

?>

Thanks in advance
Jen Downey



--
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] Help on PHP vs JAVA

2002-02-21 Thread Gurhan Ozen

That's a pretty naive question to ask. For what specific task do you want to
compare them ? Besides if you can't write a comparison article on PHP vs.
JAVa , how can you set the outcome in PHP's favor?
  I would advise you to sit down and try to do the task both in Java and PHP
, and compare both . They both are free, they both are cross-platform, but
you can compare them in terms of their capabilities to do things,
performance, speed, easiness to write and maintain the code , etc.  And the
result would differ according to the project you are working on...

Gurhan


-Original Message-
From: Berlina [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 4:08 AM
To: php-general-list; php-dev-list; php-db-list
Subject: [PHP-DB] Help on PHP vs JAVA


Hello to everybody,

I need some help for writting a comparison of PHP vs JAVA, and of course, I
need that PHP wins
;-D

Any ideas?
Any comparison wrote?

Advanced Thanks,
F.P.

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

2002-02-21 Thread Gurhan Ozen

  Not enough information given to figure out what's going on, but looking at
your query i see:

"WHERE $cars =
"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dlr
_num\"");

 do you keep 6 different values separated by commas in the field referenced
by $cars??? If this is correct what values you are passing for all those
variables? Is the $cars variable set to a valid column name in the "test"
table?? What is the data type for the column that $cars references?

Gurhan

-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 12:26 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Parse Error


I hate to post this again but I have looked in a couple of php and mysql
books but cannot seem to figure this one out.  I am getting a parse error
when trying to use php to delete records from a table.  The error I am
recieving is as follows

Parse error: parse error in /path/to/php/done2.php3 on line 22

Here is the file that is giving me the error, any help would be great... I
think that my problem is that I left out a variable to hold the $cars data
but I am not sure.  Here is the code...

$db_name = "test";
$table_name = "inventory";
$connection = @mysql_connect("localhost", "root", "password") or die
("Could
not connect to database.  Please try again later.");
$db = @mysql_select_db("$db_name",$connection) or die ("Could not select
database table. Please try again later.");
$sql = "DELETE FROM $table_name WHERE $cars =
\"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl
r_num\"");
$result = @mysql_query($sql, $connection) or die ("Could not execute
query.

Any insight would be great... thanks again.
Jas




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

2002-02-21 Thread Gurhan Ozen

Jas..
First of all you don't have the variable $cars assigned..
Second of all, we still don't know what the "test" table looks like? Does it
only have one column with all the infos about cars populated in it???

Gurhan


-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 12:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Parse Error


Here is the code from the file that queries the db and pulls the current
contents of the db and provides a check box form for each record to delete
the items in the db.  I dont know if this will help but like I said before
any insight would be great.  Thanks in advance.
Jas


Current
Inventory";
$count = -1;
while ($myrow = mysql_fetch_row($result)) {
$count ++;
echo "Type Of Car: ";
printf(mysql_result($result,$count,"car_type"));
echo "remove
\n";
echo "Model Of Car: ";
printf(mysql_result($result,$count,"car_model"));
echo "\n";
echo "Year Of Car: ";
printf(mysql_result($result,$count,"car_year"));
echo "\n";
echo "Price Of Car: $";
printf(mysql_result($result,$count,"car_price"));
echo "\n";
echo "VIN Of Car: ";
printf(mysql_result($result,$count,"car_vin"));
echo "\n";
}
echo "";
?>

After this file is pulled and the user selects which record to delete it
jumps to the other snippit of code in done2.php3 which is

> > $db_name = "test";
> > $table_name = "inventory";
> > $connection = @mysql_connect("localhost", "root", "password") or die
> > ("Could
> > not connect to database.  Please try again later.");
> > $db = @mysql_select_db("$db_name",$connection) or die ("Could not select
> > database table. Please try again later.");
> > $sql = "DELETE FROM $table_name WHERE $cars =
> >
\"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl
> > r_num\"");
> > $result = @mysql_query($sql, $connection) or die ("Could not execute
> > query.
> >
> > Any insight would be great... thanks again.
> > Jas
> >
> >
> >
> >
> > --
> > 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] Parse Error

2002-02-21 Thread Gurhan Ozen

Ok then it sure will not work.. because you have :

"DELETE FROM $table_name WHERE $cars
=\"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$d
lr_num\"");

1- $cars is set to the value "checkbox" which doesn't exist in your test
table
2- The end of the statement $dlr_num\"");  is not right , that
parenthesis isn't supposed to be there
3- The delete statement is wrong...You are storing all that info in the
separate fields but you are giving all combined as a condition in only one
field ($cars).
3- Rewrite your delete statement to delete the rows identified by the id
column as "DELETE FROM $table WHERE id ='id'"; Of course in the page where
you list the cars to be deleted associate each checkbox with the car's id.

Hope this helps..

Gurhan


-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 1:02 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Parse Error


Here is the dump for the cars table...
test (
   id varchar(30) NOT NULL auto_increment,
   car_type varchar(30),
   car_model varchar(30),
   car_year varchar(15),
   car_price varchar(15),
   car_vin varchar(25),
   dlr_num varchar(25),
   PRIMARY KEY (id),
   KEY id (id)
test VALUES ('1', 'Ford', 'Bronco', '1969', '4500', 'vin897655', 'none');

Sorry about that... still a bit of a newbie here. =)
Jas

"Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Jas..
> First of all you don't have the variable $cars assigned..
> Second of all, we still don't know what the "test" table looks like? Does
it
> only have one column with all the infos about cars populated in it???
>
> Gurhan
>
>
> -Original Message-
> From: jas [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 21, 2002 12:48 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Parse Error
>
>
> Here is the code from the file that queries the db and pulls the current
> contents of the db and provides a check box form for each record to delete
> the items in the db.  I dont know if this will help but like I said before
> any insight would be great.  Thanks in advance.
> Jas
>
>  require '../scripts/db.php';
> $result = mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not
> execute query, please try again later");
> echo " name=\"rem_inv\" method=\"post\" action=\"done2.php3\">
> Current
> Inventory";
> $count = -1;
> while ($myrow = mysql_fetch_row($result)) {
> $count ++;
> echo "Type Of Car: ";
> printf(mysql_result($result,$count,"car_type"));
> echo " value=\"checkbox\">remove
> \n";
> echo "Model Of Car: ";
> printf(mysql_result($result,$count,"car_model"));
> echo "\n";
> echo "Year Of Car: ";
> printf(mysql_result($result,$count,"car_year"));
> echo "\n";
> echo "Price Of Car: $";
> printf(mysql_result($result,$count,"car_price"));
> echo "\n";
> echo "VIN Of Car: ";
> printf(mysql_result($result,$count,"car_vin"));
> echo "\n";
> }
> echo " value=\"delete\">";
> ?>
>
> After this file is pulled and the user selects which record to delete it
> jumps to the other snippit of code in done2.php3 which is
>
> > > $db_name = "test";
> > > $table_name = "inventory";
> > > $connection = @mysql_connect("localhost", "root", "password") or die
> > > ("Could
> > > not connect to database.  Please try again later.");
> > > $db = @mysql_select_db("$db_name",$connection) or die ("Could not
select
> > > database table. Please try again later.");
> > > $sql = "DELETE FROM $table_name WHERE $cars =
> > >
>
\"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl
> > > r_num\"");
> > > $result = @mysql_query($sql, $connection) or die ("Could not execute
> > > query.
> > >
> > > Any insight would be great... thanks again.
> > > Jas
> > >
> > >
> > >
> > >
> > > --
> > > 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


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




RE: [PHP-DB] Errors Deleting...

2002-02-21 Thread Gurhan Ozen

Jas,
You still have cars as your checkbox name.. change it to id..
and make sure that you assign $table_name to the table name you want to
delete from in your done2.php3 file..

Gurhan

-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 3:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Errors Deleting...


Can someone tell me how I can find out why I am getting errors executing
queries when I try to delete items from a table?  I have 2 files...
file 1. - Queries database, displays results with option to delete record
using a check box, code is as follows...

Current
Inventory";
$count = -1;
while ($myrow = mysql_fetch_row($result)) {
$count ++;
echo "Type Of Car: ";
printf(mysql_result($result,$count,"car_type"));
echo "remove
\n";
echo "Model Of Car: ";
printf(mysql_result($result,$count,"car_model"));
echo "\n";
echo "Year Of Car: ";
printf(mysql_result($result,$count,"car_year"));
echo "\n";
echo "Price Of Car: $";
printf(mysql_result($result,$count,"car_price"));
echo "\n";
echo "VIN Of Car: ";
printf(mysql_result($result,$count,"car_vin"));
echo "\n";
}
echo "";
?>
file 2. - takes variable of checkbox and then queries db trying to delete
any record based on the id.  code is as follows...

I have been trying everything under the sun and cannot get this to work.
please help.
Jas





--
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] I have a " in my db ?

2002-03-06 Thread Gurhan Ozen

Hi,
Can u please give us more information?? Are you trying to insert data into
database or pull data out of database.. Also can you show the queries you
are using???
Thanks,

Gurhan


-Original Message-
From: Dave carrera [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 12:38 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] I have a " in my db ?


Hi All



I think this has something to do with either



Stripslashes or Addslashes but which one. And where do I use it.



I have a product that has a " in the name and I have created a drop down
list from the names.



I cant get it to reg the name. all it reg is 15" instead of th full name
which is 15" lcd Monitor.



How do I get past this issue



The php manual has no usage examples relevant to my needs.



Please help



Dave c



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




RE: [PHP-DB] Difficulty on how to extract data out of a text withstring functions.

2002-03-06 Thread Gurhan Ozen

Hi Andy,
The little snippet you showed from the text file made me think that the data
layout for each  country is not consistent.
For example:
For Algeria there is the country name and right underneath goes the info
about yellow fever and malaria as opposed to American Samoa where underneath
the country name is capital and altitude.. IS this the case? If it is, can
you reorganize the data to be consistent and even same number of lines for
each country? IT will make you life heck a lot easier to have a pretty
consistent data layout to do what you need to do...
 In addition, can you tell us what OS yo are using? I don't know if PH is
the best and/or right choice to do this, but if you are in *NIX shell
scripting can be useful.
  Thanks..

Gurhan

-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 1:50 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Difficulty on how to extract data out of a text with
string functions.


Hi there,

I want to include some data into my website which covers malaria and yellow
feewer related to each country. On the WHO website are all the infos I need.
Their webmaster told me that unfortunatelly there is no db behind that and
everything gos with html files. But I am free to extract that data.

Well, I did create a txt file which looks more or less like that:

ALGERIA
Yellow fever: A yellow fever vaccination certificate is required from
travellers over 1 year of age coming from infected areas.
Malaria: Malaria risk is limited. One small focus (P. vivax) has been
reported in Ihrir (Illizi Department), but this is isolated and access is
difficult.
Recommended prophylaxis: none.

AMERICAN SAMOA
Capital: Pago Pago
Altitude: 10 m
Yellow fever: A yellow fever vaccination certificate is required from
travellers over 1 year of age coming from infected areas.

Now I have a table in a MySQL db naming all those countries. The goal is to
extract the Yellow fever and Malaria line and put it into a mysql table
related to the countries.

I saw that PHP has some good functions on text, but do u guys think this
could be done??? Doing it by hand could take alng loong while.

I am open for any idea!

Thanx a lot for any help

Cheers, Andy



--
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] Difficulty on how to extract data out of a text withstring functions.

2002-03-06 Thread Gurhan Ozen

Yeah it is getting really off the topic i will email you in private.. :)

Gurhan
-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 3:28 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Difficulty on how to extract data out of a text
with string functions.


Hello Gurhan,

thanx for your help. You are right, the file is not consistent. But some
things are. For example that every line contains

one data set and that every line begins with the name of the column I would
like to have followed by a :

I could yous win32, linux rh72 and osx to do this. The question is what
would be the fastest way.

I never heared of unix shell scripting, but I asume it is something what
youwould call a batch file in win or apple script on mac.

Thanx again for your help.

Andy


"Gurhan Ozen" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Andy,
> The little snippet you showed from the text file made me think that the
data
> layout for each  country is not consistent.
> For example:
> For Algeria there is the country name and right underneath goes the info
> about yellow fever and malaria as opposed to American Samoa where
underneath
> the country name is capital and altitude.. IS this the case? If it is, can
> you reorganize the data to be consistent and even same number of lines for
> each country? IT will make you life heck a lot easier to have a pretty
> consistent data layout to do what you need to do...
>  In addition, can you tell us what OS yo are using? I don't know if PH is
> the best and/or right choice to do this, but if you are in *NIX shell
> scripting can be useful.
>   Thanks..
>
> Gurhan
>
> -Original Message-
> From: Andy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 06, 2002 1:50 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP-DB] Difficulty on how to extract data out of a text with
> string functions.
>
>
> Hi there,
>
> I want to include some data into my website which covers malaria and
yellow
> feewer related to each country. On the WHO website are all the infos I
need.
> Their webmaster told me that unfortunatelly there is no db behind that and
> everything gos with html files. But I am free to extract that data.
>
> Well, I did create a txt file which looks more or less like that:
>
> ALGERIA
> Yellow fever: A yellow fever vaccination certificate is required from
> travellers over 1 year of age coming from infected areas.
> Malaria: Malaria risk is limited. One small focus (P. vivax) has been
> reported in Ihrir (Illizi Department), but this is isolated and access is
> difficult.
> Recommended prophylaxis: none.
>
> AMERICAN SAMOA
> Capital: Pago Pago
> Altitude: 10 m
> Yellow fever: A yellow fever vaccination certificate is required from
> travellers over 1 year of age coming from infected areas.
>
> Now I have a table in a MySQL db naming all those countries. The goal is
to
> extract the Yellow fever and Malaria line and put it into a mysql table
> related to the countries.
>
> I saw that PHP has some good functions on text, but do u guys think this
> could be done??? Doing it by hand could take alng loong while.
>
> I am open for any idea!
>
> Thanx a lot for any help
>
> Cheers, Andy
>
>
>
> --
> 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] Is this possible in mysql?

2002-03-08 Thread Gurhan Ozen

Leif,
IF i understood this correctly you would like to add up the values of a
particular column and return it to PHP with a different name right?

You can do:
$query="select sum(column_name) as nameyouwant from tablename"; // this will
return the sum of the column in a column called nameyouwant
$result=mysql_query($query);
$row=mysql_fetch_row($result); // fetching it into array so you can use it..

$sumofnumber=$row[0];

Of course you can use other alternatives to mysql_fetch_row() function. See
PHP manual SEction LXI (MySQL functions) for this..
Is this what you are looking for??


Gurhan

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 08, 2002 2:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Is this possible in mysql?


I need to add up the (integer) values of columns, and return the added up
value as one column to php.  Is this possible?  Or is there something else
to do it? (I'd rather not have to mysql_fetch_array() in a while loop and
add it up there, it might be a lot of rows)


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

2002-03-13 Thread Gurhan Ozen

you can do it by using distinct function ..
Do:
SELECT DISTINCT(city) FROM addresses;


Gurhan


-Original Message-
From: Kevin Diffily [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 2:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] SQL Question


Hello,

I have a simple SQL Question.  I would like to take the column city in
database addresses and find out which cities are available in it.  In other
words if the following values are in there:

city
El Paso
Burlington
New York
New York
El Paso
Burlington

I would like it to return
El Paso
New York
Burlington

I know that it would something like
SELECT `city`
FROM `addresses`
WHERE ??


Thanks

Kevin Diffily
InterNetWorkingSolutions
Enterprise Class Solutions for All Enterprises

318 Last Road, Cabot, VT 05647 USA
VOICE: 1.866.inetws.net (Toll Free)
FAX:   1.888.726.9030?  (Toll Free)

Sales:  [EMAIL PROTECTED]
General Information:[EMAIL PROTECTED]
Website Hosting:[EMAIL PROTECTED]
Systems Administration Services:   [EMAIL PROTECTED]
Technical Support & Training Services:  [EMAIL PROTECTED]
Shop For it On Amazon:http://kevin.inetws.net/amazon
Instant Messaging Username:
AIM, IRC, Jabber, MSN, Yahoo:  inetwsnet
ICQ: 120778694



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




RE: [PHP-DB] Random Selecting from mySQL

2002-03-13 Thread Gurhan Ozen

are you just looking for a way to display 10  results per page? If yes then
you can just use LIMIT to limit your result to 10 .. So, for the first page,
you can do "SELECT  LIMIT 1, 10;" and for the second page "SELECT ...
LIMIT 11, 20" etc etc .
  You can sure use "ORDER BY" with "LIMIT" to to sort the results for a
given criteria ..

Gurhan


-Original Message-
From: Georgie Casey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 2:00 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Random Selecting from mySQL


I know how to use the "ORDER BY rand()" command on the end of queries to
randomize selection, but that's no good when you want to only display 10
results per page. The next page the user chooses, randomizes again and could
show duplicate fields and not at all show other fields.

Does anyone know a way round this?

--
Regards,
Georgie Casey
[EMAIL PROTECTED]

***
http://www.filmfind.tv
Ireland's Online Film Production Directory
***



--
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] IFNULL used in a UPDATE

2002-03-13 Thread Gurhan Ozen

Hi Jane,
No questions are lame.
The statement you wrote down wouldn't work as IFNULL() function doesn't work
the way you intended. See
http://www.mysql.com/doc/C/o/Control_flow_functions.html  for this..

I would accomplish it in two statements. Here it is:

SELECT (@a:=(CASE box1 WHEN '' THEN NOW() ELSE box1 END)) from users;
UPDATE users SET box1=@a, box2=NOW() WHERE email='[EMAIL PROTECTED]';

I hope this helps..

Gurhan


-Original Message-
From: jane [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 12:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] IFNULL used in a UPDATE


Hello, I am new to SQL so I hope this is not a lame question.

I want to UPDATE two fields ('box1' & 'box2') in table 'users'.
One field I want to always set the current time.
The other field I want to put the current time ONLY if it has the value
NULL.

Here is my attempt:

UPDATE users SET IFNULL(box1 = NOW()), box2 = NOW() WHERE eMail =
'[EMAIL PROTECTED]'

Any help would be greatly appreciated.
Jane.

Using:  MySQL 3.22.27



--
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] Random Selecting from mySQL

2002-03-13 Thread Gurhan Ozen

Hi!
Do you have a primary key field in the table? If yes, you can after
displaying the first 10 records you can put the primary key values of those
records in an array and have "primary_key_fiels NOT IN
(array_values_seperated_by_commas)" in your quesry.. So when you display
your first page with 10 records, then you won't have any restricting values
because the array will be empty. When you display it second time then you
will have the first 10 records excluded and your array will be populated 20
values so that when you display the third page thos 20 will be excluded and
vice versa.. Did I confuse you enough?:)
  I hope this helps..

Gurhan


-Original Message-
From: Georgie Casey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 7:11 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Random Selecting from mySQL


yea, i know how to display 10 results per page, but that doesnt work when
you want to do a ORDER BY rand() query.

"Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> are you just looking for a way to display 10  results per page? If yes
then
> you can just use LIMIT to limit your result to 10 .. So, for the first
page,
> you can do "SELECT  LIMIT 1, 10;" and for the second page "SELECT ...
> LIMIT 11, 20" etc etc .
>   You can sure use "ORDER BY" with "LIMIT" to to sort the results for a
> given criteria ..
>
> Gurhan
>
>
> -Original Message-
> From: Georgie Casey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 13, 2002 2:00 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP-DB] Random Selecting from mySQL
>
>
> I know how to use the "ORDER BY rand()" command on the end of queries to
> randomize selection, but that's no good when you want to only display 10
> results per page. The next page the user chooses, randomizes again and
could
> show duplicate fields and not at all show other fields.
>
> Does anyone know a way round this?
>
> --
> Regards,
> Georgie Casey
> [EMAIL PROTECTED]
>
> ***
> http://www.filmfind.tv
> Ireland's Online Film Production Directory
> ***
>
>
>
> --
> 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] DB Class pointer as var in another class

2002-03-14 Thread Gurhan Ozen

Hi Gary,
I didn't understand what you were actually trying to do here.. You stated
that "Our goal here is to minimize the number of database connections per
function call." but seems like you are connecting to the database in the
constructor? So each instance will automatically connect to the DB??
  Why don't you write a DB connection class and inherit it for every other
class you need to write so that all of its functions will be available in
the derived class as well and so that you won't have to call the class
inside another class?

Gurhan


-Original Message-
From: Gary Cornelisse [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 14, 2002 12:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] DB Class pointer as var in another class


We've been considering the following implementation of a class pointer
within another class.  Our goal here is to minimize the number of database
connections per function call.  It seems to work just fine, but I wanted to
post this up for comments.  PHP 4.1.1 doesn't seem to have a problem with
it.  We have a couple classes working this way in some of our beta code.
I've never seen anyone do this before so I just wanted to make sure we
weren't wandering into uncharted waters.

class my_class
{
var $test;
var $db_class;

function my_class($test)
{
$this->test = $test;
$this->db_class = new database_class(DB_NAME);
}

function get_db_info()
{
... use db here via $this->db_class ...
}
}

Thanks,
Gary



--
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] Is there a better way to do this?

2002-03-15 Thread Gurhan Ozen

Hi,
Why don't you add another column to your "items" table for the item
name..Then you can just fetch each row to an array and call it by
$row["item_name"] ?
 For better explanation:
 Say you added a column to hold item names in your items table called
item_name ...
 I have no idea how you query items table based on which customers has what
items because you stated that there was only coumn in items table, but if
you were to query everything in the items table, you'd do:

  $query="select * from items";
  $result=mysql_query($query);
  $num_results =  mysql_num_rows($result);

  for($i=0; $i < $num_results; $i++)
  {
$row = mysql_fetch_array($result);
// then you can reach item number and item name just by calling them
$itemnumber= $row["number"]; //assuming that the column that holds the
item numbers has the name number
$itemname= $row["item_name"]; // assuming that the column you'll add for
item names will have the name iten_name
   }


  Does this make sense to you? Or are you looking for something else? Let us
know...

 Thanks,
 Gurhan


-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 15, 2002 1:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Is there a better way to do this?


I operate a small game site for kids.  On this site, the players  can, among
other things, buy virtual items.  I have each item stored in a table called
"items" in a mysql database.  The type is one column in that table, but it
is a number, not a name.  When I want to display items with the item name, I
have to send a query to the item_types table to get the type name.  The
problem is, if a user has 50 items, it takes 50 queries to get the types.
Is there any better way?

--
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] SQL statement - PHP/mySQL - brain fart

2002-03-18 Thread Gurhan Ozen

ok it is 1:37 am here and i have been up since 6:00 am (the day before) and
have to be awake ths mornign again at 6:00 am so if I make any mistakes
trying to answer your question, please take it easy:)

I was wondering if you'd wanna use temporary tables to accomplish it..

You may wanna do:

CREATE TEMPORARY TABLE tmp1 SELECT * FROM site_category WHERE
category_id=$category_id_1;

ok this will give us the records that matches $category_id_1 in category_id
field put them into a temporary table called tmp1 Then do:

CREATE TEMPORARY TABLE tmp2 SELECT * FROM site_category WHERE
category_id=$category_id_2;

and this will give us the records matching $category_id_2 in category_id
field and put them into a temporary table called tmp2..

Now you have 2 temporary tables, tmp1 and tmp2 as shown below:

tmp1:
+--+--+--+
| sci  | si   | ci   |
+--+--+--+
|1 |2 |   10 |
|4 |4 |   10 |
+--+--+--+

tmp2:
+--+--+--+
| sci  | si   | ci   |
+--+--+--+
|3 |4 |   12 |
|5 |5 |   12 |
+--+--+--+


Now you can use use join syntax to find the si value thats common to the
both tables...

select * from tmp1, tmp2 where tmp1.si=tmp2.si;

Does this work for you??

Gurhan


-Original Message-
From: Summit [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 18, 2002 9:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] SQL statement - PHP/mySQL - brain fart


For some reason I keep thinking that this should be simple - but I just
can't seem to figure it out.  Help???  Please???  [I've been working on
it for two days now.]

Overview:  What I'm trying to do is query one table by passing it two
different variables - and return only the results that are COMMON to
both variables.  [PHP 4.1.2/mySQL 3.23.44/FreeBSD]

Assume I have a site_category table:

---
site_category
---
site_category_id
site_id
category_id
---

Perhaps a dump of this looks something like this:

--- ---
site_category_idsite_id category_id
--- ---
1  2   10
2  3   11
3  4   12
4  4   10
5  5   12
6  5   14
--- ---

Using values for the varibles I'm passing to the query (see below) of
...

$category_id_1 = 10
$category_id_2 = 12

... the result I'm looking for is:

site_id = 4

... as this is the only site_id which is common to both ...

category_id = 10
category_id = 12

I've tried a bazillion variations on the following query:

SELECT  sc.*
FROMsite_category sc
WHERE   (sc.category_id = $category_id_1 OR sc.category_id =
$category_id_2)

Breaking out the parts ...

So, if category_id_1 = 10, I'm returned:

site_id = 2
site_id = 4

So, if category_id_2 = 12, I'm returned:

site_id = 4
site_id = 5

How can I get that "4" which you can clearly see is common to both of
the parts above?

But just about no matter how I write my queries, I keep getting:

site_id = 2
site_id = 4
site_id = 4
site_id = 5

Or if use SELECT DISTINCT we get:

site_id = 2
site_id = 4
site_id = 5

[I want that extra 4 that the "DISTINCT" threw out!!!]

I keep thinking that I can do this in a single query - but I don't know
for sure.  I've tried sub-selects with no luck [E.g. IN()].  Do I need
to do something with arrays and array_intersect?  [I've even tried
messing with the PHP3 hacks for array_unique - trying to reverse them 'n
stuff - but still no luck.]

Does anyone have a simple solution?  [I'll even take a hard solution -
but I keep thinking that I'm just looking at the the wrong way.]

TIA,

Summit



There is no such thing as a stupid person -
   there are only those who choose not to learn!
   Summit - [EMAIL PROTECTED]


--
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] Filesystem functions and mysql

2002-03-19 Thread Gurhan Ozen

  Hello Tom,
 First of all, since you are keeping the filepaths and filenames you don't
need to worry about any of the filesystem functions.. You just need to
replace variables in the right places in your output HTML code.
 As for how to implement what you need, I will give you a different tip.
Write a php script to randomly select and display images. You can either use
PHP's random functions to accomplish this or if you will store filepath,
filename info in a MySQL database then you can accomplish this by issuing:
"SELECT ... FROM ... ORDER BY RAND() LIMIT 1;" Then you can just stick in
meta refresh tag in your html output and set the value to 15 or 30 seconds..
  So now you have a php page that randomly selects an image and displays it
and refreshes for every 30 or 15 seconds..
  Then in your main HTML page where you want this to be displayed , use
 tags to stick that PHP page in And you have it on
whereever you want to have:)
  Hope this helps..

  PS. You may wanna stick all filenames into an array and use shuffle()
function as an alternative it thats easy for you..

Gurhan


-Original Message-
From: tom hilton [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 10:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Filesystem functions and mysql


Hi, I'm working on a website for a local tennis group, and we are raising
money to offset website costs through sponsorships.  I have created some 15
and 30 second GIF's for the sponsors, and would like to create a function
that loads the files in random order when the page is opened.  I am creating
a mysql table with file number, file location, file name info, that will be
pulled when the page loads.  I know there are random number functions I can
use, but I haven't ever worked with the filesystem functions.  What
functions would I need to first open the selected file, then move on to the
next file  in the array, once the previous one has closed, and then continue
looping through this array of files until the page is closed?  Any
suggestions or help would be greatly appreciated.



--
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] Need Help with returning new id's

2002-03-19 Thread Gurhan Ozen

Hi,

Did you copy and paste your code?IF yes, I have noticed a problem on the
code you posted.. Y
The line:

$run_query  = ($maxid,$db_connect);

will fail as you didn't put the function name in. Rewrite it as:
$run_query  = mysql_query($maxid,$db_connect);

Gurhan


-Original Message-
From: Jason McCormack [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 1:31 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need Help with returning new id's


Hello All,

I am trying to return the largest id for a table and then print the value to
a page. My query works fine in MySQL, the problem is getting the value to
show in a web page with php. This is what I am trying to process.

TABLEID | VALUE
1   | Test
2   | Test 2
3   | Test 3

In the sample table above I am trying to pull back a value of 3 and print to
a web page via php.

$maxid = "select max(tableid) from table as largestid";
// db_connect is my database connection. I know this works because I have
other pages that return
// results based on my queries without any problems
$run_query  = ($maxid,$db_connect);

This is were I get a bit lost. I have tried using all sorts of various mysql
functions without success

$row = mysql_fetch_row($run_query);
$mymaxidvalue = $row[0];
echo $mymaxidvalue;

As I stated above I have tried many different ways to get the desired
results but have been unsuccessful. Any help would be greatly appreciated.

Thanks,
Jason



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

2002-03-28 Thread Gurhan Ozen

I don't know if you can do in one INSERT INTO statements per se in Oracle,
try to separate insert into statements with semicolon(;) .. Or if you will
insert the data that is already in another table  you can use INSERT INTO
... SELECT ... FROM ... syntax.

Gurhan


-Original Message-
From: Chris Andrew [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 8:15 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Oracle INSERT


Hi,

This is probably more of a topic for the Oracle groups - however:

This gives me an error:
$c1  = ocilogon("chris","chris01");
$sql = "INSERT INTO tblTest VALUES(1,'Test One'),(2,'Test Two')";
$stat= ociparse($c1,$sql);

It would appear my INSERT syntax is illegal under Oracle.

Qu: How can I INSERT multiple rows with ONE statement?

Thanks in advance.
Chris

--
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] MySQL, PHPand cron

2002-03-28 Thread Gurhan Ozen

Hi Jenn,
There are a couple  ways you can do this.
You can write a unix shell script and run it periodically at the cron.
Here:

#!/bin/mysql

query="DELETE FROM tablename"

/usr/bin/mysql -u USER -pPASSWORD -D database -e "$query"


And then you can just put this script into cron, see:
http://www.faqts.com/knowledge_base/view.phtml/aid/1005/fid/436

Or you can do the same in the PHP script and call PHP script in command
line.. See the below links for this:

http://www.php.net/manual/en/commandline.php
http://www.phpbuilder.com/columns/darrell2319.php3


Gurhan


-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 2:32 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL, PHPand cron


Hi all,

Wondering if anyone might know how to empty a table with a php script and
cron job?
Would someone point me to a tutorial or help with this?

TIA
Jennifer



--
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] How to link a MYSQL table to a dbase file

2002-04-04 Thread Gurhan Ozen

Hi Marij,
Cron is a tool in UNIX/LINUX server used to execute commands/programs
automatically in a fixed period basis. You can always read unix man pages to
learn more , just type man cron and man crontab. You may also want to see
this link:

   http://www.faqts.com/knowledge_base/view.phtml/aid/1005/fid/436

Gurhan Ozen
MCI WorldCom
Quality Assurance Team
[EMAIL PROTECTED]
ph:   703-449-4754
Vnet: 228-4754
AIM:  Greywolf1923

-Original Message-
From: Marij Bellen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 04, 2002 9:57 AM
To: Php-Db@Lists. Php.Net (E-mail)
Subject: Re: [PHP-DB] How to link a MYSQL table to a dbase file


I run my site on a linux webserver.
I don't really know what a cron is?
I can also get a csv file.
I also have a function to translate the dbase-file to sql.

Is a cron a tool or whatever to automatically load data into the database?

==
Can you use a cron (Unix) or at (Windows) job to dump the dbase data to a
 comma-separated-value table? Then suck up the csv into the mysql databasde.

=
>
> How can I extract data for a mysql-table from a dbase file?
>
>
> This is the situation:
> 1) we have a dbase-file with data
> 2) the dbase-file is put on the server
> 3) we have a mysql-table that needs to get his data out of this
dbase-file.
>
> How can I link this mysql-table to this file!
>
> !!note:
> ---
> I don't mean how I can put the data of the dbase-file into the table,
> but the table should be linked to the dbase file to get its data!
>
> Background:
> ---
> we want to upload a file with data from our own local database each night
> to our internet-mysql-database.
>
> In MS-access such a file is called a 'external table.'
>
> If this isn't possible and we don't have the ability to use the
> php-dbase-functions (because of our provider),
>
> is there another solution to get the data from the dbase-file
automatically
> in the mysql-database?
>
> Can you help me!!
>
> Thanks.
>
>
>
> --
> 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] how to change a column to ENUM

2002-04-07 Thread Gurhan Ozen

Hi Andy,
That statement won't work because you have to provide the possible values
for the enum colummn. Say you can only have Y or N or that field, that you
need to type:

ALTER TABLE `test` CHANGE `field` `field` ENUM('Y','N');

By the way, if you have 250 different possible entries , I would say not to
go with ENUM, but then again it is all depend on you, and your company's
policies.


Gurhan


-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 06, 2002 7:18 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] how to change a column to ENUM


Hi there,

I did just do a procedure anlyse to my table and figured out that the best
type would be enum.

I tryed:
ALTER TABLE `test` CHANGE `field` `field` ENUM

but I am getting an error: You have an error at your sql sytax at ""

Is this column type even possible, because I have over 2million entries,
while the field has only 250 different values.
Is this type really faster? Currently my structure looks like this:

idmedium_int(9)
field1 char50
field2 char2
field3 char2

Field 1 contains about 1.5 million different entries.

Thanx for any help,

Andy



--
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] help with insert needed

2002-04-07 Thread Gurhan Ozen

Hi Djordie,
You need to have the connection to the DB in your php script
leksikon_in.php .

Gurhan


-Original Message-
From: Djordje Gacesa [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 07, 2002 9:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] help with insert needed


Hello, everybody!

I wrote some php scripts which are attached in php.zip file and there is
also one important html (with forms for insert). All help and suggestions
are appreciated.

Just a note: system is on a Linux Slackware 8.0, with precompiled source of
apache-1.3.20 and php-4.0.5 with tar.gz installation of mysql-3.23.47-log
downloaded from mysql's site. After the installation mysql startup scripts
needed some rearranging and rewriting until it started to work.

So, I wrote a few scripts which duties are as following:
1. leksikon_out.php -- gets data out from the leksikon database (OK)
2. leksikon_in.php -- puts the data into the leksikon database (this piece
doesn't work)
3. auth.php -- checks if the password is OK, and opens a persistent
connection to mysql database (OK)
4. enough.php -- cloeses the connection to the database
(register_shutdown_function() is used) (OK - it really closes the
connection)

As far as I know, until the connection is closed $server, $user, $database
and $connection are somewhere in memory and can be used in any script. After
writing data into the fields of leksikon_in.html file, and hitting Send
button, all that PHP & mySQL are giving to me is "No Database Selected". And
so on.

Even when I uncomment those three commented lines, nothing changes - it
remains the same.

I've tried the insert statement on the command line of mysql, and guess
what - IT WORKED! What confuses me is that it doesn't work inside PHP. I've
spent 5 hours on that single line, changing it over and over, but i haven't
manage to make a move of one milimeter.

Help, please. Thanks.





_
Nekada sam bio ljudsko biće... Onda sam dobio modem.

djole
icq#_34153905
[EMAIL PROTECTED]





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




RE: [PHP-DB] Regular Expressions

2002-04-07 Thread Gurhan Ozen

What are you trying to do? an where is your pattern? are you trying to match
any character followed by 2 to 20 any characters  in the $string variable?

Gurhan


-Original Message-
From: Ilhan Guvener [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 07, 2002 11:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Regular Expressions


Hello

 I'm writing a code for limiting a string input and for that I'm using reg.
ex. but I have a problem:

 $string = "emramile";
  if(!(preg_match("/.{2,20}/","$string"))) {
print "error";
  }
  else {
print "OK";
  }

I wrote this code but it's not working. I couldn't find what the problem is.
I'll be glad if anybody help me.



See Dave Matthews Band live or win a signed guitar
http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201
/splash.asp

--
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] if else question

2002-04-07 Thread Gurhan Ozen

Hi Jenn,
Since the function mysql_num_rows returns an integer, you can't just say if
(mysql_num_rows($result)) ...
Try to get the number of the rows and write an if statement according to
that, or you can use something like
while(mysql_fetch_array($result))
{
.
}

Gurhan

-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 07, 2002 6:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] if else question


Hi all,

Just wondering if something like this is valid. If not how can I make it
valid?

if (mysql_num_rows($result) and (mysql_num_rows($ret) == 0)

Thanks
Jennifer


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002



--
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] Any way to do this with a minimum of queries?

2002-04-12 Thread Gurhan Ozen

Ok, if I understood correctly you have two tables one just logs IP addresses
and usernames and another having user information, correct?
 If thats the case, just alter your users table to add an IP column (and
user name column as well if needed) and use INSERT INTO ... SELECT ...
syntax to populate the IP column in users tables with the values in IP
table..
See: http://www.mysql.com/doc/I/N/INSERT_SELECT.html  for this.
 And in your PHP script just have both of your insert statements to insert
to the users table consistently.
  However this may ended up making your users table have a lot of NULL
values if hte number of records in both tables don't match.
Gurhan

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 12, 2002 5:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Any way to do this with a minimum of queries?


I log IP addresses on my site, along with the persons username.  Right now,
they are logged in a seperate table, but I would like to store them in my
users table now.  I can't start my ip logging again, since the list of ips
is also used for a hit counter.   What is a good way (if there is one) to
transfer those ips with a minimum of queries?  I use a mysql database.
Thanks!

--
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] Cross DB application

2002-04-15 Thread Gurhan Ozen

Hi Arcadius,
If you know Object-oriented programming , you can write a class that
includes both MySQL and PostGreSQL functions and you can inherit from that
class.
Or, you can just stick all mysql, postgresql functions in a functions.php
file and include that file to be able to use the functions. I guess it would
work best if you have a configuration file where the user chooses either DB
and your code uses the corresponding function for that database.
I am sure there are database wrapper classes for php to address your issue
somewhere on the net , I just don't know where, since i have never searched
for it. I will personally email you if i come across any ...

Gurhan


-Original Message-
From: Arcadius A. [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 15, 2002 7:56 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Cross DB application



Hello !
I'm planning to write a database application for  MySQL, and then port it to
PostrgeSQL.
Is there any library or class that could help me to write/maintain just one
source code for both MySQL and PostgreSQL ?

Thanks.

ARcadius



--
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] Delete from mysql table is there a way to....

2002-04-16 Thread Gurhan Ozen

The tables gets fragmented as deletions, updates take place on a table. If
the DB operations get slower on a table, there is a good possibility that
the table has been fragmented.. If you are using MySQL , you can use CHECK
TABLE or myisamchk periodically to check your tables.
See: http://www.mysql.com/doc/m/y/myisamchk_syntax.html
and
 http://www.mysql.com/doc/C/H/CHECK_TABLE.html
for more info..

Gurhan

-Original Message-
From: Lisi [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 5:35 PM
To: Frank Flynn; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Delete from mysql table is there a way to


Thanks for the explanation! Very clear.

How do you know how fragmented your DB is? I apologize if this is covered
somewhere, like I said I was very confused buy this whole topic.

Thanks,

-Lisi




At 01:00 PM 4/16/02 -0700, Frank Flynn wrote:

>Picture a Church, full of pews.  This is your empty table.  As people (your
>data) come in to the church they fill the pews but unlike real life the
>first person goes all the way to the left hand side of the first pew, the
>second sits next to them and the third...  When one pew is full they start
>to fill the second pew and so on. There is no empty space.
>
>Now if you want to delete some data it's like a person leaving the Church.
>If it was the last person in fine but if you're deleting a particular row
>(as you most certainly would be) it's like a person getting up out of the
>middle of a pew and leaving.
>
>Now there is a hole there, the next person coming in will still be seated
in
>the back and now you delete a few more rows (a few more people leave) and
>you have "Fragmentation" which is holes in the data as it's stored.  This
is
>not a problem with the data but the table takes up more space than it
>otherwise could.
>
>Q - So why doesn't the database use the empty space in the middle of the
>table?
>
>A - Sometimes it will but usually not because it would take too long to
find
>it (when you want to save a new record you don't want to search through a
>large table for an empty space)
>
>This fragmentation can also happen when you update a record especially if
>you use varchar datatypes because they can change size - if you updated a
>record that had a field with the value "hi" and  you set it to "hello
world"
>this record would not fit in the same space it came out of.  Not a problem
>for the  DB but it will delete the old record and save it in a new space
>(leaving the hole).
>
>This gets more complicated if you have the data "Clustered" - that is
sorted
>in a particular order.  But the same idea applies when you add, update or
>delete data you wind up with blank space in your database.  Sometimes you
>actually want to put empty space into your table because you know you'll be
>updating the records and they will grow - typically this is called a
>"Fillfactor" and you could set it to 70% meaning 30% of your table will be
>empty and available for use.
>
>This kind of fragmentation is unavoidable and when it becomes a performance
>problem you "reorganize" your table.  Some DBMS have special commands to do
>it otherwise you can dump, truncate and reload the table.
>
>But I'll suggest that fragmentation up to 50% isn't really a big problem.
>If it is noticeable at 50% I'd suggest you're probably not using an index
>properly.
>
>Good Luck,
>Frank
>
> >
> > From: Lisi <[EMAIL PROTECTED]>
> > What exactly does it mean when a table becomes fragmented? How do you
know
> > when it's happened and something should be done? All the docs and books
> > talk about how bad it is but I'm still confused on what this is and when
it
> > happens.
> >
> > Thanks,
> >
> > -Lisi
> >
> >
> > At 05:00 PM 4/14/02 -0700, Jennifer Downey wrote:
> >> Hi all,
> >>
> >> Is there a way to delete a record from a mysql table without
> fragmenting the
> >> db?
> >>
> >> Here is the query I am using and it does a horrible job. Fragment city.
> >>
> >>
> >>
> --
--
> >> 
> >>
> >>
> >> if ($quantity == 0)
> >>  {
> >> $gone = mysql_query("DELETE FROM {$config["prefix"]}_my_items WHERE
> >> uid={$session["uid"]} AND id = '$item'");
> >>   }
> >>
> >>
> >>
> --
--
>
>
>--
>Frank Flynn
>Poet, Artist & Mystic
>
>
>
>--
>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] What is mysql error 28?

2002-04-17 Thread Gurhan Ozen

Hi Leif,
Anytime you get an MySQL error code number use perror program to see what it
is..

[root@atsiz /root]# perror 28
Error code  28:  No space left on device

It seems like you don't have enough space to write to your table.
Gurhan


-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 1:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] What is mysql error 28?


I have a website which has, among other things, virtual items.  The items
are stored in table items, the different types of items in item_types.  I
use the following query to get a user's items:
SELECT DISTINCT t1.id,t1.itemtype,t2.name FROM items as t1,item_types as t2
WHERE (t1.itemtype = t2.id AND t1.owner = '$theirrealinfo[username]' AND
t1.placein='inventory')


A few minutes ago, items mysteriosly started getting then followowing error
from mysql_error(): "Got error 28 in table handler".  Thanks to anyone who
can help!
P.S. They just started working again.  I'm still sending this because I want
to know what was wrong.  Thanks again!


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




RE: [PHP-DB] drop list inserts

2002-04-17 Thread Gurhan Ozen

Hi Barry,
First of all,
$query_id = mysql_query("INSERT INTO...);  is wrong. That line will just
assign the resultset of the whatever mysql_query() function returns to the
variable $query_id .. Get rid of $query_id and just have mysql_query(INSERt
INTO ); See: http://www.php.net/manual/en/function.mysql-query.php  for
this..
Second of all, in your INSERT INTO query you are trying to insert the value
of a variable called $music_artist.id which doesn't exist anywhere. I think
you meant to insert $artist_name instead???

Gurhan


-Original Message-
From: Barry Rumsey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 6:23 PM
To: php-db list
Subject: [PHP-DB] drop list inserts


I have the following to pages( just testing them at the moment ):
";
$getlist = mysql_query("SELECT * FROM music_artist ORDER BY
artist_name ASC");
echo " Artist Name : \n";
while ($row = mysql_fetch_array($getlist)) {
echo ''.$row["artist_name"]."\n";
}
echo " \n";
echo "Album Name : ";
echo "";
echo "";
?>

and



What I am trying to do is insert the id of the artist they selected in
the first page into a second table. At the moment all I get is 0
inserted instead of the artist id from page 1.

Could someone please point out what I'm doing wrong?

Thanks in advance.



--
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] drop list inserts

2002-04-18 Thread Gurhan Ozen

Barry,
All I saw was $artist_name variable that will be passed thru the form.. Can
you do a
echo $music_artist.id   to see if it has a value ..
And you still need to get rid of "$query_id = " in the line that you are
trying to do insert.

Gurhan

-Original Message-
From: Barry Rumsey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 7:35 PM
To: php-db list
Subject: RE: [PHP-DB] drop list inserts


The $music_artist.id is the id from the first page. ( database = music ,
table = music_artist  id ). This is what I need, a drop down list of the
artists in table 'music_artist'( I've got this), I want the id of the
artist they selected in the drop list to be inserted into the
table 'music_album' as $artist_id.

-Original Message-
From: Gurhan Ozen <[EMAIL PROTECTED]>
To: Barry Rumsey <[EMAIL PROTECTED]>, php-db list 
Date: Wed, 17 Apr 2002 19:02:52 -0400
Subject: RE: [PHP-DB] drop list inserts

> Hi Barry,
> First of all,
> $query_id = mysql_query("INSERT INTO...);  is wrong. That line will
> just
> assign the resultset of the whatever mysql_query() function returns to
> the
> variable $query_id .. Get rid of $query_id and just have
> mysql_query(INSERt
> INTO ); See: http://www.php.net/manual/en/function.mysql-query.php
> for
> this..
> Second of all, in your INSERT INTO query you are trying to insert the
> value
> of a variable called $music_artist.id which doesn't exist anywhere. I
> think
> you meant to insert $artist_name instead???
>
> Gurhan
>
>
> -Original Message-
> From: Barry Rumsey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 17, 2002 6:23 PM
> To: php-db list
> Subject: [PHP-DB] drop list inserts
>
>
> I have the following to pages( just testing them at the moment ):
>  mysql_select_db("music");
> echo " action='test-album-add.php'>";
> $getlist = mysql_query("SELECT * FROM music_artist ORDER BY
> artist_name ASC");
> echo " Artist Name : \n";
> while ($row = mysql_fetch_array($getlist)) {
> echo ' value="'.$row["id"].'">'.$row["artist_name"]."\n";
> }
> echo " \n";
> echo "Album Name :  value='$album'>";
> echo "";
> echo "";
> ?>
>
> and
>
>  include("../mainfile.php");
> include("../header.php");
> OpenTable();
>
>   mysql_connect( "host", "", "" );
>   mysql_select_db( "xoops" );
>
>   $query_id = mysql_query("INSERT INTO music_album VALUES
> (NULL, '$music_artist.id' ,'$album' ,NULL ,NULL)");
> echo " $artist_name and $album has been added to the
> database.";
> CloseTable();
> include("../footer.php");
> ?>
>
> What I am trying to do is insert the id of the artist they selected in
> the first page into a second table. At the moment all I get is 0
> inserted instead of the artist id from page 1.
>
> Could someone please point out what I'm doing wrong?
>
> Thanks in advance.
>
>
>
> --
> 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


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




RE: [PHP-DB] appending new entry to old entries

2002-04-18 Thread Gurhan Ozen

Ron,
Are we talking about appending new values to the database tables? If yes,
you need to use INSERT INTO ... VALUES  syntax ...
If you mean to append the new values to a file , then you need to open the
file in "a" mode.

Gurhan

-Original Message-
From: Ron Allen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 4:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] appending new entry to old entries


I would like to make it so that my helpdesk section can append entries in
their Master Station Log. Update replaces the entryany clues??



--
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] Simple search engine gone bad

2002-04-29 Thread Gurhan Ozen

Jenn,
Get rid of 'value=\"\"' in your code and give it a shot again...

Gurhan


-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 9:32 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Simple search engine gone bad


Hi all,

It's Monday, it's probably something stupid, but I have poured over this all
day and cannot find the problem.
This is a simple search engine based on one table. It is suppose to return
the results of the search word. Instead it returns ALL records in the mysql
table. If I type the letter x and there are no words in the table with an x
I still get all records returned.

Would someone be kind enough to show me what I have done wrong.


if($search)
{
  $query = "SELECT  iname, quantity, user, price FROM
{$config["prefix"]}_shop WHERE iname LIKE '%$searchword%' AND price > 0
ORDER BY price";
 $ret = mysql_query($query) or die(mysql_error());
 while($row = mysql_fetch_array($ret))
{
  $user = $row['user'];
  $iname = $row['iname'];
  $q = $row['quantity'];
 $price = $row['price'];

   if($searchword = $iname)
   {
   echo "";
   echo "$user";
   echo "$iname";
   echo "$q";
   echo "$price";
   echo "";
   }
}
}else{

echo "";
echo "Search Shops";
echo "";


}


Thank you
Jennifer
--
The sleeper has awaken


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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

2002-05-06 Thread Gurhan Ozen

That query doesn't make sense... All you are looking for is to get a
resultset containing ONLY the rows where name is John. So, just write:

SELECT ID, NAME, ADDRESS FROM users WHERE NAME='John';

By the way, in SQL, the wildcard character for regular expressions is the
'%' not '*' .

Gurhan

-Original Message-
From: Morten Nielsen [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 06, 2002 4:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Wildcards


Hi,
I am trying to make a SELECT command like this:

   $qid =db_query("
   SELECT ID, NAME, ADDRESS
   FROM users
   WHERE ID=* AND NAME='John'
   ");

Is it somehow possible to have a wildcard, so it returns all records, where
the name is john and the ID is not important?

Regards,
Morten



--
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] Word Count, rounding and missing zeros

2002-05-12 Thread Gurhan Ozen

$formattedquote=sprintf("%.2f", $thequote);

See: http://www.php.net/manual/en/function.sprintf.php

Gurhan

-Original Message-
From: Kim Kohen [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 12, 2002 9:59 PM
To: PHP
Subject: [PHP-DB] Word Count, rounding and missing zeros


G'day All,

I'm using php to query a mysql db and I need to display a word count from
one of the columns and multiply it to get a quote.

So far I have this:

$thewords = count(split (" ","$adtext"));
$thequote = round(($thewords * .78),2);

In an example with 35 words it returns 27.3 but I'd like it to say 27.30. If
the total doesn't end in a zero it displays fine.

Is there a way to force the zero to display?

Cheers and thanks

kim


--
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] mssql_fetch_array not working?

2002-05-13 Thread Gurhan Ozen

Hi ...
Get rid of the if($rs) block...
Just do:

  while ($row = mssql_fetch_array($rs));
  {
   echo $row["ItemClassKey"];
   echo "";
  }

Gurhan

-Original Message-
From: Benjamin Walling [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 5:16 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mssql_fetch_array not working?


I apologize if the answer to this is incredibly simple.  I'm trying to learn
PHP, and evaluate whether to change our site away from ASP.

I have the following php code, and I can't get any results.

I have add the line  echo mssql_num_rows($rs); to see how many rows are
returned, and I get 11 (there are 11 rows in this table).

The page outputs only "11Done".  Why am I not getting any thing into
$row?  Why do I only get 1  (I would expect 11)?

--Begin Code

$db = mssql_connect("domino","uid","pwd");
if ($db)
{
 $dbs = mssql_select_db("acuity_edd_app",$db)
  or die("Couldn't set DB");
 $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID";
 $rs = mssql_query($sql);
 echo mssql_num_rows($rs);
 if ($rs)
 {
  while ($row = mssql_fetch_array($rs));
  {
   echo $row["ItemClassKey"];
   echo "";
  }
 }else{
  echo "No results\n";
 }
 echo "Done\n";
}else{
 echo "Unable to connect to database.\n";
}

--End Code




--
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] mssql_fetch_array not working?

2002-05-13 Thread Gurhan Ozen

Are you sure???

Did you make sure that the ItemClassKey field is not empty?

Gurhan 

-Original Message-
From: Benjamin Walling [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 5:38 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] mssql_fetch_array not working?


I still get the same response.

"Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi ...
> Get rid of the if($rs) block...
> Just do:
>
>   while ($row = mssql_fetch_array($rs));
>   {
>echo $row["ItemClassKey"];
>echo "";
>   }
>
> Gurhan
>
> -Original Message-
> From: Benjamin Walling [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 5:16 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] mssql_fetch_array not working?
>
>
> I apologize if the answer to this is incredibly simple.  I'm trying to
learn
> PHP, and evaluate whether to change our site away from ASP.
>
> I have the following php code, and I can't get any results.
>
> I have add the line  echo mssql_num_rows($rs); to see how many rows are
> returned, and I get 11 (there are 11 rows in this table).
>
> The page outputs only "11Done".  Why am I not getting any thing into
> $row?  Why do I only get 1  (I would expect 11)?
>
> --Begin Code
>
> $db = mssql_connect("domino","uid","pwd");
> if ($db)
> {
>  $dbs = mssql_select_db("acuity_edd_app",$db)
>   or die("Couldn't set DB");
>  $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID";
>  $rs = mssql_query($sql);
>  echo mssql_num_rows($rs);
>  if ($rs)
>  {
>   while ($row = mssql_fetch_array($rs));
>   {
>echo $row["ItemClassKey"];
>echo "";
>   }
>  }else{
>   echo "No results\n";
>  }
>  echo "Done\n";
> }else{
>  echo "Unable to connect to database.\n";
> }
>
> --End Code
>
>
>
>
> --
> 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] mssql_fetch_array not working?

2002-05-13 Thread Gurhan Ozen

Whoop
I did a copy and paste and didn't notice it.. 
Thanks Terry, and that should solve the problem.. 
I haven't even noticed that.. 
Benjamin try it without the semicolon ...

Gurhan 

-Original Message-
From: Terry Romine [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 5:41 PM
To: Gurhan Ozen
Cc: Benjamin Walling; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] mssql_fetch_array not working?


Do I see a semicolon at the end of the while? that won't work...

On Monday, May 13, 2002, at 04:35  PM, Gurhan Ozen wrote:

>   while ($row = mssql_fetch_array($rs)) _;_
>
should be
while ($row = mssql_fetch_array($rs))
{
...
}

Terry Romine
Web Developer
JumpInteractive.com


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




RE: [PHP-DB] Zeropadding

2002-05-14 Thread Gurhan Ozen

SELECT LPAD(column_name, '6', '0') FROM table_name;

Gurhan 

-Original Message-
From: Morten Nielsen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 4:24 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Zeropadding


Hi,
I use MySQL where I have a table. One of the fields is an INT(6), which I
zeropad. When I try to get the number to a variable it doesn't contain all
the numbers. If I give it a value of 59 I extract 59 and not 59. Is
there a way I can get the hole number?

Regards,
Morten



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

2002-05-21 Thread Gurhan Ozen

That means PHP is not compiled with the MySQL support... Configure it with
mysql support, I bbelieve there were a lot of questions about this in the
list, so you may wanna search the archives..

Gurhan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 8:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Problem


Hi, i've a problem with MySQL in my PHP pages. My PHP version is 4.0.1 i
think. it's been installed with Redhat Linux 7.2 with default MySQL support.
(I've verified it). when i want to connect to my sample MySQL database, it
give me error :
Call to undifined function mysql_connect
with all MySQL functions, i've the same error. what's problem? and what i
can do? please somebody help me.

Many thanks, Alan


mail2web - Check your email from the web at
http://mail2web.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] Weird Distinct bug?

2002-05-24 Thread Gurhan Ozen

Hi Chris, 

Try SELECT COUNT(DISTINCT(property_name)) .

Gurhan 

-Original Message-
From: Chris Payne [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 6:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Weird Distinct bug?


Hi there everyone,

On my linux server I am using:

MySQL 3.22.32

Whereas on my Local server I am using

MySQL 3.23.42 (Or 43.don't remember).

Anyway, I am having a wierd but major problem, if I do the code like the
following locally it WORKS, if I do it on the server with the slightly old
MySQL it says there is an error, is this because it's not supported in that
version or does it need formatting slightly different?

$query = "SELECT * FROM llm WHERE property_name LIKE '%$property_name%' OR
country LIKE '%$property_name%' OR city LIKE '%$property_name%'
GROUP BY property_name ORDER BY property_name ASC LIMIT $offset,
$item_perpage";

$querytotal = "SELECT count(DISTINCT property_name) FROM llm WHERE
property_name LIKE '%$property_name%' OR country LIKE '%$property_name%' OR
city LIKE '%$property_name%'
ORDER BY property_name ASC";

The problem lies within SELECT COUNT (DISTINCT property_name) - locally, no
problem, works like a charm, but if I do it on the server it just says I
have an error in my statement and if I take out DISTINCT the error goes
away, it just then doesn't do what it needs to :-(

Any ideas?  I don't know how to upgrade the MySQL on my server so I hope
there's another way around it :-(

Chris


-- 
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] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Gurhan Ozen

Hi,
No you should not report it to anyone. Reserved words can be used as column
names in MySQL (although you shouldn't) provided that they are surrounded by
backticks. When you do it in phpMyAdmin, phpMYAdmin is putting everything
inside backticks , so that this problem won't be encountered.
See:
http://www.mysql.com/doc/L/e/Legal_names.html

Gurhan

- Original Message -
From: "Michael Zornek" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 10, 2002 1:30 PM
Subject: Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??


> Twas 7/10/02 12:55 PM, when "Martin Clifford" <[EMAIL PROTECTED]> said:
>
> > DESC is a reserved word in SQL, standing for Descending Order.  That is
why
> > you can't use it as a table column name.
>
> Ok, that makes sence - thanks!
>
> Although I find it a bit curious that building the DB in phpMyAdmin let me
> do it, yet base MySQL will not.
>
> Should I report it to the phpMyAdmin team?
>
> ~ Mike
> --
> Mike Zornek | Project Leader
> Apple Student Developers
> The Insanely Great Site with the Insanely Long URL
> http://www.applestudentdevelopers.org
>
> Personal Site:
> http://www.mikezornek.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




[PHP-DB] Connecting to a second MySQL server(4.0.2) thru the socket...

2002-07-13 Thread Gurhan Ozen

  Does everyone have any experiences connecting to MySQL 4.0.2 through the
socket ? Here is the deal, I have just installed MySQL 4.0.2 as the second
mysqld server on my linux machine, and , to specify which mysql to connect
to , I am trying to connect to 4.0.2 via socket in PHP, i.e.
mysql_connect("localhost:/var/tmp/mysql.sock", "user", "pass"); .
Unfortunately, this fails, I do know that MySQL 4.0.2 is up and running thru
the socket /var/tmp/mysql.sock . I can login to it thru the command line:

[root@atsiz /root]# mysql --socket=/var/tmp/mysql.sock -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 31 to server version: 4.0.2-alpha

Type 'help;' or '\h' for help. Type '\c' to clear the buffer

mysql>

The weirdest thing is that I have done the exact same coding/procedure with
4.0.1 and it did work just fine... (Including the same socket path) . Any
ideas??
Thanks in advance
Gurhan



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




Re: [PHP-DB] Column count error?

2002-07-26 Thread Gurhan Ozen

 Did you copy and paste the code?
There is no such function as mysql_numrows, it has to be mysql_num_rows.. I
don't know why you didn't get an error for it?

 Gurhan


> "Jas" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I am not sure how to resolve this type of error, any help is
appreciated.
> > TIA
> > Jas
> >
> > /* Error message */
> > Column count doesn't match value count at row 1
> >
> > /* Code to query db for username and password */
> > require '/home/bignickel.net/scripts/admin/db.php';
> >  $db_table = 'auth_users';
> >  $sql = "SELECT * from $db_table WHERE un = \"$u_name\" AND pw =
> > password(\"$p_word\")";
> >  $result = @mysql_query($sql,$dbh) or die('Cannot execute query, please
> try
> > again later or contact the system administrator by email at
> > [EMAIL PROTECTED]');
> >   /* Loop through records for matching pair */
> >   $num = mysql_numrows($result);
> >if ($num !=0) {
> > print "You have a valid username and password combination";
> >   } else {
> > header("Location: blank.php"); }
> >
> > /* Table structure of db */
> > CREATE TABLE auth_users (
> >  user_id int(11) NOT NULL auto_increment,
> >f_name varchar(255) default NULL,
> >l_name varchar(255) default NULL,
> >email_addy varchar(255) default NULL,
> >un text,
> >pw text,
> >PRIMARY KEY  (user_id)
> >  ) TYPE=MyISAM;
> >
> >
> >
> >
> >
> >
> > --
> > 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] MySQL order by in greek

2002-09-05 Thread Gurhan Ozen

Hi 
you have to restart your mysqld server with
--default-character-set=greek option. You can either do this by
explicitly giving it in the command line when restarting your mysqld, or
you can add that line to your global my.cnf file. 
See:
 http://www.mysql.com/doc/en/Command-line_options.html  
and
 http://www.mysql.com/doc/en/Option_files.html

Hope this helps
Gurhan

On Wed, 2002-09-04 at 03:29, Achilleas Maroulis wrote:
> Hi, I have a MySQL problem but due to small problem of my email I can't subscribe to 
>a MySQL list so I wonder if someone from you can answer (actually I'm sure about 
>it...)
> My problem is that I have a query that fetches all data from a table in alphabetical 
>order using the "...order by col_name asc..." command. The problem is that the data 
>in this column is not in english but in greek (as I am Greek!!) and they are not 
>coming in the right order.
> I don't know where to start searching for the solution... 
> Is it the operating sysytem (SuSE LINUX 8.0 in greek) or the MySQL installation 
>(v3.23 which came with the SuSE installation)?
> 
> Thanx in advance...




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




Re: [PHP-DB] button control

2002-09-05 Thread Gurhan Ozen

PHP is a server-side scripting language, there is no way for it to know
what is going on client window, that's a job for Javascript. But if you
are using them in a form you can give them name/value to use them as
form variables which can be used in the form action. 
This is a general PHP question, not DB related, forward this kind of
issues to php-general mailing list.

Gurhan


On Fri, 2002-09-06 at 02:52, Meltem Demirkus wrote:
>  Hi ,
>  Does anybody know how php understand which button is pushed on a page  ..?
> Is there anyway to  do different  applications according to the different 2
> button on a page?..
> 
> thanks...
> 
> 
> 
> -- 
> 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] Re: noobie db: oracle?

2002-09-06 Thread Gurhan Ozen

http://www.mysql.com/information/benchmarks.html

Gurhan

On Fri, 2002-09-06 at 04:26, :B nerdy wrote:
> anyone know anything about oracle & php at all? =D
> 
> 
> ":B Nerdy" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > ive been using mysql my whole php life. i recently got oracle trial db.
> >
> > how does it weigh against mysql? is there a website really benchmarks them
> > both against each other, practically?
> >
> > cheers
> >
> >
> 
> 
> 
> -- 
> 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] mysql_num_rows

2002-01-06 Thread Gurhan Ozen

  Hi everyone,
 I have a problem with mysql connectivety which is making me nuts. If the
query is "select blah, blah from table" (i.e. without where clause)
mysql_num_rows returns the right number, but when i put in a query with
where clause, although there are rows returned, PHP is giving:
"Warning: Supplied argument is not a valid MySQL result resource" error..
Can anyone point me to any direction about this?
  Thanks.

Gurhan


-- 
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-06 Thread Gurhan Ozen

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

 I have loaded a book into the tabel called "books". I have gave each
section a nodeid and each book a bookid. SO i wanted to get number of
distinct nodeid's (i.e. sections) in the book so that i could use a for loop
to display all of them and an inner for loop to display each page under each
section.
  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.
 By the way the web hoster i am using has PHP Version 4.0.6 .
  Thanks.
Gurhan

-Original Message-
From: Richard S. Crawford [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 06, 2002 3:01 PM
To: Gurhan Ozen; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] mysql_num_rows


It would help if we could see the actual query.  It sounds like the problem
is a syntax error in the query itself.

At 11:52 AM 1/6/2002, Gurhan Ozen wrote:
>   Hi everyone,
>  I have a problem with mysql connectivety which is making me nuts. If the
>query is "select blah, blah from table" (i.e. without where clause)
>mysql_num_rows returns the right number, but when i put in a query with
>where clause, although there are rows returned, PHP is giving:
>"Warning: Supplied argument is not a valid MySQL result resource" error..
>Can anyone point me to any direction about this?
>   Thanks.
>
>Gurhan
>
>
>--
>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]


Sliante,
Richard S. Crawford

http://www.mossroot.com
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
MSN: [EMAIL PROTECTED]

"It is only with the heart that we see rightly; what is essential is
invisible to the eye."  --Antoine de Saint Exupéry

"Push the button, Max!"


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

2002-01-06 Thread Gurhan Ozen

hmm that's an idea... I stil don't get why mysql_num_rows wouldn't work with
WHERE clause but i will try to do a workaround with what you said below.
Although it will be a little extra coding I guess I don't have any other
choice:)
  Thank you very much for your help:)

Gurhan

-Original Message-
From: Richard S. Crawford [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 06, 2002 3:34 PM
To: Gurhan Ozen; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql_num_rows


Hm, if the result you want is the number of distinct nodeid values, why not
use a query like this:

"select count(distinct(nodeid)) as nodecount from books where bookid =
$bookid";

Then the number of nodeid's is stored in nodecount.

You might also want to look into the GROUP BY clause.  That might give you
a better handle on what you want to do.




At 12:09 PM 1/6/2002, Gurhan Ozen wrote:

>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);
>
>  I have loaded a book into the tabel called "books". I have gave each
>section a nodeid and each book a bookid. SO i wanted to get number of
>distinct nodeid's (i.e. sections) in the book so that i could use a for
loop
>to display all of them and an inner for loop to display each page under
each
>section.
>   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.
>  By the way the web hoster i am using has PHP Version 4.0.6 .
>   Thanks.
>Gurhan


Sliante,
Richard S. Crawford

http://www.mossroot.com
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
MSN: [EMAIL PROTECTED]

"It is only with the heart that we see rightly; what is essential is
invisible to the eye."  --Antoine de Saint Exupéry

"Push the button, Max!"



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

2002-01-06 Thread Gurhan Ozen

  I think i narrowed down the problem and know what is wrong, and just
solved the problem:). The problem wasn't with mysql or php it was because of
my poor i should say object-oriented skill. I will tell why I had this
problem so that it might be a good reference for someone else who are likely
to get in the same trap:)
  I wrote a class in PHP which serves as a template to all other pages. It
is called "page_layout.inc" and also have another include file (db.inc)
which takes care of db connection.
  So, everypage I have has require("../../page_layout.inc"); and require
("../../db.inc"); lines.
  Normally, my pages just set title of the page and the content of the page
by either giving arguments to SetTitle() and SetContent() functions or
overridding DisplayContent() function. So the code pretty much looks like
this in every page:
  For those setting SetTitle and SetContent functions:
 require (   "../../page_layout.inc");
 require ( "../../db.inc" );

 $query="select * from $tab where encoding = 0 and
articleid=$articleid";
 $result=mysql_query($query);
 $row = mysql_fetch_array($result);


 $page = new page_layout();
 $page -> SetTitle($row[title]);
 $page -> SetContent($row[content]);
 $page -> DisplayPage();

   And For those overridding DisplayContent() function:

require ("../../page_layout.inc");
require ("../../db.inc");
class testpage extends page_layout
{
function DisplayContent()
{
 .
 .
 .
} // End of DisplayContent() function
   } //end of class testpage
$page= new testpage();
$title= "TITLE";

   $page -> SetTitle($title);
   $page -> DisplayPage();

  Ok, the problem i was having with mysql_num_rows have occured in the
DisplayContent() function in the new class. Here are some of the things I
have tried:

$query="select distinct(nodeid), nodename from books";
$result=mysql_query($query);
$num_results =  mysql_num_rows($result);
   This has worked ok. It didn't have a where clause and it did work.

$query="select distinct(nodeid), nodename from books where
bookid=1002";
$result=mysql_query($query);
$num_results =  mysql_num_rows($result);
  This has worked fine as well. When i hard coded the bookid it works.

$query="select distinct(nodeid), nodename from books where
bookid=$bookid";
$result=mysql_query($query);
$num_results =  mysql_num_rows($result);
  This didn't work because I haven't paid enough attention to the
object-oriented methodology. I  failed because when i pass the variable
bookid as an argument to the pagename (i.e. show_book.php?bookid=1001),  it
is not passing the value inside new the class. So I had to find a way to
pass that vaue into the class so that the new overridding DisplayContent()
function could use it. There are a couple ways to do this, and I have used a
set function. I have created a variable in the new class called $booknum.
Then I wrote a function to set it called SetBooknum. It took an argument and
set the variable $booknum to the argument. then Inside the DisplayContent()
function I have used a variable called $booknumber to correspond to the
bookid column in the table. So it looked like this:

   class testpage extends page_layout
{
var $booknum;
 function SetBooknum($num)
{
 $this -> booknum = $num;
}
 function DisplayContent()
{
   $booknumber= $this -> booknum;
   $query="select distinct(nodeid), nodename from books where
bookid=$booknumber";
 .
 .
 .
   } //end of function DisplayContent()
} //end of class testpage

 And then after creating the instance of the new class I have just used
SetBooknum() function to pass the bookid variable into the new class and use
it as the search criteria in the query.

   Thanks to all who tried to help me.

Gurhan


-- 
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] any good web hosting with php and mysql support?

2002-01-14 Thread Gurhan Ozen

  Hi All,
 I am currently looking for a reliable web host to host my personal website.
I know there are millions of web hosting companies that have PHP and MYSQL
support but I just can't trust any of the fully-assured and confident
webhosting ads anymore. I would like to get a service from a company for
which someone can vouch.
  I did started hosting my web site at a webhoster that promised 99.99%
uptime and my site is hardly ever up and running. They don't answer my
emails either.
 IS there anyone who have web sites hosted at webhosting service for a
reasonably long time without any problems? IF yes, can you please contact me
and tell me about it? This might be kind of off-topic for both lists, and i
apologize to both lists, so you might want to reply to my email rather than
sending it to list(s).
  Thank you very much.

Gurhan


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