Re: [PHP-DB] [php - mysql] create_table

2001-11-11 Thread george


   The mysql_create_db() and the other functions are fine but I find it 
easier to use SQL statements and then send them through the mysql_query() 
function

  George

At 05:10 11/11/2000 +0100, Henning Block wrote:
Hi,
with the php-command
mysql_create_db (my_db);
i can create an mySQL-Database.
How can I create a table in this database ? I found no command in the
php.net-manual.

--- H3N ---






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] How do i search my database...

2001-11-11 Thread Peter Lovatt

SELECT * from tablename where FIELD_3 = search text
will find exact matches

SELECT * from tablename where FIELD_3 LIKE search text
will find close matches

Using % as a wild card will broaden the search
SELECT * from tablename where FIELD_3 LIKE search text%
will find close matches where the search text could be at the begining of
the data 'ap%' will return rows with 'apple' or 'apartment', but not
'snapple', in the field

SELECT * from tablename where FIELD_3 LIKE %search text%
will find close matches where the search text could be anywhere in the  data
'%ap%' will return rows with 'a bowl of apples' in the field.

For the php using the best query from above on MySql

//connect to the server
$mysql_db_link = mysql_connect(domain, username, password);
//select database
mysql_select_db(database, $mysql_db_link ) ;

$query = 'query from above';
//run the query
$mysql_result = mysql_query($query, $mysql_db_link);

//output results
print ('Found the following values in the database BR')

//loop through returned results, printing each one
while($row = mysql_fetch_array($mysql_result))
{
print ($row[FIELD_3].'BR');
}// end while


Peter

 -Original Message-
 From: Dave Carrera [mailto:[EMAIL PROTECTED]]
 Sent: 11 November 2001 06:38
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] How do i search my database...


 Hi All,
 I have a database with only three fields

 FIELD 1
 FIELD 2
 FIELD 3

 I want the user to input into FIELD 3, and then my script to go of to my
 database and see if it finds a match or something like the input
 and display
 it to the screen.

 Please help as i can't seem to get my brain around this

 Thanks in Advance


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Login Script please?

2001-11-11 Thread W3bDevil

I have a server that doesn't allow external connections. They say its to
protect the data for me and my customers (even though I don't actually
have any). Anyway, I've tried everything, and I'm going to start learning
PHP later this year, but I'm in a hurry here:

I've configured my database with PHPmyAdmin, and I've got UltraDev 4 with
PHAkt. Not forgetting all the other stuff I downloaded, like mySQL MAX 4.0
and OmniCron HTTPd Pro.

I've got a connection set-up with all the correct details by just entering
the connection details in PHAkt connection settings, and I've made the
System DSN. But when I click test or try to define a log-in server
behaviour (where it then tries to connect and aquire a list of tables and
fields) It comes up with an unknown host message. I contaced my host and
they said its because they don't allow external connections.

So does anyone have a solution?
Or should I just modify a working PHP Log-in page and replace it with my
values and variables?

Thanks
W3bDev£



-- 
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] Login Script please?

2001-11-11 Thread Peter Lovatt

If they don't allow external connections then you won't be able to connect
directly from UltraDev, only from uploaded scripts.

Learn php, write them and run them!

Alternatively switch to a host which allows external connections?

No quick answers.


Peter

 -Original Message-
 From: W3bDevil [mailto:[EMAIL PROTECTED]]
 Sent: 11 November 2001 10:52
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Login Script please?


 I have a server that doesn't allow external connections. They say its to
 protect the data for me and my customers (even though I don't actually
 have any). Anyway, I've tried everything, and I'm going to start learning
 PHP later this year, but I'm in a hurry here:

 I've configured my database with PHPmyAdmin, and I've got UltraDev 4 with
 PHAkt. Not forgetting all the other stuff I downloaded, like mySQL MAX 4.0
 and OmniCron HTTPd Pro.

 I've got a connection set-up with all the correct details by just entering
 the connection details in PHAkt connection settings, and I've made the
 System DSN. But when I click test or try to define a log-in server
 behaviour (where it then tries to connect and aquire a list of tables and
 fields) It comes up with an unknown host message. I contaced my host and
 they said its because they don't allow external connections.

 So does anyone have a solution?
 Or should I just modify a working PHP Log-in page and replace it with my
 values and variables?

 Thanks
 W3bDev£



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] SQL query

2001-11-11 Thread Pierre

I have two tables, one call category, the other chapter

Category table
[id][name]
[1][a]
[2][b]
[3][c]
[4][d]

Chapter table
[id][FK_name]
[1][a]
[2][a]
[3][c]


I would like to get the list of names of the Category table that are NOT present in 
the Chapter table.
On this example, I should find b and d.   

Is it possible to get it directly from a SQL query ? (I am using MYSQL).

Thank for helping me.

Pierre 



RE: [PHP-DB] SQL query

2001-11-11 Thread Gonzalez, Lorenzo

in other RDBMs this is easily done with a subselect - don't know if it's
doable in MySQL or not, someone else can confirm, or you can try it
yourself...
 
select * from table1 where table1.id not in (select table2.id);
 
-Lorenzo

-Original Message- 
From: Pierre 
Sent: Sun 11/11/2001 10:01 PM 
To: [EMAIL PROTECTED] 
Cc: 
Subject: [PHP-DB] SQL query



I have two tables, one call category, the other chapter

Category table
[id][name]
[1][a]
[2][b]
[3][c]
[4][d]

Chapter table
[id][FK_name]
[1][a]
[2][a]
[3][c]


I would like to get the list of names of the Category table that
are NOT present in the Chapter table.
On this example, I should find b and d.  

Is it possible to get it directly from a SQL query ? (I am using
MYSQL).

Thank for helping me.

Pierre





Re: [PHP-DB] SQL query

2001-11-11 Thread Pierre

Thanks but I think subselect is not possible with MYSQL.

Pierre

- Original Message - 
From: Gonzalez, Lorenzo [EMAIL PROTECTED]
To: Pierre [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, November 12, 2001 1:08 PM
Subject: RE: [PHP-DB] SQL query


 in other RDBMs this is easily done with a subselect - don't know if it's
 doable in MySQL or not, someone else can confirm, or you can try it
 yourself...
  
 select * from table1 where table1.id not in (select table2.id);
  
 -Lorenzo
 
 -Original Message- 
 From: Pierre 
 Sent: Sun 11/11/2001 10:01 PM 
 To: [EMAIL PROTECTED] 
 Cc: 
 Subject: [PHP-DB] SQL query
 
 
 
 I have two tables, one call category, the other chapter
 
 Category table
 [id][name]
 [1][a]
 [2][b]
 [3][c]
 [4][d]
 
 Chapter table
 [id][FK_name]
 [1][a]
 [2][a]
 [3][c]
 
 
 I would like to get the list of names of the Category table that
 are NOT present in the Chapter table.
 On this example, I should find b and d.  
 
 Is it possible to get it directly from a SQL query ? (I am using
 MYSQL).
 
 Thank for helping me.
 
 Pierre
 
 
 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please Help Me! thanks!!

2001-11-11 Thread Denny Suvanto

Try using fsockopen() function :
$file = fsockopen (www.yahoo.com, 80, $err_num,
$err_msg, 30);

You can find more informations about this fuction in
http://www.php.net/manual/en/function.fsockopen.php

May it help you.

Andy
www.mediahostnet.com

--- G [EMAIL PROTECTED] wrote:  Hello! i
would like to useing fopen() fuction to
 open the other Url,
 but i am using a shared server now. When i useing
 fopen() or file()
 fuctions, always have a error message:
 
 Warning: php_hostconnect: connect failed in
 /usr/xxx/xxx/xxx/html/test.php
 on line 3
 
 Warning: file(http://www.yahoo.com;) - Bad file
 descriptor in
 /usr/xxx/xxx/xxx/html/test.php on line 3
 
 How can i do?have any other fuctions can do that?
 Thank You Very Much!!
 
 
 
 
 
 -- 
 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]
  

__
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music 
Charts
http://uk.my.yahoo.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-DB] PHP/MySQL Question

2001-11-11 Thread Peter Brown

HI, 

New to PHP/MySQL,

I was wondering if this was possible.

I have a users database with an auto-incremented userID field.

I have another message database (it's a message board database) - one of
the fields is a TEXT field with userIDs separated by carriage returns;
eg; if on one record userID 2 and userID 4 have both viewd that record,
the data in that field will look as follows:

2
4

I want to construct a SQL query for every user that logs in (I am
storing their userID as a session variable) so that I can filter out any
messages where a user has already viewed that record.  So in the above
example that record should be filtered out if user 2 or user 4 has
viewed the record.

The query I constructed is:

SELECT * FROM messages WHERE userID != '$userid'

But this will not filter out any records like the one above where the
userID in the message database is separaed by carriage returns as above
(ie; it won't filter out messages for user 2 or user 4).

Hope this makes sense
Peter


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