[PHP-DB] MySQL full text search

2003-07-18 Thread Angelo Zanetti
Hi

I have a table which contains 3 fields (ID, Title, Abstract) the title and abstract 
fields have been fulltext indexes like this:

ALTER TABLE biblio ADD FULLTEXT (title,abstract);

that worked fine, however my problem is whenever I want to do a select statement only 
comparing 1 of the columns to inputted data ( in a Select statement):

$result = mysql_query(SELECT * FROM Biblio WHERE MATCH (title) AGAINST 
('$searchString'));

It gives me this error: Can't find FULLTEXT index matching the column list. It appears 
that i cant just compare a single fulltext indexed column if there are other fulltext 
indexed columns. When I try it with both columns then it works but I just want to 
compare 1 column. eg: 
$result = mysql_query(SELECT * FROM Biblio WHERE MATCH (title, abstract) AGAINST 
('$searchString'));

So is there anyway that I can just compare 1 column with text entered? Do I have t 
make some sort of temporary table to do this? All the examples I have found show the 
select statement with 2 columns or if they use 1 coumn its because there is only 1 
column in their table.

Any help would be appreciated!

TIA

Angelo


[PHP-DB] in-line function?

2003-07-18 Thread Donny Lee
 hi there,

 can we make simple codes in-line instead of function
 calls?

 or, it makes no help in PHP?

-- 
 // Donny


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



Re: [PHP-DB] editing part of a field

2003-07-18 Thread Jason Wong
On Friday 18 July 2003 13:27, JeRRy wrote:

 But won't update update the what I input.  I only need
 PART of the post to update, only the selected url area
 and want the remaining of the message to be unchanged.
  Won't the update change the whole message?  I think
 it does, I only need part of the message to be edited
 and that is the URL the text needs to be unchanged.

 I have over 9,000 posts to update and fix the image
 url for it.  I can't afford to muddle up the posts.

You can update individual fields in a record but you can't directly update 
part of a field.

You have to loop through all the records and either use the MySQL function 
INSERT() or use some php code to replace what you need to replace, using 
UPDATE.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
No modern woman with a grain of sense ever sends little notes to an
unmarried man -- not until she is married, anyway.
-- Arthur Binstead
*/


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



Re: [PHP-DB] php mysql arrays and totals

2003-07-18 Thread Wendell Frohwein
i didnt even know that function existed, could you maybe give me a little
more detail on it, then im sure i can figure it out, thanks allot,


-wendell


Dirk Kredler [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Am Freitag, 18. Juli 2003 12:18 schrieb Wendell Frohwein:
  called amount. I use mysql_query(SELECT amount FROM items); to get the
  amounts into the script.
  I would then like all the values to be added up for a grand total. I
have
  tried this and the

 why dont you use :

 SELECT SUM(amount) FROM items

 ?

 best wishes,
 Dirk





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



Re: [PHP-DB] php mysql arrays and totals

2003-07-18 Thread Dirk Kredler
Am Freitag, 18. Juli 2003 12:33 schrieb Wendell Frohwein:
 i didnt even know that function existed, could you maybe give me a little
 more detail on it, then im sure i can figure it out, thanks allot,

SUM() is a standard function from (my)SQL.

just use it and be happy,
if you need in depth details consult the mysql manual or
any good sql manual, you will find a lot in the internet.

anyway, you can also perform the summation in php,
but this makes not sense, as the database is much more faster
in this topic.

best wishes,
dirk



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



Re: [PHP-DB] MySQL full text search

2003-07-18 Thread Doug Thompson
Full text searches only work against fulltext indexes.

http://www.mysql.com/doc/en/Fulltext_Search.html

This isn't a PHP issue.

Doug


On Fri, 18 Jul 2003 09:42:17 +0200, Angelo Zanetti wrote:

Hi

I have a table which contains 3 fields (ID, Title, Abstract) the title and abstract 
fields have been fulltext indexes like this:

ALTER TABLE biblio ADD FULLTEXT (title,abstract);

that worked fine, however my problem is whenever I want to do a select statement only 
comparing 1 of the columns to inputted data ( in a Select statement):

$result = mysql_query(SELECT * FROM Biblio WHERE MATCH (title) AGAINST 
('$searchString'));

It gives me this error: Can't find FULLTEXT index matching the column list. It 
appears that i cant just compare a single fulltext indexed column if there are other 
fulltext indexed columns. When I try it with both columns then it works but I just 
want to compare 1 column. eg: 
$result = mysql_query(SELECT * FROM Biblio WHERE MATCH (title, abstract) AGAINST 
('$searchString'));

So is there anyway that I can just compare 1 column with text entered? Do I have t 
make some sort of temporary table to do this? All the examples I have found show the 
select statement with 2 columns or if they use 1 coumn its because there is only 1 
column in their table.

Any help would be appreciated!

TIA

Angelo




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



[PHP-DB] Inserting a large number of rows into mySQL

2003-07-18 Thread Anthony
I'm writing an app where I must insert a large number of rows into a mySQL
database individually.  All the rows are related to each other, so I need to
ensure that integrity is maintained.  In the event that one of the inserts
fails, I need to be able to roll back all the prior inserts.  What is the
best way to insert the rows individually, yet still have this ability?  The
rows will be inserted by looping though an array in PHP.  Thanks.

- Anthony



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



Re: [PHP-DB] Inserting a large number of rows into mySQL

2003-07-18 Thread jeffrey_n_Dyke

If you have the standard table type installed
As you loop though though the arrays in PHP get ahold of the last ID
inserted via mysql_insert_id() and add it to an $inserted_array variable
and then at each insert check that the last insert was successful, and if
not send your db a bunch of deletes based on the keys in $inserted_array.

but if you are running a InnoDB or BDB table then you can set AUTOCOMMIT =
0 and use the Begin/Commit/Rollback syntax to accomplish this.

hth...i'm sure there are 10 more ways to do this
jeff




   
  
  Anthony
  
  [EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  mputer.com   cc:
  
Subject:  [PHP-DB] Inserting a large 
number of rows into mySQL   
  07/18/2003 10:04 
  
  AM   
  
   
  
   
  




I'm writing an app where I must insert a large number of rows into a mySQL
database individually.  All the rows are related to each other, so I need
to
ensure that integrity is maintained.  In the event that one of the inserts
fails, I need to be able to roll back all the prior inserts.  What is the
best way to insert the rows individually, yet still have this ability?  The
rows will be inserted by looping though an array in PHP.  Thanks.

- Anthony



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

2003-07-18 Thread Ryan Marks
You may be able to view this report in Excel and print it from there.
If this is an option, do the following in Excel:

1. Data - Import External Data - New Web Query
2. Enter the URL for your report in the Address field and click Go.  It
is possible to start at one URL and browse to the report if you need to
authenticate. 3. Toggle the yellow arrow boxes to green checkmarks if
you want to include that in your spreadsheet. 4. Click Import.

You will lose your formatting, but this is an option that doesn't
require writing any code.

Ryan

-Original Message-
From: Norma Ramirez - TECNOSOFT [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 18, 2003 8:13 AM
To: lista php
Subject: [PHP-DB] Print Query


I´have a complex report from mysql via php whits css, frames etc...
Someone know a script  to make a printable versión of this? Thank´s
Norma Ramirez


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



[PHP-DB] Newbee: Array Field Separator: \035

2003-07-18 Thread Jeff Langley
Hi,

I am reading an already created gdbm file with dba_fetch into an array.

I am able to print out the array but not the individual
elements.  The elements are separated with ascii \035.

How would I be able to reference each element based
on the field separator they have?

Also, Once I open the gdbm file do I have to stick with dba_*
calls or are there other function I can use to process the data?

Thanks,
Jeff


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



[PHP-DB] Passing key field, id, from form to procedure

2003-07-18 Thread Hull, Douglas D
I am just starting to learn php and mysql.  I have a small php/html page and
database.  All it does when starting shows the name of each person with a
delete and edit link beside each name.  At the bottom of the list there is
an Add Record button.  If you select delete it takes out the name and
reloads the page.  If you select Add Record it brings up a form to add a
new name etc. with an Add It button under the form in which after
selecting INSERTs the new record and reloads the initial page.  The add and
delete parts work fine.

The edit record is the problem.  After selecting the edit beside the
appropriate name a form is brought up showing the current information for
that record with an Update Record button under the form.  This works fine
to here.  But when I select the Update Record button it will go into the
updaterecord procedure of my php/html page but it has no id for it to
apply the UPDATE to.  So how can I have it pass the id to the updaterecord
procedure so it will apply the UPDATE to the appropriate record?  I tried
two different ways of getting the id for updaterecord as you can see below.
Following is my editrecord and updaterecord procedures:

if (isset($_GET['editrecord'])) { //edit record
$zid = $_GET['editrecord'];
$sql = SELECT * FROM persinfo WHERE DID = $zid;
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$zid = $row[DID];
$zfname = $row[DFirst];
$zlname = $row[DLast];
?
form action=?=$_SERVER['PHP_SELF']? method=post
input type=hidden name='DID' value=? echo $zid; ?
First name: input type=text name=zfname 
value=? echo $zfname; ?/ br
Last name: input type=text name=zlname 
value=? echo $zlname; ?/ br
input type=submit name=updaterecord value=Update It /
/form
?php } ?

?php
if (isset($_GET['$updaterecord'])) {  //update record
version 1
$zid = $_GET['$updaterecord'];
$sql = UPDATE persinfo SET DFirst='$zfname',
DLast = '$zlname' WHERE DID=$zid;
$result = mysql_query($sql);
}
}

//I also tried this

if ($updaterecord) {//update
record version 2
if ($zid) {
$sql = UPDATE persinfo SET DFirst='$zfname',
DLast = '$zlname' WHERE DID=$zid;
$result = mysql_query($sql);
}
}
?

If you want all of the code let me know.  I could send it to your personal
email address.  The whole thing is probably 130 lines of code.

Thanks for any help,
Doug Hull

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



RE: [PHP-DB] Passing key field, id, from form to procedure

2003-07-18 Thread Hutchins, Richard
Doug,

One way to handle this is the following:

On the page that lists the people, under the edit link, you put something
like a href=editscript.php?id=$idEdit/a. When the user clicks that
link, the $id will be passed in the URL.

In your editscript.php page, inside the form where you're editing the
information, you create an input type=hidden name=updateThisRecord
value=?php $_GET['id'] ? (or some variation thereof depending on how
your HTML is handled). This will place the ID into a hidden field that can
be passed to your update query via POST.

When the user hits the submit button, all of your form data can be used in
the UPDATE query and you just add a WHERE clause to the end of it. For
example: UPDATE personTable SET ...your column names and values here...
WHERE id=.$_POST[updateThisRecord].;

I'm sure there are other ways of handling this, but I've had success with
this methodology in the past. None of the code in here has been tested or
anything - just straight off the top of my head so I apologize in advance if
everything doesn't work verbatim.

Hope this helped.
Rich

 -Original Message-
 From: Hull, Douglas D [mailto:[EMAIL PROTECTED]
 Sent: Friday, July 18, 2003 11:40 AM
 To: Note To php mysql List (E-mail)
 Subject: [PHP-DB] Passing key field, id, from form to procedure
 
 
 I am just starting to learn php and mysql.  I have a small 
 php/html page and
 database.  All it does when starting shows the name of each 
 person with a
 delete and edit link beside each name.  At the bottom of the 
 list there is
 an Add Record button.  If you select delete it takes out 
 the name and
 reloads the page.  If you select Add Record it brings up a 
 form to add a
 new name etc. with an Add It button under the form in which after
 selecting INSERTs the new record and reloads the initial 
 page.  The add and
 delete parts work fine.
 
 The edit record is the problem.  After selecting the edit beside the
 appropriate name a form is brought up showing the current 
 information for
 that record with an Update Record button under the form.  
 This works fine
 to here.  But when I select the Update Record button it will 
 go into the
 updaterecord procedure of my php/html page but it has no id 
 for it to
 apply the UPDATE to.  So how can I have it pass the id to the 
 updaterecord
 procedure so it will apply the UPDATE to the appropriate 
 record?  I tried
 two different ways of getting the id for updaterecord as you 
 can see below.
 Following is my editrecord and updaterecord procedures:
 
 if (isset($_GET['editrecord'])) { //edit record
   $zid = $_GET['editrecord'];
   $sql = SELECT * FROM persinfo WHERE DID = $zid;
   $result = mysql_query($sql);
   $row = mysql_fetch_array($result);
   $zid = $row[DID];
   $zfname = $row[DFirst];
   $zlname = $row[DLast];
 ?
   form action=?=$_SERVER['PHP_SELF']? method=post
   input type=hidden name='DID' value=? echo $zid; ?
   First name: input type=text name=zfname 
   value=? echo $zfname; ?/ br
   Last name: input type=text name=zlname 
   value=? echo $zlname; ?/ br
   input type=submit name=updaterecord value=Update It /
   /form
 ?php } ?
 
 ?php
 if (isset($_GET['$updaterecord'])) {  
 //update record
 version 1
   $zid = $_GET['$updaterecord'];
   $sql = UPDATE persinfo SET DFirst='$zfname',
   DLast = '$zlname' WHERE DID=$zid;
   $result = mysql_query($sql);
   }
 }
 
 //I also tried this
 
 if ($updaterecord) {  
   //update
 record version 2
   if ($zid) {
   $sql = UPDATE persinfo SET DFirst='$zfname',
   DLast = '$zlname' WHERE DID=$zid;
   $result = mysql_query($sql);
   }
 }
 ?
 
 If you want all of the code let me know.  I could send it to 
 your personal
 email address.  The whole thing is probably 130 lines of code.
 
 Thanks for any help,
 Doug Hull
 
 -- 
 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] Passing key field, id, from form to procedure

2003-07-18 Thread Ryan Marks
Douglas,

The form that shows the editable fields has a hidden field named 'DID'
having the value of $zid.  In your updaterecord procedure, you will have to
use the variable $_GET[DID] instead of $zid.  You can of course just add one
line of code:

$zid = $_GET[DID];

to help you out.  One other trick is to echo out your query before actually
running it so that you don't update all of your records by mistake.

Ryan Marks

-Original Message-
From: Hull, Douglas D [mailto:[EMAIL PROTECTED]
Sent: Friday, July 18, 2003 10:40 AM
To: Note To php mysql List (E-mail)
Subject: [PHP-DB] Passing key field, id, from form to procedure


I am just starting to learn php and mysql.  I have a small php/html page and
database.  All it does when starting shows the name of each person with a
delete and edit link beside each name.  At the bottom of the list there is
an Add Record button.  If you select delete it takes out the name and
reloads the page.  If you select Add Record it brings up a form to add a
new name etc. with an Add It button under the form in which after
selecting INSERTs the new record and reloads the initial page.  The add and
delete parts work fine.

The edit record is the problem.  After selecting the edit beside the
appropriate name a form is brought up showing the current information for
that record with an Update Record button under the form.  This works fine
to here.  But when I select the Update Record button it will go into the
updaterecord procedure of my php/html page but it has no id for it to
apply the UPDATE to.  So how can I have it pass the id to the updaterecord
procedure so it will apply the UPDATE to the appropriate record?  I tried
two different ways of getting the id for updaterecord as you can see below.
Following is my editrecord and updaterecord procedures:

if (isset($_GET['editrecord'])) { //edit record
$zid = $_GET['editrecord'];
$sql = SELECT * FROM persinfo WHERE DID = $zid;
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$zid = $row[DID];
$zfname = $row[DFirst];
$zlname = $row[DLast];
?
form action=?=$_SERVER['PHP_SELF']? method=post
input type=hidden name='DID' value=? echo $zid; ?
First name: input type=text name=zfname
value=? echo $zfname; ?/ br
Last name: input type=text name=zlname
value=? echo $zlname; ?/ br
input type=submit name=updaterecord value=Update It /
/form
?php } ?

?php
if (isset($_GET['$updaterecord'])) {  //update record
version 1
$zid = $_GET['$updaterecord'];
$sql = UPDATE persinfo SET DFirst='$zfname',
DLast = '$zlname' WHERE DID=$zid;
$result = mysql_query($sql);
}
}

//I also tried this

if ($updaterecord) {//update
record version 2
if ($zid) {
$sql = UPDATE persinfo SET DFirst='$zfname',
DLast = '$zlname' WHERE DID=$zid;
$result = mysql_query($sql);
}
}
?

If you want all of the code let me know.  I could send it to your personal
email address.  The whole thing is probably 130 lines of code.

Thanks for any help,
Doug Hull

--
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] Oracle Database Connection Error

2003-07-18 Thread angel
I'm trying to connect to a oracle database using the  Microsoft ODBC for
Oracle  driver with the
followin script:

?php
 $user= user;
 $upasswd=password;
 $dsn = dsn;
$query = select sysdate from dual;
$conn = odbc_pconnect($dsn, $user,$upasswd );
if (!$conn)
   { print Connection failed\n/html;
exit;
}
if ($result = odbc_Exec($conn, $query))
{  print  Query returned :  . odbc_num_rows($result) .  rows;
odbc_result_all($result, border = 1);}
  ?

And received the following error:
Warning: SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154:
TNS:could not resolve
service name, SQL state 08001 in SQLConnect in c:\php\files\p.php on line 6


Can any body help With this error.

Wha i have to set for connecting with oracle using odbc?

Regards,

Angel M.S.F.




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



[PHP-DB] Re: Newbee: Array Field Separator: \035

2003-07-18 Thread Jeff Langley

I figured out the field seperation on my own.

Thanks anyway,
jeff

Jeff Langley wrote:

 Hi,

 I am reading an already created gdbm file with dba_fetch into an array.

 I am able to print out the array but not the individual
 elements.  The elements are separated with ascii \035.

 How would I be able to reference each element based
 on the field separator they have?

 Also, Once I open the gdbm file do I have to stick with dba_*
 calls or are there other function I can use to process the data?

 Thanks,
 Jeff


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