[PHP-DB] Using Array with form submission

2004-03-12 Thread Aleks @ USA.net
I have been trying to get this to work and think I must be missing
something. I am using Kevin Yank's books and examples as a guide. Here is
what I have so far - this does work [as it should since Kevin created it..
8-) ]
 
I have a form that creates a list of items with a select link that when
clicked adds the selected item to a shopping cart. I would like to convert
this to a checkbox model. Here is what I have so far
=
?

 

/* Check User Script */

 

session_start(); // Start Session

 

if (!isset($_SESSION['cart']))

 

$_SESSION['cart'] = array();

if (isset($_GET['Select'])) {

 

// Add item to the end of the $_SESSION['cart'] array

 

$_SESSION['cart'][] = $_GET['Select'];

header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);

 

exit();

 

}

 

include(connects to dB);

 

$Info = mysql_query(SELECT the data);

 

$rows = mysql_num_rows($Info);

 

$oldCat=;

 

// Will give you the number of rows returned from the SELECT statement

 

// echo($rows);

 

for($i = 0; $i  $rows; $i++) {

 

$SRecord = mysql_fetch_array($Info, MYSQL_ASSOC);

 

 

$ItemID[] = htmlspecialchars($SRecord[ItemID]);

$CatID[] = htmlspecialchars($SRecord[CatID]);

$Category[] = htmlspecialchars($SRecord[ProdCategory]);

$Model[] = htmlspecialchars($SRecord[ItemModel]);

$Description[] = htmlspecialchars($SRecord[ItemDescription]);

$Price[] = htmlspecialchars($SRecord[ItemPrice]);

 

 

 

{

 

IF ($oldCat != $Category[$i] )

 

{ 

 

echo(table cellspacing=2 cellpadding=2 border=1 width=700);

 

echo(tr);

 

echo(tr/trcenterfont face=Arial
size=-1bCategory:nbsp;nbsp;/b/font);

echo(font face=Arial size=-1b$Category[$i]/b/font/center/tr);

 

 

$oldCat=$Category[$i];

 

}

 

echo(/tr);

 

}

 

? 

 

tr 

 

Tdfont face=Arial size=-1

 

? echo('tda href=' . $_SERVER['PHP_SELF'] .'?Select=' . $i .
'Select/a/td');? //Change this out to a checkbox

Tdfont face=Arial size=-1? echo ($CatID[$i]); ?/FONT/A/td

tdfont face=Arial size=-1? echo($Model[$i]); ?/font/td

tdfont face=Arial size=-1? echo($Description[$i]); ?/font/td

tdfont face=Arial size=-1$? echo (number_format($Price[$i],2));
?/font/td

 

?

 

}

 

?



I want to change the Select statement above to

? echo (input type='checkbox' name='select[]' value='$ItemID[$i]' .
$ItemID[$i]); ?/FONT/A/td

but can't seem to make the addition to the cart work.

Any idea how to change the Select to a check box and have it loop threw the
array so that each selected

item is added to the shopping cart??


Thanks in advance for all your help..

 

Aleks


 



[PHP-DB] Using Array with form submission

2004-03-12 Thread Aleks @ USA.net
Sorry for all the dead space in my last post... I cleaned it up some here...
===

I have been trying to get this to work and think I must be missing
something. I am using Kevin Yank's books and examples as a guide. Here is
what I have so far - this does work [as it should since Kevin created it..
8-) ]
 
I have a form that creates a list of items with a select link that when
clicked adds the selected item to a shopping cart. I would like to convert
this to a checkbox model. Here is what I have so far
=
?

/* Check User Script */

session_start(); // Start Session
if (!isset($_SESSION['cart']))
$_SESSION['cart'] = array();
if (isset($_GET['Select'])) {

// Add item to the end of the $_SESSION['cart'] array
$_SESSION['cart'][] = $_GET['Select'];
header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);

exit();
}
 
include(connects to dB);

$Info = mysql_query(SELECT the data);

$rows = mysql_num_rows($Info);

$oldCat=;

// Will give you the number of rows returned from the SELECT statement
// echo($rows);

for($i = 0; $i  $rows; $i++) {
$SRecord = mysql_fetch_array($Info, MYSQL_ASSOC);

$ItemID[] = htmlspecialchars($SRecord[ItemID]);
$CatID[] = htmlspecialchars($SRecord[CatID]);
$Category[] = htmlspecialchars($SRecord[ProdCategory]);
$Model[] = htmlspecialchars($SRecord[ItemModel]);
$Description[] = htmlspecialchars($SRecord[ItemDescription]);
$Price[] = htmlspecialchars($SRecord[ItemPrice]);

 {
IF ($oldCat != $Category[$i] )
{ 
echo(table cellspacing=2 cellpadding=2 border=1 width=700);
echo(tr);
echo(tr/trcenterfont face=Arial
size=-1bCategory:nbsp;nbsp;/b/font);

echo(font face=Arial size=-1b$Category[$i]/b/font/center/tr);
$oldCat=$Category[$i];
 
}

echo(/tr);
}

? 
tr 
Tdfont face=Arial size=-1

? echo('tda href=' . $_SERVER['PHP_SELF'] .'?Select=' . $i .
'Select/a/td');? //Change this out to a checkbox

Tdfont face=Arial size=-1? echo ($CatID[$i]); ?/FONT/A/td
tdfont face=Arial size=-1? echo($Model[$i]); ?/font/td
tdfont face=Arial size=-1? echo($Description[$i]); ?/font/td
tdfont face=Arial size=-1$? echo (number_format($Price[$i],2));
?/font/td

?
}
?


I want to change the Select statement above to

? echo (input type='checkbox' name='select[]' value='$ItemID[$i]' .
$ItemID[$i]); ?/FONT/A/td

but can't seem to make the addition to the cart work.

Any idea how to change the Select to a check box and have it loop threw the
array so that each selected item is added to the shopping cart?? Once I have
The cart working I will be submitting the complete cart into a MySQL dB


Thanks in advance for all your help..

 

Aleks


 

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



[PHP-DB] Group inner join results

2004-03-08 Thread Aleks @ USA.net
Hi all,
 
I thought I saw the answer to this question on here but can not find the
answer ..
So,
 
I am doing an inner join on 2 tables and displaying the result as follows:
 
Code=
table cellspacing=2 cellpadding=2 border=0
tr
 tdfont face=Arial size=-1bCat#/b/font/td
 tdfont face=Arial size=-1bCategory/b/font/td
 tdfont face=Arial size=-1bModel/b/font/td
 tdfont face=Arial size=-1bDescription/b/font/td
 tdfont face=Arial size=-1bPrice/b/font/td
 
/tr
?
 
$Info = mysql_query(SELECT Table1.CatID, Table1.ProdCategory,
Table2.ItemID, Table2.ItemDescription, Table2.ItemModel, Table2.ItemPrice 
FROM Table1 LEFT OUTER JOIN Table2 ON Table1.CatID=Table2.CatID ORDER BY
Table2.ItemID);
 
while ($SRecord = mysql_fetch_array($Info, MYSQL_ASSOC))  {
 
$CatID = htmlspecialchars($SRecord[CatID]);
$Category = htmlspecialchars($SRecord[ProdCategory]);
$Model = htmlspecialchars($SRecord[ItemModel]);
$Description = htmlspecialchars($SRecord[ItemDescription]);
$Price = htmlspecialchars($SRecord[ItemPrice]);
 
?

tr
Tdfont face=Arial size=-1? echo ($CatID); ?/FONT/A/td
tdfont face=Arial size=-1? echo($Category); ?/font/td
tdfont face=Arial size=-1? echo($Model); ?/font/td
tdfont face=Arial size=-1? echo($Description); ?/font/td
tdfont face=Arial size=-1? echo($Price); ?/font/td
?
}
?
 
/tr/table
 
Code==
 
The output of above is
 

-
|  Cat# | Category| Model   | Description  | Price

-
|   $CatID | $Category  | $Model | $Description | $Price

--
 
 
What I need to do is build a table display where the output is grouped by
Category. 
 
Like this:
 
---
|   Category = Ist $Category
---
|   $Model - $Description - $Price
---
|   Category = 2nd $Category
---
|  $Model - $Description - $Price
---
|   Category = 3rd $Category
---
|   $Model - $Description - $Price
-
 
I think that I can do this
with a nested array... anyone have an idea??
 
THanks in advance...
 
Aleks


RE: [PHP-DB] Re: php-db Digest 8 Mar 2004 20:50:10 -0000 Issue 2294

2004-03-08 Thread Aleks @ USA.net
HI Frank,

Thank you for the suggestion.. I think I see where you are going with
this...
However, how do I update the $oldCat with the last ProdCategory printed so
that
It will print the next new Category found in the while statement.?? 

-Original Message-
From: Frank Flynn [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 08, 2004 4:11 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Re: php-db Digest 8 Mar 2004 20:50:10 - Issue 2294

Not a nested array, a simple 'if' statement...

Something like:

$Info = mysql_query(SELECT .

$oldCat = ;

while ($SRecord = mysql_fetch_array($Info, MYSQL_ASSOC))  {
 
If $oldCat != $SRecord[ProdCategory]
{
/* Print your special Header row */
   echo  TRTDCategory = $Category /TD/TR;

}
/* now all you need is $Model - $Description - $Price */

 $Model = htmlspecialchars($SRecord[ItemModel]);
 $Description = htmlspecialchars($SRecord[ItemDescription]);
 $Price = htmlspecialchars($SRecord[ItemPrice]);
 
 ?
 
 tr
 tdfont face=Arial size=-1? echo($Model); ?/font/td
tdfont face=Arial size=-1? echo($Description); ?/font/td
tdfont face=Arial size=-1? echo($Price); ?/font/td  ?
 }
 ?

Good Luck,
Frank

On 3/8/04 12:50 PM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 
 From: Aleks @ USA.net [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 Date: Mon, 8 Mar 2004 15:50:01 -0500
 To: PHPDatabase List [EMAIL PROTECTED]
 Subject: Group inner join results
 
 Hi all,
 
 I thought I saw the answer to this question on here but can not find 
 the answer ..
 So,
 
 I am doing an inner join on 2 tables and displaying the result as follows:
 
 Code=
 table cellspacing=2 cellpadding=2 border=0 tr tdfont 
 face=Arial size=-1bCat#/b/font/td tdfont face=Arial 
 size=-1bCategory/b/font/td
 tdfont face=Arial size=-1bModel/b/font/td
 tdfont face=Arial size=-1bDescription/b/font/td
 tdfont face=Arial size=-1bPrice/b/font/td
 
 /tr
 ?
 
 $Info = mysql_query(SELECT Table1.CatID, Table1.ProdCategory, 
 Table2.ItemID, Table2.ItemDescription, Table2.ItemModel, 
 Table2.ItemPrice FROM Table1 LEFT OUTER JOIN Table2 ON 
 Table1.CatID=Table2.CatID ORDER BY Table2.ItemID);
 
 while ($SRecord = mysql_fetch_array($Info, MYSQL_ASSOC))  {
 
 $CatID = htmlspecialchars($SRecord[CatID]);
 $Category = htmlspecialchars($SRecord[ProdCategory]);
 $Model = htmlspecialchars($SRecord[ItemModel]);
 $Description = htmlspecialchars($SRecord[ItemDescription]);
 $Price = htmlspecialchars($SRecord[ItemPrice]);
 
 ?
 
 tr
 Tdfont face=Arial size=-1? echo ($CatID); 
 ?/FONT/A/td tdfont face=Arial size=-1? 
 echo($Category); ?/font/td tdfont face=Arial size=-1? 
 echo($Model); ?/font/td tdfont face=Arial size=-1? 
 echo($Description); ?/font/td tdfont face=Arial 
 size=-1? echo($Price); ?/font/td ?
 }
 ?
 
 /tr/table
 
 Code==
 
 
 The output of above is
 
 --
 --
 -
 |  Cat# | Category| Model   | Description  | Price
 --
 --
 -
 |   $CatID | $Category  | $Model | $Description | $Price
 --
 --
 --
 
 
 What I need to do is build a table display where the output is grouped 
 by Category.
 
 Like this:
 
 ---
 |   Category = Ist $Category
 ---
 |   $Model - $Description - $Price
 ---
 |   Category = 2nd $Category
 ---
 |  $Model - $Description - $Price
 ---
 |   Category = 3rd $Category
 ---
 |   $Model - $Description - $Price
 -
 
 I think that I can do this
 with a nested array... anyone have an idea??
 
 THanks in advance...
 
 Aleks


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



RE: [PHP-DB] INSERT into mysql from dynamic drop down

2004-01-07 Thread Aleks @ USA.net
Hello  Irin,

Not sure where you problem is but here is what I would check first.

After you open the page that has the drop down list, view the source and
See if the OPTION VALUE= has any value assigned to it. If you are using
IE, on the menu bar click on View - Source. 

Second, if that is fine, after you echo the value, you still need to either

1. set the value for $tutor_name in your sql statement - $tutor_name =
$_POST[tutor_name];
2. Change your sql statement - instead of $tutor_name, say

$sql = INSERT INTO class (class_code, tutor_name, edu_level, timetable_day,
timetable_time)
VALUES
('$class_code','$_POST[tutor_name]','$edu_level','$timetable_day','$timeta
ble_time');

You will have to play with the  and ' to get this right..
I would suggest option 1

Hope this helps..

Aleks

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 07, 2004 1:37 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP-DB] INSERT into mysql from dynamic drop down


Hi all, 

   Right now i would like to INSERT the values from a dynamic drop down
menu into mysql database but encountered some problem here. Values in the
drop down menu are retrieved from DB as follows:

SNIP

SELECT NAME=tutor_name CLASS=textarea ?


$sql = mysql_query(SELECT DISTINCT tutor_name FROM tutor); while ($row =
mysql_fetch_array($sql)) {  print OPTION VALUE=\$tutor_name\ 
.$row[tutor_name]. /option;  } $result = $db-query($sql);

?
/SELECT

/SNIP


---

echo $_POST[tutor_name];

INSERT statement:

$sql = INSERT INTO class (class_code, tutor_name, edu_level, timetable_day,
timetable_time)
VALUES
('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time'
);


---

I am trying to POST the values and then INSERT into DB but was not able to
do so(all other values eg. class_code, edu_level etc...was able to be
INSERTED into DB but not tutor_name. So, how do i insert values into DB
from a dynamic drop down and where have i gone wrong???Hope to get some help
real
soon.=)

All help are greatly appreciated. Thanks in advance.


Regards,
Irin. 

--
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] table structure question

2003-12-29 Thread Aleks @ USA.net
Hi Kirt,

Your tables look ok to me... As for your question, if I were using your
example, I would link the field teams.name to players.team_name. For
example, I would set another column in the teams table to be auto
incrementing. As you add the team information, the team will get a number
automatically. Then when you add the players information you can use the
value ID from the teams table as the value you enter in the
players.team_name column. I do this with an html form that has a drop down
list that is generated by pulling the team name and ID from the teams table.
Something like this:

$sql_teams = mysql_query(SELECT ID, name FROM teams ORDER BY name);

Then I create a drop down list in my html form like this:


select name=team
?  // Creates the list of teams from the teams Table

  while ($LST = mysql_fetch_array($sql_teams)) {

$TeamID = $LST[ID];
$team_name = htmlspecialchars($LST[Name]);
 
echo(option value='$TeamID'$team_name/option\n); 
 }
?
/select

Hope I did not gunk up your question with an answer you did not need...

Anyway, hope this helps...

Aleks

-Original Message-
From: Kirk Babb [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 29, 2003 4:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] table structure question

Hi everyone,

I would like to set up the following two tables inside a db for a soccer
league, but wanted to run their structure by you guys first.  Here it is:

dbname: soccer_stats
tables: teams, players

teams
--
name | captain | division | paid | pmnt_notes | win | loss | tie | goals_for
| goals_against

players
--
lname | fname | team_name | dob | address | telephone | email | sex | yellow
| red | disc_notes | goals_scored | own goals

I've never split the info over multiple tables, but this way made sense to
me for some reason.  I've been thinking, and if, for example, I want to
(using mysql) pull the captain of a specific player, how would I do that?
Is this a good table design in the first place?  Comments and criticisms are
welcome!  Thanks - Kirk

--
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: Display Mysql Result in drop down list

2003-12-23 Thread Aleks @ USA.net
Hi,

I am looking at your code and have a question, in your code you have

print OPTION VALUE=\$tutor_name\ SELECTED .$row [tutor_name].
/option; 

Doesn't the SELECTED piece mark everything listed as selected?? When you
bring up the page with the drop down list and open the source, what does it
show??

I handle this  a little differently, I create my drop down list as follows:

=== Code used 

// First I retrieve all customer information

$BB = mysql_query(SELECT * FROM customer ORDER BY CID );



// Then I create the drop down list

SELECT style=WIDTH: 410px size=1 name=Customer


?
 // Creates the Customer dropdown with the $id number
   while ($Site = mysql_fetch_array($BB)) 
  {
$Sid = $Site[CID];
$Sname = htmlspecialchars($Site[Customer]);
$SCity = htmlspecialchars($Site[City]);
$SState = htmlspecialchars($Site[State]);
$SCountry = htmlspecialchars($Site[Country]);


if($Sid == $Customer) 
{ $add = ' selected'; } else { $add = ''; } 
 
echo(option value='$Sid'$add$Sname nbsp;nbsp;nbsp; $SCity
nbsp;nbsp;nbsp; $SState nbsp;nbsp;nbsp; $SCountry /option\n);  

  }
 
?

/select

=== Code used 

This will create a drop down list where the value of the option is the sites
ID. In another part of this form, if there is a value set for $Customer,
then it will set the $add to selected. This will then make the drop down
list auto select the customer.

The code above is passed to another form for processing and is were the
insert data occurs. Using this method I can echo the form data easily

Hope this helps...

Aleks



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 23, 2003 4:33 AM
To: David Robley
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Display Mysql Result in drop down list

Hi:

then now i'm trying to select a value from the drop down list, echo the
value i have selected and lastly INSERT the value into DB with the following
:
Below's a snippet of code:

snip
//retrieve all tutor_name from DB and display in drop down list

SELECT class=textarea name=tutor_name / ?


$sql = mysql_query(SELECT tutor_name FROM tutor ); while ($row =
mysql_fetch_array($sql)) {  print OPTION VALUE=\$tutor_name\ SELECTED
.$row [tutor_name]. /option;  }  $result = $db-query($sql);

?
/select

/snip

snip
***INSERT selected values into
DB** $tutor_name = $_POST[tutor_name];

$sql = INSERT INTO class (class_code, tutor_name, edu_level, timetable_day,
timetable_time)
VALUES
('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time'
);

//execute query statement
$result = $db-query($sql);

/snip


snip
*echo the value i have
selected***
?
if($selected_tutor_name == $tutor_name)
echo $_POST[tutor_name];
?

/snip


Problem: I was unable to echo the value i selected from drop down as well as
INSERT into DB...wonder where have i gone wrong???
Reali need some help here...all help are greatly appreciated =) Thanks in
advance.


Irin.

-- 
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] Sessions and input form

2003-11-24 Thread Aleks @ USA.net
 Dear Jeffrey,

Yes that is clear thank you... I have used this technique in the past
But wanted to give sessions a try. I did manage to get it working. Seems
That typing code at midnight can lead to frustrating and volatile results..

Thanks again for your response... 

Aleks

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 24, 2003 12:30 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Sessions and input form

Dear Aleks:

What I usually do for a situation like this is...

1) User fills out form and data is INSERTed into the table. If you use
auto_increment for the row id, use PHP's mysql_insert_id to get the id and
use this for step 2.

2) Page confirms data by SELECTing the data from the MySQL table and
inserting it into the form. 

3) If the user makes changes, it is UPDATEd in the MySQL table.

I hope this is clear.

Good luck,

Jeffrey Baumgartner

 Hi all,
 
 I have a form that when populated and submitted is entered into a MySQL
dB.
 What I would like to do is be able to present the submitter with a 
 confirmation page listing the information from the form and then ask 
 them to confirm their submission. Also, if there is a problem or want 
 to change something, they can use the browser back button to go to the 
 previous page and make corrections.
 
 At first I thought that using Sessions to add the form values would 
 allow this to work.. I have gone threw this twice since last night and 
 find that my logic is flawed... It works once... then when another 
 submissions is attempted the process hangs and returns a CGI timeout.
 
 I am by no means a newbie but obviously I am not doing something right 
 with regards to session use. So I ask you more knowledgeable then I 
 for your input and advise. In hind sight I think my problem is that 
 once the information is confirmed and supposed to be entered into the 
 dB I am not destroying the session... Like I said, I think my approach 
 is all wrong here. I already have a login routine that uses sessions 
 and works flawlessly..[at least in appearance].
 
 Any help would be very much appreciated.
 
 TYIA
 
 Aleks
 
 --
 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] number_format problem

2003-11-05 Thread Aleks @ USA.net
 Great answer... One question though, how would you convert it back to 
X,xxx.00 format??

Thanks

Aleks

-Original Message-
From: Peter Beckman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2003 10:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] number_format problem

On Wed, 5 Nov 2003, Dillon, John wrote:

 I want to show a number from a database in the format x,xxx.00 in a 
 textfield, then if it is changed by the user I want to post the value 
 of the number to a decimal field.  However, once you number_format the 
 number it becomes a string, and numbers like 3,379.90 give a value of 
 3 when posted to the database, which is hinted at in the notes on 
 number_format.  I suppose I need a string to number function - can 
 someone tell me what this might be called please?

 I use this:

  $x['funds'] = (int)preg_replace(/[\$,]/,,$x['funds']);

 where $x['funds'] contains something like $3,249,555.32, and the end
result is an int of 3249555.  I drop the cents... you want to keep 'em,
change int to float.

Beckman
---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.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] Select Value with 's

2003-11-05 Thread Aleks @ USA.net
This is a basic question but I am all messed up and need to be straightened
out..
 
Have a select field called customer that works great except when there is a
'  in the customer name.
Have tried addslash and stripslashes but I think I might be using them
wrong.
 
If I addslash to the select value, the value received but the result page is
truncated up to the point of
the '   .
 
Can someone refresh me on the correct use of add and strip slashes...
please??

Thanks
 
Aleks


RE: [PHP-DB] Select Value with 's

2003-11-05 Thread Aleks @ USA.net
Ok.. 

 
First I build my select list:
 
SELECT NAME=Cid size=1
OPTION Selected VALUE=All Customers/OPTION

?
 While ($Site = mysql_fetch_array($S)) 
 {
  $Sid = $Site[CID];
  $SName = htmlspecialchars($Site[Customer]);
  echo(option value='$SName'$SName/options\n);
 }
?
/select

The optional value displays the ['] correctly when I look at the source.

When the submit button is clicked, it passes this form value Cid to the
Result.php page.

First I convert the posted value

$FF = $_POST ['Cid'];

then I use it in a select statement

$Info = mysql_query(select * FROM customer WHERE customer.customer LIKE
'$FF' );

When the customer name is all text, it works fine, but when the customer has
the [']
In it like St Mary's, the value I get on the Result.php page is St Mary

 

-Original Message-
From: ma [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2003 1:18 PM
To: PHP-DB
Subject: Re: [PHP-DB] Select Value with 's

hi!

do not quite understand your problem.. pls post some code?
heres a small snippet that should work well...

$qry = 'SELECT `customer` FROM `customerList` ORDER BY `customer`'; $res =
mysql_query($qry); while($customer = mysql_fetch_object($res)) {
echo stripslashes($res-customer).'br'.\n;
}

hth?

_ma

# life would be easier if i knew the source code...

 Von: Aleks @ USA.net [EMAIL PROTECTED]
 Datum: Wed, 5 Nov 2003 13:12:45 -0500
 An: [EMAIL PROTECTED]
 Betreff: [PHP-DB] Select Value with 's
 
 This is a basic question but I am all messed up and need to be 
 straightened out..
 
 Have a select field called customer that works great except when there 
 is a '  in the customer name.
 Have tried addslash and stripslashes but I think I might be using them 
 wrong.
 
 If I addslash to the select value, the value received but the result 
 page is truncated up to the point of
 the '   .
 
 Can someone refresh me on the correct use of add and strip slashes...
 please??
 
 Thanks
 
 Aleks
 

--
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 Value with 's

2003-11-05 Thread Aleks @ USA.net
Thanks John for the answer But...

Now my select statement on the Result.php page errors out when
The value has the [']in it. What the select statement looks like now
Is 

Select *
From customer
Where customer.customer LIKE 'St Mary's Hospital'

Error message is

Warning mysql_fetch_array(): supplied argument is not a valid MySQL result





-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2003 1:45 PM
To: Aleks @ USA.net; 'ma'; 'PHP-DB'
Subject: Re: [PHP-DB] Select Value with 's

From: Aleks @ USA.net [EMAIL PROTECTED]
 First I build my select list:

 SELECT NAME=Cid size=1
 OPTION Selected VALUE=All Customers/OPTION

 ?
  While ($Site = mysql_fetch_array($S))  {
   $Sid = $Site[CID];
   $SName = htmlspecialchars($Site[Customer]);
   echo(option value='$SName'$SName/options\n);

Easy fix: echo(option value=\$SName\$SName/options\n);

Long version:

htmlspecialchars() does not change single quotes unless you pass ENT_QUOTES
as the second parameter. What you're ending up with is a value such as:

value='St. Mary's'

which, HTML will interpret as a value of St. Mary and an unknown s'
attribute. So,

$SName = htmlspecialchars($Site[Customer], ENT_QUOTES); echo(option
value='$SName'$SName/options\n);

will convert single quotes to HTML entities and not affect the value.

The easy fix above works because it uses double quotes around the value
and htmlspecialchars() already changes double quotes by default.

---John Holmes...

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



RE: [PHP-DB] Select Value with 's

2003-11-05 Thread Aleks @ USA.net
Sorry I left out the exact form 

It is

$info = mysql_query( Select * From customer Where customer.customer LIKE 'St
Mary's Hospital');



-Original Message-
From: ma [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2003 1:56 PM
To: PHP-DB
Subject: Re: [PHP-DB] Select Value with 's

hi

think you should use ' when you create the query and  in the SQL-statement
for comparison:

$qry = 'SELECT *
FROM customer
WHERE customer.customer LIKE '.$FF.'';

_ma 

# life would be easier if i knew the source code...

 Von: Aleks @ USA.net [EMAIL PROTECTED]
 Datum: Wed, 5 Nov 2003 13:52:51 -0500
 An: 'CPT John W. Holmes' [EMAIL PROTECTED], 'ma'
 [EMAIL PROTECTED], 'PHP-DB' [EMAIL PROTECTED]
 Betreff: RE: [PHP-DB] Select Value with 's
 
 Thanks John for the answer But...
 
 Now my select statement on the Result.php page errors out when The 
 value has the [']in it. What the select statement looks like now 
 Is
 
 Select *
 From customer
 Where customer.customer LIKE 'St Mary's Hospital'
 
 Error message is
 
 Warning mysql_fetch_array(): supplied argument is not a valid MySQL 
 result
 
 
 
 
 
 -Original Message-
 From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 05, 2003 1:45 PM
 To: Aleks @ USA.net; 'ma'; 'PHP-DB'
 Subject: Re: [PHP-DB] Select Value with 's
 
 From: Aleks @ USA.net [EMAIL PROTECTED]
 First I build my select list:
 
 SELECT NAME=Cid size=1
 OPTION Selected VALUE=All Customers/OPTION
 
 ?
  While ($Site = mysql_fetch_array($S))  {
   $Sid = $Site[CID];
   $SName = htmlspecialchars($Site[Customer]);
   echo(option value='$SName'$SName/options\n);
 
 Easy fix: echo(option value=\$SName\$SName/options\n);
 
 Long version:
 
 htmlspecialchars() does not change single quotes unless you pass 
 ENT_QUOTES as the second parameter. What you're ending up with is a value
such as:
 
 value='St. Mary's'
 
 which, HTML will interpret as a value of St. Mary and an unknown s'
 attribute. So,
 
 $SName = htmlspecialchars($Site[Customer], ENT_QUOTES); 
 echo(option value='$SName'$SName/options\n);
 
 will convert single quotes to HTML entities and not affect the value.
 
 The easy fix above works because it uses double quotes around the 
 value and htmlspecialchars() already changes double quotes by default.
 
 ---John Holmes...
 

--
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 Value with 's

2003-11-05 Thread Aleks @ USA.net
Tried both... Still no joy...

The statement becomes
$info = mysql_query('Select * From customer Where customer.customer LIKE St
Mary's Hospital');

Maybe I need to be a little clearer... Seem that the sql statement is now
getting the correct value
But the extra ['] is confusing it
 

-Original Message-
From: ma [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2003 2:07 PM
To: PHP-DB
Subject: Re: [PHP-DB] Select Value with 's

hi

ok - than make it this way:

$info = mysql_query( Select * From customer Where customer.customer LIKE St
Mary's Hospital);

anyways - shouldn't it be like this?:

$FF = St Mary's Hospital;
$info = mysql_query('Select * From customer Where customer.customer LIKE
'.$FF.'');

_ma

# life would be easier if i knew the source code...

 Von: Aleks @ USA.net [EMAIL PROTECTED]
 Datum: Wed, 5 Nov 2003 14:01:37 -0500
 An: 'ma' [EMAIL PROTECTED], 'PHP-DB' [EMAIL PROTECTED]
 Betreff: RE: [PHP-DB] Select Value with 's
 
 Sorry I left out the exact form
 
 It is
 
 $info = mysql_query( Select * From customer Where customer.customer 
 LIKE 'St Mary's Hospital');
 
 
 
 -Original Message-
 From: ma [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 05, 2003 1:56 PM
 To: PHP-DB
 Subject: Re: [PHP-DB] Select Value with 's
 
 hi
 
 think you should use ' when you create the query and  in the 
 SQL-statement for comparison:
 
 $qry = 'SELECT *
 FROM customer
 WHERE customer.customer LIKE '.$FF.'';
 
 _ma
 
 # life would be easier if i knew the source code...
 
 Von: Aleks @ USA.net [EMAIL PROTECTED]
 Datum: Wed, 5 Nov 2003 13:52:51 -0500
 An: 'CPT John W. Holmes' [EMAIL PROTECTED], 'ma'
 [EMAIL PROTECTED], 'PHP-DB' [EMAIL PROTECTED]
 Betreff: RE: [PHP-DB] Select Value with 's
 
 Thanks John for the answer But...
 
 Now my select statement on the Result.php page errors out when The 
 value has the [']in it. What the select statement looks like now 
 Is
 
 Select *
 From customer
 Where customer.customer LIKE 'St Mary's Hospital'
 
 Error message is
 
 Warning mysql_fetch_array(): supplied argument is not a valid MySQL 
 result
 
 
 
 
 
 -Original Message-
 From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 05, 2003 1:45 PM
 To: Aleks @ USA.net; 'ma'; 'PHP-DB'
 Subject: Re: [PHP-DB] Select Value with 's
 
 From: Aleks @ USA.net [EMAIL PROTECTED]
 First I build my select list:
 
 SELECT NAME=Cid size=1
 OPTION Selected VALUE=All Customers/OPTION
 
 ?
  While ($Site = mysql_fetch_array($S))  {
   $Sid = $Site[CID];
   $SName = htmlspecialchars($Site[Customer]);
   echo(option value='$SName'$SName/options\n);
 
 Easy fix: echo(option value=\$SName\$SName/options\n);
 
 Long version:
 
 htmlspecialchars() does not change single quotes unless you pass 
 ENT_QUOTES as the second parameter. What you're ending up with is a 
 value
 such as:
 
 value='St. Mary's'
 
 which, HTML will interpret as a value of St. Mary and an unknown s'
 attribute. So,
 
 $SName = htmlspecialchars($Site[Customer], ENT_QUOTES); 
 echo(option value='$SName'$SName/options\n);
 
 will convert single quotes to HTML entities and not affect the value.
 
 The easy fix above works because it uses double quotes around the 
 value and htmlspecialchars() already changes double quotes by default.
 
 ---John Holmes...
 
 
 --
 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] Select Value with 's

2003-11-05 Thread Aleks @ USA.net
BINGO Thanks Rich... I just realized were I was going wrong with my
attempt
Of addslashes I forgot to remove the ['s] in the $_POST statement.

I had $FF = addslashes($_POST ['Cid']);

Thanks for MA and John for your help also Hope to return the favors..

Aleks 

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2003 2:52 PM
To: PHP-DB
Subject: RE: [PHP-DB] Select Value with 's

Using your variables and query, the following, based on one of my own
functional pages, the following should work:

$FF = addslashes($_POST[Cid]);

$info = mysql_query(Select * From customer Where customer.customer LIKE
'$FF' );

Give it a shot. Hope this helps.

Rich

 -Original Message-
 From: ma [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 05, 2003 2:29 PM
 To: PHP-DB
 Subject: Re: [PHP-DB] Select Value with 's
 
 
 hi
 
 hm - it would help if you'd send us the code where you generate the 
 query
 
 _ma
 
 # life would be easier if i knew the source code...
 
  Von: Aleks @ USA.net [EMAIL PROTECTED]
  Datum: Wed, 5 Nov 2003 14:23:06 -0500
  An: 'ma' [EMAIL PROTECTED], 'PHP-DB' 
 [EMAIL PROTECTED]
  Betreff: RE: [PHP-DB] Select Value with 's
  
  Tried both... Still no joy...
  
  The statement becomes
  $info = mysql_query('Select * From customer Where
 customer.customer LIKE St
  Mary's Hospital');
  
  Maybe I need to be a little clearer... Seem that the sql
 statement is now
  getting the correct value
  But the extra ['] is confusing it
  
  
  -Original Message-
  From: ma [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, November 05, 2003 2:07 PM
  To: PHP-DB
  Subject: Re: [PHP-DB] Select Value with 's
  
  hi
  
  ok - than make it this way:
  
  $info = mysql_query( Select * From customer Where
 customer.customer LIKE St
  Mary's Hospital);
  
  anyways - shouldn't it be like this?:
  
  $FF = St Mary's Hospital;
  $info = mysql_query('Select * From customer Where
 customer.customer LIKE
  '.$FF.'');
  
  _ma
  
  # life would be easier if i knew the source code...
  
  Von: Aleks @ USA.net [EMAIL PROTECTED]
  Datum: Wed, 5 Nov 2003 14:01:37 -0500
  An: 'ma' [EMAIL PROTECTED], 'PHP-DB' 
 [EMAIL PROTECTED]
  Betreff: RE: [PHP-DB] Select Value with 's
  
  Sorry I left out the exact form
  
  It is
  
  $info = mysql_query( Select * From customer Where customer.customer 
  LIKE 'St Mary's Hospital');
  
  
  
  -Original Message-
  From: ma [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, November 05, 2003 1:56 PM
  To: PHP-DB
  Subject: Re: [PHP-DB] Select Value with 's
  
  hi
  
  think you should use ' when you create the query and  in the 
  SQL-statement for comparison:
  
  $qry = 'SELECT *
  FROM customer
  WHERE customer.customer LIKE '.$FF.'';
  
  _ma
  
  # life would be easier if i knew the source code...
  
  Von: Aleks @ USA.net [EMAIL PROTECTED]
  Datum: Wed, 5 Nov 2003 13:52:51 -0500
  An: 'CPT John W. Holmes' [EMAIL PROTECTED], 'ma'
  [EMAIL PROTECTED], 'PHP-DB' [EMAIL PROTECTED]
  Betreff: RE: [PHP-DB] Select Value with 's
  
  Thanks John for the answer But...
  
  Now my select statement on the Result.php page errors out when The 
  value has the [']in it. What the select statement
 looks like now
  Is
  
  Select *
  From customer
  Where customer.customer LIKE 'St Mary's Hospital'
  
  Error message is
  
  Warning mysql_fetch_array(): supplied argument is not a
 valid MySQL
  result
  
  
  
  
  
  -Original Message-
  From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, November 05, 2003 1:45 PM
  To: Aleks @ USA.net; 'ma'; 'PHP-DB'
  Subject: Re: [PHP-DB] Select Value with 's
  
  From: Aleks @ USA.net [EMAIL PROTECTED]
  First I build my select list:
  
  SELECT NAME=Cid size=1
  OPTION Selected VALUE=All Customers/OPTION
  
  ?
   While ($Site = mysql_fetch_array($S))  {
$Sid = $Site[CID];
$SName = htmlspecialchars($Site[Customer]);
echo(option value='$SName'$SName/options\n);
  
  Easy fix: echo(option value=\$SName\$SName/options\n);
  
  Long version:
  
  htmlspecialchars() does not change single quotes unless you pass 
  ENT_QUOTES as the second parameter. What you're ending up
 with is a
  value
  such as:
  
  value='St. Mary's'
  
  which, HTML will interpret as a value of St. Mary and
 an unknown s'
  attribute. So,
  
  $SName = htmlspecialchars($Site[Customer], ENT_QUOTES); 
  echo(option value='$SName'$SName/options\n);
  
  will convert single quotes to HTML entities and not
 affect the value.
  
  The easy fix above works because it uses double quotes
 around the
  value and htmlspecialchars() already changes double
 quotes by default.
  
  ---John Holmes...
  
  
  --
  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

[PHP-DB] inserting date from text file

2003-10-15 Thread Aleks @ USA.net
Hi all,

I have a large text file that I am inserting into a mysql db and seem to
have a problem with
the date format. The data is currently in the mm/dd/ format. The command
I am using is

INSERT INTO TABLE
(QID,REV,DATE)
VALUES
(619 , 12 , 1/4/2001);

I am using phpMyAdmin with the above command. I have over 1000 lines of data
to add and
changing all the dates would be a royal pain. Is the note a way to set the
format in the
column description to allow for the current data format to remain as is and
have the
db insert the date in the correct mySQL format??

Thanks for your help

Aleks K

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



RE: [PHP-DB] inserting date from text file

2003-10-15 Thread Aleks @ USA.net
Thanks John for the idea... will use php to extract and reparse the
values in the correct order...

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 15, 2003 5:11 PM
To: Aleks @ USA.net; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] inserting date from text file


From: Aleks @ USA.net [EMAIL PROTECTED]

 I have a large text file that I am inserting into a mysql db and seem to
 have a problem with
 the date format. The data is currently in the mm/dd/ format.

MySQL expects a MMDD or -MM-DD format (the delimiter for the string
version can be any character, actually)

 I am using phpMyAdmin with the above command. I have over 1000 lines of
data
 to add and
 changing all the dates would be a royal pain. Is the note a way to set the
 format in the
 column description to allow for the current data format to remain as is
and
 have the
 db insert the date in the correct mySQL format??

There's no way to set a format. You could insert them into a VARCHAR column,
then use an UPDATE query to pull the string apart and format it into
MMDD and update another DATE column, though.

Or have PHP run pre-process your text file and change the dates for you
(since this is a PHP list. :))

---John Holmes...

--
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] backing up MySQL

2003-09-10 Thread Aleks @ USA.net
Was wondering what are people using to backup their php with MySQL dbs??

Thanks for your time and input..

Aleks. 


RE: [PHP-DB] how to recognize user login name?

2003-09-04 Thread Aleks @ USA.net
I agree with David.. however you can create a membership system using PHP
and
MySQL. I did following the information in a tutorial posted here..
http://www.phpfreaks.com/tutorials/40/0.php

Many useful tutorials here...
Hope this helps...

Aleks K



-Original Message-
From: David Smith [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 8:39 AM
To: Spychaa Wojciech
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] how to recognize user login name?


Spychaa Wojciech wrote:

I have to do user recognizing in m php project. Simplest method i know is
to
recognize for example login name (when user is logging into his local PC)

I've tried to use $USERNAME variable but it isnt what i want because it
recognize login name on server not remote user


If you are referring to the Windows login name, this is not possible
with PHP via the web browser.

--Dave

--
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] Error updating db when using a '

2003-08-21 Thread Aleks @ USA.net
I have a strange problem I am adding records into a MySQL db... there is
a description
column and everything works fine when I add a new record. When I try to edit
an existing
record it fails if I us an apostrophe ['] in the field. I thought that
addslashes would take care
of this but it is not working. Here is the code


// Troubleshooting section Prints out the inform received from the form

echo  ( Output received from form br);
$A =   $_POST['DID'];
echo($Abr); //- For Troubleshooting

$B =   $_POST['DocName'];
echo($Bbr); //- For Troubleshooting

$C =   $_POST['Location'];
echo($Cbr); //- For Troubleshooting

$D =   $_POST['DocDescrib'];
echo($Dbr); //- For Troubleshooting


// Add slashes to preserve proper formatting in db

 $DID = addslashes($A);
 $DocName = addslashes($B);
 $Location = addslashes($C);
 $DocDescrib = addslashes($D);

// SQL used to update the record

// Updates Existing Record
 $sql = (UPDATE MySQL_dB
  SET ModDate=CURDATE(), DocName='$DocName',  DocDescrib='$DocDescrib',
Location='$Location' where DID='$DID');

If I do not use the apostrophe in the DocDescrib field this works fine. The
min I introduce one, I get the following error:

Error adding new Data: you have an error in your SQL syntax near 's

Thanks in advance for your assistance...

Aleks


RE: [PHP-DB] Error updating db when using a '

2003-08-21 Thread Aleks @ USA.net
Found the problem.. seems that spanning the sql statement with a carriage
return messed something up. It works fine now..

Sorry about the return receipt earlier... won't happen again..

Thanks

Aleks

-Original Message-
From: Aleks @ USA.net [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 2:38 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Error updating db when using a '


I have a strange problem I am adding records into a MySQL db... there is
a description
column and everything works fine when I add a new record. When I try to edit
an existing
record it fails if I us an apostrophe ['] in the field. I thought that
addslashes would take care
of this but it is not working. Here is the code


// Troubleshooting section Prints out the inform received from the form

echo  ( Output received from form br);
$A =   $_POST['DID'];
echo($Abr); //- For Troubleshooting

$B =   $_POST['DocName'];
echo($Bbr); //- For Troubleshooting

$C =   $_POST['Location'];
echo($Cbr); //- For Troubleshooting

$D =   $_POST['DocDescrib'];
echo($Dbr); //- For Troubleshooting


// Add slashes to preserve proper formatting in db

 $DID = addslashes($A);
 $DocName = addslashes($B);
 $Location = addslashes($C);
 $DocDescrib = addslashes($D);

// SQL used to update the record

// Updates Existing Record
 $sql = (UPDATE MySQL_dB
  SET ModDate=CURDATE(), DocName='$DocName',  DocDescrib='$DocDescrib',
Location='$Location' where DID='$DID');

If I do not use the apostrophe in the DocDescrib field this works fine. The
min I introduce one, I get the following error:

Error adding new Data: you have an error in your SQL syntax near 's

Thanks in advance for your assistance...

Aleks



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



[PHP-DB] search doc in dB

2003-08-07 Thread Aleks @ USA.net
I have a project were I need to create a search mechanism for a large number
of documents.
I have already created a dB containing the Doc name, its URL location on the
hard drive and a description.
The search is being done against the document name. The complaint I am
getting is that the users may not
know the name of the document or may need to do a search against the
contents of a document in order to
get a list of documents listed by relevance.

1. Will PHP fopen read .pdf as well as .doc types if I upload them into a
table column with the BLOB type set
2. I need to create a search script that will search the title and/or
contents and return a list of relevant documents

Any assistance would be appreciated. Eventually I hope to be able to use the
dB to not only search but to allow the
retrieval of the document instead of having them stored in another location
on the hard drive. This will allow me to
set up another level of security.

Thanks in advance for your help...

Aleks