[PHP-DB] Problem with mysql_num_rows

2002-05-21 Thread Todd Williamsen

I get an invalid argument when trying to create this output of pages to
limit to 20 records per pages.  I removed the line and it stopped the error,
but the next and previous buttons will go on and on even if there is no more
records so I am thinking it is my mysql_num_rows() function

I have gotten this script from here:

http://www.phpbuilder.com/columns/rod2221.php3

If you know of a better one or can help me out on this one, that is much
appreciated

Actual error is:

not a valid mySQL result resource

here is the code:

?php

   $numresults = mysql_query(SELECT * FROM booklist);
  $numrows = mysql_num_rows($numresults);
   FAILS HERE
// next determine if offset has been passed to script, if not use 0
print Pages:;
if (empty($offset)) {
$offset=1;
 }
$connection = mysql_connect(localhost, , ) or die (could not connect
to database);
$db = mysql_select_db(db, $connection) or die(Could not select
database);
$sql = SELECT id,title, author, subject FROM booklist LIMIT $offset,
$limit;
$limit = 20;

// get results
$result = mysql_query($sql, $connection) or die(Could not execute query);
while ($row = mysql_fetch_array ($result))

echo
trtd.$row['title']./tdtd.$row['author']./tdtd.$row['subjec
t']./td/tr;
}
// next we need to do the links to other results

if ($offset==1) { // bypass PREV link if offset is 0
$prevoffset=$offset-20;
print a href=\$PHP_SELF?offset=$prevoffset\PREV/a nbsp; \n;
}

// calculate number of pages needing links
$pages=intval($numrows/$limit);

// $pages now contains int of pages needed unless there is a remainder from
division
if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}

for ($i=1;$i=$pages;$i++) { // loop thru
$newoffset=$limit*($i-1);
print a href=\$PHP_SELF?offset=$newoffset\$i/a nbsp; \n;
}

// check to see if last page
if (!(($offset/$limit)==$pages)  $pages!=1) {
// not last page so give NEXT link
$newoffset=$offset+$limit;
print a href=\$PHP_SELF?offset=$newoffset\NEXT/ap\n;
}

?



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




[PHP-DB] returning all rows

2002-05-20 Thread Todd Williamsen

I know I have asked this silly question before, but forgive me since I have
been a bit rusty with PHP lately

So how do I return all rows?

I have this:

$sql= SELECT id, city, date FROM meetings WHERE city = \$city\ ;
$result = mysql_query($sql,$connection) or die(Couldn't execute query);
while ($row = mysql_fetch_array($result)) {
$id = $row[id];
$city = $row[city];
$date = $row[date];
}
echo $date;
?



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




[PHP-DB] Returning all rows

2002-05-20 Thread Todd Williamsen

I know I have asked this silly question before, but forgive me since I have
been a bit rusty with PHP lately

So how do I return all rows?

I have this:

$sql= SELECT id, city, date FROM meetings WHERE city = \$city\ ;
$result = mysql_query($sql,$connection) or die(Couldn't execute query);
while ($row = mysql_fetch_array($result)) {
$id = $row[id];
$city = $row[city];
$date = $row[date];
}
echo $date;
?



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




[PHP-DB] Re: Returning all rows

2002-05-20 Thread Todd Williamsen

It needs that line to sort them by city. But it only returns one row

Todd Williamsen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I know I have asked this silly question before, but forgive me since I
have
 been a bit rusty with PHP lately

 So how do I return all rows?

 I have this:

 $sql= SELECT id, city, date FROM meetings WHERE city = \$city\ ;
 $result = mysql_query($sql,$connection) or die(Couldn't execute query);
 while ($row = mysql_fetch_array($result)) {
 $id = $row[id];
 $city = $row[city];
 $date = $row[date];
 }
 echo $date;
 ?





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




Re: [PHP-DB] returning all rows

2002-05-20 Thread Todd Williamsen

It needs that line to sort them by city. But it only returns one row

Bogdan Stancescu [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Just lose the WHERE city=\$city\ in the SQL.

 Bogdan

 Todd Williamsen wrote:

 I know I have asked this silly question before, but forgive me since I
have
 been a bit rusty with PHP lately
 
 So how do I return all rows?
 
 I have this:
 
 $sql= SELECT id, city, date FROM meetings WHERE city = \$city\ ;
 $result = mysql_query($sql,$connection) or die(Couldn't execute query);
 while ($row = mysql_fetch_array($result)) {
 $id = $row[id];
 $city = $row[city];
 $date = $row[date];
 }
 echo $date;
 ?
 
 
 






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




[PHP-DB] MS SQL Server 7

2002-02-13 Thread Todd WIlliamsen

I am trying to get PHP to work with MS SQL Server 7, but its not liking
something

when I do a mssql_connect()  it says 

Fatal error: Call to undefined function: mssql_connect() in
c:\inetpub\wwwroot\test.php on line 7

I have added the proper extensions, have put them in the right directory.

Seems like its not recognizing MS SQL Server dll file




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




[PHP-DB] Oracle... Beginner

2002-02-12 Thread Todd WIlliamsen

I would like to try Oracle as a backend. I do have a copy of Oracle 8
server, Oracle Application Server, Oracle Internet Commerce Server.

I am running Windows 2000 server, so all these will and should run on Win2k.

I never used Oracle, so I would like to know:

1. What is the procedure of logging into the DB

2. creating databases

3. Default username and password

I don't necessarily need the info off the bat, but more like where to look
for this information

I looked all over Oracle's website and I tell you its crap, just like
Microsoft's search engine...sucks!

Anyways, any help would be much appreciated!

Thanks!




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




Re: [PHP-DB] Drop Down Menus

2002-02-12 Thread Todd WIlliamsen

here is an example from my page:

 ?
$connection = mysql_connect($databaseserver, $databaseuser, $databasepass)
or die(Can't connect to DB);
$db = mysql_select_db($databasename, $connection);
$sql= SELECT id, State FROM $statetable ORDER BY State ASC;
$result= mysql_query($sql, $connection);
print select name=\State\;
while ($row = mysql_fetch_array($result))
{
$id = $row[id];
$State = $row[State];
print option$State/option;
}
print /SELECT
?


Peter Lovatt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 the row index starts at 0 not 1 so you need $row[0], as you have only one
 field $row[1] will be empty.

 HTH

 Peter

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

  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: 12 February 2002 16:10
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Drop Down Menus
 
 
  Hi wonder if anyone knows what I am doing wrong here.
 
  I have a drop down selection menu that is generated from a mysql
  database. In the database we have over 15 fields one of them
  contains text for the catergory that the entry belongs to. I have
  used the following code to generate my drop down menu but when i
  view it in the browser the drop down menu has not listed the
  categories instead we have blank entries for each selection.
 
  ? mysql_connect(localhost,user,password);
  mysql_select_db(database);
  $sql = select distinct category from books ORDER BY category ASC;
  $makes_result = mysql_query($sql);
  print (select name=\category\\n);
  print(option selected value=\\Please select a
  Category/option\n);
  while($row = mysql_fetch_row($makes_result))
  {
  print(option value=\$row[1]\$row[1]/option\n);
  }
  print(/select); ?
 
  Thanks for the help.
 
  Barry
 
  --
  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] Flipping through database records

2002-02-12 Thread Todd WIlliamsen

how about just not do it by userid?  query some other column thats in there

maybe by last name?

SELECT * FROM $tablename WHERE lname = $lname LIMIT [#results per page]

That should eliminate gaps
Olinux [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Interesting Jason, just to make sure I'm clear:

 basically, you would query the table and
 while loop through the query result and create an
 array and then store that in a session?

 olinux


 --- Jason Cox [EMAIL PROTECTED] wrote:
  Dan,
 
  Here's an idea for you:
 
  Rather than try to pass the uid through the pages,
  pass a counter that will
  act as an index to your result array.  For example,
  let's say you have a
  query like: select * from myTable order by someCol;
  The order by will help
  give some sort of uniformity to the list on each
  page.  Each time you access
  the page, you would run this query and stuff
  everything into an array.  The
  index would be passed in and indicate which record
  in the array to display.
  You would know whether to display the 'prev' and
  'next' labels by comparing
  the index to the size of the array.
 
  If your table is large than you can optimize your
  query so you're not
  returning all the rows everytime.  If the index was
  $idx then you could do
  something like: select * from myTable order by
  someCol limit $idx;  So if
  you had a hundred records and your index was 10 then
  you would only get the
  first 10 records.  Since we're including the order
  by clause, the 10 should
  pretty much stay the same if the table doesn't
  change very often.  With this
  technique you would need to do a count() to find out
  the maximum number rows
  in the table.  Since a count() is faster than a
  query returning many rows,
  the combination of these two statements would be a
  bit faster than running
  the original query on a large table.  But then
  again, on a large table I
  doubt someone would want to browse each row.  That's
  kinda like looking for
  a good book by browsing the card catalog at the
  library... :)
 
  Hope that helps,
  Jason Cox

 __
 Do You Yahoo!?
 Send FREE Valentine eCards with Yahoo! Greetings!
 http://greetings.yahoo.com



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




[PHP-DB] If Statement that makes me cry

2002-02-10 Thread Todd Williamsen

This script is confusing the hell out of me...

What its suppose to do is do a search on documents, and then is it finds
something say who and where it is, but it repeats the message for every hit.

Same goes with the message when there is no results, it repeats it for every
record. All I want it do is say The results for $kw

the list here

then when no results are returned, just say the message once..

the results for $kw returned zero results.

here is the script

?
include variables.php;
$delimiter = ,;

$connection = @mysql_connect($databaseserver, $databaseuser, $databasepass)
or die (could not connect to database);
$db = @mysql_select_db($databasename, $connection) or die(Could not select
database);
$sql = SELECT id, FirstName, LastName, ResumeUp FROM $canidatetable;
$result = mysql_query($sql, $connection) or die(Couldn't execute query);

while ($row = mysql_fetch_array($result))
{
$id = $row['id'];

$FirstName = $row['FirstName'];

$LastName = $row['LastName'];

$filename = /home/sites/madden.williamsen.net/web/recruiter/resumes/
.$row['ResumeUp'];

$fd = fopen($filename,r);

$contents = fread($fd, filesize($filename));

$keywords = explode( $delimiter, $words );

for ($i=0; $i  count($keywords); $i++) {

$kw = $keywords[$i];
=
THE TROUBLE SPOT
=
if( eregi($kw, $contents) )
{
echo The Words $kw has been found in the resume of
a href=\show_can.php?id=$id\$LastName, $FirstName/a
br;
}
else {

echo Your Search Returned Zero Recordsbr;
}
}
}
===
==
fclose($fd);

?



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




[PHP-DB] Searching records...

2002-02-09 Thread Todd Williamsen

What I am doing is user inputs their contact information, then copies and
pastes text and also uploads a formal document, which the location is stored
in the database.

Now, the text that gets pasted into the text field is then stored into the
database for search purposes.

This is the problem... How would I go about searching this field?  I wanted
to return all results with the keyword(s)?

This is what I came up with the Help of Nicole Amashta.  But it doesn't work
too hot.  I feel I am lost

=

?
include variables.php;
$delimiter = ,;

$connection = @mysql_connect($databaseserver, $databaseuser, $databasepass)
or die (could not connect to database);
$db = @mysql_select_db($databasename, $connection) or die(Could not select
database);
$sql = SELECT id, FirstName, LastName, Resume, ResumeUp FROM
$canidatetable;
$result = mysql_query($sql, $connection) or die(Couldn't execute query);

while ($row = mysql_fetch_array($result))
   {
$id = $row['id'];

$FirstName = $row['FirstName'];

$LastName = $row['LastName'];

$filename = $row['Resume'];
 $ResumeUp = $row['ResumeUp'];

   $keywords = explode( $delimiter, $words );

   for ($i=0; $i  count($keywords); $i++) {

   $kw = $keywords[$i];

 if( eregi($kw, $contents) ) {

echo The Words b$kw/b has been found in the resume of

olli$LastName, $FirstName a
href=\http://madden.williamsen.net/recruiter/resumes/$ResumeUp\;Resume/a
/li/ol;
}
else {
echo The keyword $kw was not found in the resume
$LastName, $FirstNamebr;
}
  }

}

?
=



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




[PHP-DB] Searching Documents

2002-02-08 Thread Todd Williamsen

I was wondering if there is a way to search documents.

Scenario:

I have a application where it uploads MS Word documents to a server and
holds the documents location in the database.  What I want is to be able to
search those Word documents via keywords.

Is this possible with PHP?



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




Re: [PHP-DB] addslashes()

2002-02-08 Thread Todd Williamsen

So if I:
Going in
$Notes =  addslashes($Notes);

Going Out:
$Notes = stripslashes($Notes);

wouldn't that kill the html? or no?
Joe Van Meer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi. addslashes() going in to db, stripslashes() coming out :)
  HTH Joe :)


 Todd Williamsen [EMAIL PROTECTED] wrote in message
 002601c1b033$382a4700$f6b2d83f@goofy1">news:002601c1b033$382a4700$f6b2d83f@goofy1...
  Paul,
 
  It is being inserted into a database
 
  -Original Message-
  From: Paul DuBois [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, February 07, 2002 5:41 PM
  To: Todd Williamsen; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] addslashes()
 
 
  At 16:54 -0600 2/7/02, Todd Williamsen wrote:
  Ok..
  
  i tried it out... and it almost works like I want it... weird though
  
  1. when I put in pfont color=bluethis is BLUE/p/font
  
  it prints it in like a bright green.  but if i use the RGB # then its
  fine.
  weird
  
  2.  if there is an apostrophe in the notes, then it will add slashes it
  to
  that as well
  
  so if I type blah blah blah I am going over to my friend's website
  later on
  and here is the address...
  
  a href=http://friends.comFriends/a
  
  it will look like
  
  friend\\\'s
  
  Friends(link)
 
  addslashes() is for escaping values that you're going to insert into a
  database.
 
  If you're generating HTML, use htmlspecialchars() instead.
 
 





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




RE: [PHP-DB] Searching Documents

2002-02-08 Thread Todd Williamsen

So that statement would actually open up the MS Word document and search
it for the keywords specified?

-Original Message-
From: Dan Brunner [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 9:34 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Searching Documents


Hello!!!

Use LIKE in your Select statement...Like this!!


$sql = Select File_Name From Table2 WHERE File_Name LIKE '%$Search%';

$Search would come from a form...


Dan


On Friday, February 8, 2002, at 09:06 AM, [EMAIL PROTECTED] wrote:

 I was wondering if there is a way to search documents.

 Scenario:

 I have a application where it uploads MS Word documents to a server
and
 holds the documents location in the database.  What I want is to be
 able to
 search those Word documents via keywords.

 Is this possible with 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] addslashes()

2002-02-08 Thread Todd Williamsen

Paul..

Going into the database

Coming out of the database

Please read the whole post..  8)

-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 9:40 AM
To: Todd Williamsen; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] addslashes()


At 9:14 -0600 2/8/02, Todd Williamsen wrote:
So if I:
Going in
$Notes =  addslashes($Notes);

Going Out:
$Notes = stripslashes($Notes);

wouldn't that kill the html? or no?

I have no idea.  What do you mean by in and out?
What exactly are you trying to do?  Are you generating HTML for
a Web page, storing data in a database, or are you trying to store
HTML in your database?

Joe Van Meer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi. addslashes() going in to db, stripslashes() coming out :)
   HTH Joe :)


  Todd Williamsen [EMAIL PROTECTED] wrote in message
  002601c1b033$382a4700$f6b2d83f@goofy1">news:002601c1b033$382a4700$f6b2d83f@goofy1...
   Paul,
  
   It is being inserted into a database
  
   -Original Message-
   From: Paul DuBois [mailto:[EMAIL PROTECTED]]
   Sent: Thursday, February 07, 2002 5:41 PM
   To: Todd Williamsen; [EMAIL PROTECTED]
   Subject: Re: [PHP-DB] addslashes()
  
  
   At 16:54 -0600 2/7/02, Todd Williamsen wrote:
   Ok..
   
   i tried it out... and it almost works like I want it... weird
though
   
   1. when I put in pfont color=bluethis is BLUE/p/font
   
   it prints it in like a bright green.  but if i use the RGB # then
its
   fine.
   weird
   
   2.  if there is an apostrophe in the notes, then it will add
slashes it
   to
   that as well
   
   so if I type blah blah blah I am going over to my friend's
website
   later on
   and here is the address...
   
   a href=http://friends.comFriends/a
   
   it will look like
   
   friend\\\'s
   
   Friends(link)
  
   addslashes() is for escaping values that you're going to insert
into a
   database.
  
   If you're generating HTML, use htmlspecialchars() instead.
  
  





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

2002-02-08 Thread Todd Williamsen

Paul,

Sorry for the confusion...

Ok..

I have an application where it organizes candidates for positions for
HR.  There is a Notes field where they can update actions with the
potential candidate.  Now this can be when this person has been
contacted, conversations, or just to say this person is not available,
etc.

There may be a point where quotes need to be added to quote a candidate,
or I wanted to give them the option of adding HTML tags to the field so
that when someone looks at the person's record, that the HTML will be
displayed.  It wasn't just the HTML that was causing problems, but the
quotes as well.

So...

If I add..

Joe Blow said blah blah blah  the query wouldn't execute.  But if I
did Joe Blow said, blah blah blah, it works fine.

I know HTML isn't as touchy and you can actually do without the quotes,
ie, font color=redBLAH/font it will still display red font.

The weird thing is that I have a Job Posting section and when you update
or edit an exsisting job and add HTML, it works fine without the
addslashes() function, but with the Edit Candidate, it craps out...
Weird, both are practically carbon copies of each other, database field
is both set to TEXT and both queries are the same structure.

I cannot figure it out

If you want the URL to look at it, I will send it to you.

Thanks!

-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 10:00 AM
To: Todd Williamsen; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] addslashes()


At 9:53 -0600 2/8/02, Todd Williamsen wrote:
Paul..

Going into the database

Coming out of the database

Please read the whole post..  8)

I did.  It's not clear, at least to me, what you're trying to do.
You say print at one point and insert into database at another
point.

I'm pretty sure I know the solution.  What's not clear to me is
the *problem*.

Where are the data coming from?  Are you generating it within the
script?
Are you receiving it as the contents of a web form?

What are you doing with that data?  Printing it?  Storing it into the
database?  Storing it into the database so that you can print it as
a Web page later?


-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 9:40 AM
To: Todd Williamsen; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] addslashes()


At 9:14 -0600 2/8/02, Todd Williamsen wrote:
So if I:
Going in
$Notes =  addslashes($Notes);

Going Out:
$Notes = stripslashes($Notes);

wouldn't that kill the html? or no?

I have no idea.  What do you mean by in and out?
What exactly are you trying to do?  Are you generating HTML for
a Web page, storing data in a database, or are you trying to store
HTML in your database?

Joe Van Meer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hi. addslashes() going in to db, stripslashes() coming out :)
HTH Joe :)


   Todd Williamsen [EMAIL PROTECTED] wrote in message
   002601c1b033$382a4700$f6b2d83f@goofy1">news:002601c1b033$382a4700$f6b2d83f@goofy1...
Paul,
   
It is being inserted into a database
   
-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 5:41 PM
To: Todd Williamsen; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] addslashes()
   
   
At 16:54 -0600 2/7/02, Todd Williamsen wrote:
Ok..

i tried it out... and it almost works like I want it... weird
though

1. when I put in pfont color=bluethis is BLUE/p/font

it prints it in like a bright green.  but if i use the RGB #
then
its
fine.
weird

2.  if there is an apostrophe in the notes, then it will add
slashes it
to
that as well

so if I type blah blah blah I am going over to my friend's
website
later on
and here is the address...

a href=http://friends.comFriends/a

it will look like

friend\\\'s

Friends(link)
   
addslashes() is for escaping values that you're going to insert
into a
database.
   
If you're generating HTML, use htmlspecialchars() instead.
   
   





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

2002-02-08 Thread Todd Williamsen

Paul,

No kidding I see the problem, that is why I am asking how do I solve it.
I don't need the problem re-explained to me 8)

-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 10:21 AM
To: Todd Williamsen; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] addslashes()


At 10:06 -0600 2/8/02, Todd Williamsen wrote:
Paul,

Sorry for the confusion...

Ok..

I have an application where it organizes candidates for positions for
HR.  There is a Notes field where they can update actions with the
potential candidate.  Now this can be when this person has been
contacted, conversations, or just to say this person is not available,
etc.

I assume by this you mean you have a form-based application through
which the information is submitted.


There may be a point where quotes need to be added to quote a
candidate,
or I wanted to give them the option of adding HTML tags to the field so
that when someone looks at the person's record, that the HTML will be
displayed.  It wasn't just the HTML that was causing problems, but the
quotes as well.

This makes your problem basically intractable.  Sorry.

If I input: Candidate requires salary  $100K and  $75K

Then it like kinda like there's a tag there, because of the  and 

Or if I input: Candidate has a, shall we say, checkered past

Then the value has quotes.

Now, you want to let people put in something like:

Candidate has a, shall we say, font color=redcheckered/font past.


Now, you can store any of those values into the database easily.   Just
use addslashes() to escape the values that are special in SQL.  When you
retrieve the values, you'll get exactly the values as shown above.

But then what do you do with them?  For the first two instances, you
need to display the ,  and  characters literally, which you might
do by converting them to HTML entities (lt;, lt;, and quot;) by
running
the strings through htmlspecialchars() before printing them as part of
the
Web page.

But for the third instance, you want to pass those same characters
through to the browser so that it interprets them as HTML markup.

How are you going to tell?


See the problem?



So...

If I add..

Joe Blow said blah blah blah  the query wouldn't execute.  But if I
did Joe Blow said, blah blah blah, it works fine.

I know HTML isn't as touchy and you can actually do without the quotes,
ie, font color=redBLAH/font it will still display red font.

The weird thing is that I have a Job Posting section and when you
update
or edit an exsisting job and add HTML, it works fine without the
addslashes() function, but with the Edit Candidate, it craps out...
Weird, both are practically carbon copies of each other, database field
is both set to TEXT and both queries are the same structure.

I cannot figure it out

If you want the URL to look at it, I will send it to you.

Thanks!



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




RE: [PHP-DB] addslashes()

2002-02-08 Thread Todd Williamsen

Explain this...

Now I have Edit Jobs where you can do the same HTML and other SQL
specific stuff in the Job Description, that works with no problems
whatsoever, then I have this Edit Candidate page that is structured
EXACTLY the same, and the Edit Candidate craps out...

Why is that?  One works and the other doesn't?

-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 10:34 AM
To: Todd Williamsen; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] addslashes()


At 10:22 -0600 2/8/02, Todd Williamsen wrote:
Paul,

No kidding I see the problem, that is why I am asking how do I solve
it.

By writing a content parser that is intelligent enough to recognize HTML
constructs and pass them through literally, while recognizing when your
people write other stuff containing the same characters that does not
signify HTML.  In other words, a parser that can read their minds.  Good
luck. :-)

Alternatively, tell them to signal special constructs using a syntax
that doesn't overlap HTML so that you can recognize the constructs and
transform them to HTML when you render a Web page.

Alternatively, tell them that if they want to include literal characters
like  or , they must enter them as lt; or gt;.  In this case, you
interpret the text as HTML that's already properly escaped and you
simply
display it as is with no extra conversion.

None of these are particularly attractive.  It's an ugly problem; I
suspect
it has no pretty solution.

I don't need the problem re-explained to me 8)

-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 10:21 AM
To: Todd Williamsen; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] addslashes()


At 10:06 -0600 2/8/02, Todd Williamsen wrote:
Paul,

Sorry for the confusion...

Ok..

I have an application where it organizes candidates for positions for
HR.  There is a Notes field where they can update actions with the
potential candidate.  Now this can be when this person has been
contacted, conversations, or just to say this person is not available,
etc.

I assume by this you mean you have a form-based application through
which the information is submitted.


There may be a point where quotes need to be added to quote a
candidate,
or I wanted to give them the option of adding HTML tags to the field
so
that when someone looks at the person's record, that the HTML will be
displayed.  It wasn't just the HTML that was causing problems, but the
quotes as well.

This makes your problem basically intractable.  Sorry.

If I input: Candidate requires salary  $100K and  $75K

Then it like kinda like there's a tag there, because of the  and 

Or if I input: Candidate has a, shall we say, checkered past

Then the value has quotes.

Now, you want to let people put in something like:

Candidate has a, shall we say, font color=redcheckered/font past.


Now, you can store any of those values into the database easily.   Just
use addslashes() to escape the values that are special in SQL.  When
you
retrieve the values, you'll get exactly the values as shown above.

But then what do you do with them?  For the first two instances, you
need to display the ,  and  characters literally, which you might
do by converting them to HTML entities (lt;, lt;, and quot;) by
running
the strings through htmlspecialchars() before printing them as part of
the
Web page.

But for the third instance, you want to pass those same characters
through to the browser so that it interprets them as HTML markup.

How are you going to tell?


See the problem?



So...

If I add..

Joe Blow said blah blah blah  the query wouldn't execute.  But if I
did Joe Blow said, blah blah blah, it works fine.

I know HTML isn't as touchy and you can actually do without the
quotes,
ie, font color=redBLAH/font it will still display red font.

The weird thing is that I have a Job Posting section and when you
update
or edit an exsisting job and add HTML, it works fine without the
addslashes() function, but with the Edit Candidate, it craps out...
Weird, both are practically carbon copies of each other, database
field
is both set to TEXT and both queries are the same structure.

I cannot figure it out

If you want the URL to look at it, I will send it to you.

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: Searching Documents

2002-02-08 Thread Todd Williamsen

No one knows???

hmm...  I looked around on php.net couldn't find anything regarding this..
would I need to do these searches in MS Word docs with ASP?


Todd Williamsen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I was wondering if there is a way to search documents.

 Scenario:

 I have a application where it uploads MS Word documents to a server and
 holds the documents location in the database.  What I want is to be able
to
 search those Word documents via keywords.

 Is this possible with PHP?





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




RE: [PHP-DB] Re: Searching Documents

2002-02-08 Thread Todd Williamsen

Yes,

I was thinking COM/DCOM, but then does PHP able to do that?  Or do I
need to resort to ASP(Awful Scripting Pages)?

-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 12:40 PM
To: Todd Williamsen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Searching Documents


Todd,

 No one knows???

=or isn't telling?

 hmm...  I looked around on php.net couldn't find anything regarding
this..
 would I need to do these searches in MS Word docs with ASP?

=go ahead if you are aspidexterous...

=the Word document format is proprietary information - ie not 'open'. So
it is a 'bit much' expecting an open
system (PHP) to gain access! Try gaining access to words in a Word doc
from even Access!?

=What about PHP-COM/DCOM?
=dn


  I was wondering if there is a way to search documents.
 
  Scenario:
 
  I have a application where it uploads MS Word documents to a server
and
  holds the documents location in the database.  What I want is to be
able
 to
  search those Word documents via keywords.
 
  Is this possible with 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] Re: Searching Documents

2002-02-08 Thread Todd Williamsen

Now, if I do COM with PHP, then does this need to be on a Windows
server?  Currently it sits on a Linux box.


-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 12:40 PM
To: Todd Williamsen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Searching Documents


Todd,

 No one knows???

=or isn't telling?

 hmm...  I looked around on php.net couldn't find anything regarding
this..
 would I need to do these searches in MS Word docs with ASP?

=go ahead if you are aspidexterous...

=the Word document format is proprietary information - ie not 'open'. So
it is a 'bit much' expecting an open
system (PHP) to gain access! Try gaining access to words in a Word doc
from even Access!?

=What about PHP-COM/DCOM?
=dn


  I was wondering if there is a way to search documents.
 
  Scenario:
 
  I have a application where it uploads MS Word documents to a server
and
  holds the documents location in the database.  What I want is to be
able
 to
  search those Word documents via keywords.
 
  Is this possible with 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] Re: Searching Documents

2002-02-08 Thread Todd Williamsen

Well,

This application would eventually land on either Linux or Windows box, it
would be for internal use only, so it wouldn't get wacked too bad.  I know
IIS5 has a bunch of COM built-ins.

The problem of going to like a text based documents is that this is for
resume management and 99% of the resumes are in MS Word format, so thats the
reason why
Court Shrock [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 correct to my knowledge.

 I am not sure even running ASP on a linux server would allow you to open
the
 word documents, as I think ASP uses COM to do the dirty work.

 of course, you could always do the world a favor and not use microsoft's
 proprietary file formats in any way.  an open standard will always be
easier
 and be able to reach the most people--even micorosft products can read
open
 standard documents, why shutoff the rest of the world to what you are
doing
 by using M$?

 glad to hear you are running linux, though, so you must already know most
of
 this :-)

 best of luck in your endeavors!

 court

  -Original Message-
  Now, if I do COM with PHP, then does this need to be on a Windows
  server?  Currently it sits on a Linux box.



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




RE: [PHP-DB] Re: Searching Documents

2002-02-08 Thread Todd Williamsen

DL

Sounds cool!!  Get to work!  LOL!

Well, as soon as I get some idea what the hell I will be doing I will
start it, and I will keep you guys informed on it if you like.  For DL's
app, it would be the opposite, but same method, but backwards, right?

-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 1:33 PM
To: Shrock, Court; 'Todd Williamsen'
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Searching Documents


Court, Todd, et al

 Actually, PHP does COM very wellsearch the PHP-WIN list about
COM and
 Word and you should find some good hints and examples to get going.
I
 haven't accessed the keywords portion of a word document yet, but
someone
 wrote a spellcheck function that used the spellcheck built into Word
using
 PHP COM.  There is also a really helpful article at phpbuilder.com
that gets
 you started with COM.  If you have trouble finding them, I could
forward
 some messages to you from that list.

 -Original Message-
 I was thinking COM/DCOM, but then does PHP able to do that?  Or do I
 need to resort to ASP(Awful Scripting Pages)?



Thanks for that comment Court. I have seen the entries in the PHP manual
- and possibly one or two of those
articles (but not yet studied them - so many PHP info sources/ideas but
so little time!).

The spell-check exploit caught my eye - a good way to make use of a
well-established (and if you use if
frequently - a well invested) tool.

Unlike Todd's application (getting data out of Word) I was thinking of
going the 'other way' (yes there's always
one!). HTML/browsers are good for showing information on the screen -
whether a data-entry type of form, or a
web page or descriptive/narrative information (eg a PHPbuilder article).
However when you want to print the data
out, browsers are pretty basic!

So I was wondering about extending the idea of constructing web
documents from a db/on the fly for display in a
browser, to going the next step and reproducing the same doc in (say)
Word (using its
presentation/printing/formatting features), so that the doc can be
presented with natty facilities, eg
page/chapter headings/footings, page numbers, chapters and table of
contents, cover page(s), indexes/indices,
etc - 'camera ready'!

Anyone seen it done?
=dn




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




RE: [PHP-DB] Re: Searching Documents

2002-02-08 Thread Todd Williamsen

I did get a reply regarding searching Word documents, and one person
said that if Word uses an ASCII format, then use the regex function..
She tried it, and it worked..so who knows!

Now I got to figure out how to use it... geez

-Original Message-
From: Shrock, Court [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 1:51 PM
To: 'DL Neil'; Todd Williamsen
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: Searching Documents


If running meant at the process level and not just installed, then
word
does not have to be running.COM creates the appropriate instances of
whatever is requested via COM.  But yes, Word does have to be installed.

However, wonder what the wine project could afford this discussion?
Maybe
you could do it on a 'nix afterall?!

 -Original Message-
 I assume if you are setting up a dynamic connection to Word,
 Word will have to be running - which almost implies
 a Windows box.

 Whether the COM component/add-on to PHP (also?) demands a
 Windows box, I can't say.



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




[PHP-DB] File deletion

2002-02-07 Thread Todd Williamsen

I created a couple of forms where one inserts new contact data with a file,
in this case its a resume.  Now, I want to create a form where a user can
update the information by inserting their updated information and if there
is a new resume then it would be uploaded.

I got the upload part down, but i would like to delete the old resume when
the update is done, only if there is an update done to the resume.  This
more for file management than anything.

I am sure this is possible, but I thought I would ask all you PHP experts
first since I am a semi-newbie at this...

thanks!



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




[PHP-DB] Re: THIS IS TRUE !!!

2002-02-07 Thread Todd Williamsen

Yes you can, i forget how though...  I dropped the ODBC and MS databases a
year ago...  I wish I remembered!


Kerem Can Karakas [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 how can you do that

 Francisco Aquino wrote:

  Can I access a Database like MsAccess without ODBC (DSNLess) 
  FAST!
 
 
  Francisco Aquino
  (Brasil - We're Not Indians)
 
 
 




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




[PHP-DB] Re: Ok another update

2002-02-07 Thread Todd Williamsen

Jennifer...

$query=select name, days from wt_users where uid=$uid;

change to:

$query=SELECT  name, days FROM wt_users WHERE uid=\$uid\ ;

You also need to make sure the page that is calling this script has a valid
value of $uid otherwise it won't work.



Jennifer Downey [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Everyone,

 I want to first thank you for helping with the last question I had. It
 didn't help but I finally figured it out. This one though has me stumped.

 I have started using a portal script thinking I might be able to see a
 little better how php works. It will do fine for me as far as my site will
 go. But here is the problem. I want to tell a user how many days they have
 left until a certain thing happens. The portal is phpwebthings so if
anyone
 is familiar with it...



 The problem is I can't figure out how to get the username from the
database
 here is the code I am trying to make work.


 ?
 $db[days]=(UPDATE wt_users set days = days - 1 where uid=$uid);
 $result=mysql_query($db[days]);

 $query=select name, days from wt_users where uid=$uid;
 $ret = mysql_query($query);
 while(list($name, $days) = mysql_fetch_row($ret))


 print($name you have $days days to complete your questionnaire);
 ?

 I can't get it to work unless I specify a specific user. Like
$query=select
 name, days from wt_users where uid=1;

 How do I pull the user from the session? Also when I do specify a user and
 refresh the page it updates the count down how do I get it to only update
 once
 a day.

 Any help would be appreciated!
 Thanks
 Jennifer Downey










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




[PHP-DB] addslashes()

2002-02-07 Thread Todd Williamsen

I have a Notes field where users can add notes.  Now, there will be times
when they use quotes  or maybe even HTML, what is the correct way of using
this function?

I have tried:

addslashes($Notes);

and

$Notes addslashes($Notes);

neither work..

I thought I would ask this great newsgroup!

Thanks



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




Re: [PHP-DB] addslashes()

2002-02-07 Thread Todd Williamsen

Ok..

i tried it out... and it almost works like I want it... weird though

1. when I put in pfont color=bluethis is BLUE/p/font

it prints it in like a bright green.  but if i use the RGB # then its fine.
weird

2.  if there is an apostrophe in the notes, then it will add slashes it to
that as well

so if I type blah blah blah I am going over to my friend's website later on
and here is the address...

a href=http://friends.comFriends/a

it will look like

friend\\\'s

Friends(link)

.
Acealex [EMAIL PROTECTED] wrote in message
002001c1b027$ec33b7b0$e4d22fc2@acealex">news:002001c1b027$ec33b7b0$e4d22fc2@acealex...
 Try
 $Notes = addslashes($Notes);

 You where almost right :)

 /Alexander

 - Original Message -
 From: Todd Williamsen [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, February 07, 2002 11:32 PM
 Subject: [PHP-DB] addslashes()


  I have a Notes field where users can add notes.  Now, there will be
 times
  when they use quotes  or maybe even HTML, what is the correct way of
 using
  this function?
 
  I have tried:
 
  addslashes($Notes);
 
  and
 
  $Notes addslashes($Notes);
 
  neither work..
 
  I thought I would ask this great newsgroup!
 
  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] addslashes()

2002-02-07 Thread Todd Williamsen

Paul,

It is being inserted into a database

-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 5:41 PM
To: Todd Williamsen; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] addslashes()


At 16:54 -0600 2/7/02, Todd Williamsen wrote:
Ok..

i tried it out... and it almost works like I want it... weird though

1. when I put in pfont color=bluethis is BLUE/p/font

it prints it in like a bright green.  but if i use the RGB # then its
fine.
weird

2.  if there is an apostrophe in the notes, then it will add slashes it
to
that as well

so if I type blah blah blah I am going over to my friend's website
later on
and here is the address...

a href=http://friends.comFriends/a

it will look like

friend\\\'s

Friends(link)

addslashes() is for escaping values that you're going to insert into a
database.

If you're generating HTML, use htmlspecialchars() instead.



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




[PHP-DB] Search results

2002-02-06 Thread Todd Williamsen

I have done a search page based on a specific column name, but in some
columns there is no results to be returned..

What I would like to do is display an error message stating that there is no
results .. something like Sorry your search returned Zero Rows
=
Here is my code:

?
$connection = @mysql_connect($databaseserver, $databaseuser, $databasepass)
or die(Can't connect to DB);
$db = @mysql_select_db($databasename, $connection) or die(could not select
DB);
$sql = SELECT id, FirstName, LastName FROM Canidate WHERE Industry =
\$Industry\;
$result = @mysql_query($sql, $connection) or die(could not execute query);

$contact_list = ul;
while ($row = mysql_fetch_array($result)) {

$id = $row[id];
$FirstName = $row[FirstName];
$LastName = $row[LastName];
$contact_list .=lia href=\show_can.php?id=$id\$LastName,
$FirstName/a;
}
$contact_list .=/ul;
$msg = font face=\arial\p align=\center\Sorry, Your Search Results
Returned Zero Records/p/font;
?

html
head
titleYour Search Results/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body
p align=centerfont face=Arial, Helvetica, sans-serifuYour Search
Results
  for b quot;
  ? echo $Industry; ?
  quot; /b/u/font/p
== this is the code block that is stumping me
?
if ($Industry != ) {
echo $msg;

} else {
echo $contact_list;
}
?

p align=centera href=admin.htmfont face=Arial, Helvetica,
sans-serifGo
  Back to Main Menu/font/a/P

/body
==



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




[PHP-DB] File Uploading... Two problems...

2002-02-05 Thread Todd Williamsen

I have been successfully able to upload the files to the server and its path
stored in the database..

Now I have two small issues...

1.  How would I automate the file naming otherwise errors will fly (can't
copy file... blah blah)

2.  The second part is the most annoying.  It seems that I cannot get the
script to put the files into a directory I specify only where the script
resides.  I thought it was a permission issue, but the folder has been chmod
to 777 and it still won't do it...

Directory structure

home
web
recruiter  --- folder where the scripts reside
resumes --  the destination where I want the uploaded files to
reside

here is the code...

?

// if $img_name isn't empty, try to copy the file
if ($img1_name != ) {

 // copy the file to a directory or
 //die and print an error message

 // NOTE! if you're on a Windows machine,
 // use Windows pathnames, like so:
 // copy($img1, C:\\some\\directory\\path\\$img1_name);

 copy($img1,
home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name)
  or die(Couldn't copy the file!);

} else {

 // if $img_name was empty, die and let us know why
 die(No input file specified);

}

?

thanks




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




[PHP-DB] FIle Uploading to database

2002-02-03 Thread Todd Williamsen

I don't want the file to be stored in the database, but its location.

What I want to do:

Upload a file, it gets stored on the webserver, but its location on the
server is stored in the database.

Where do I look for something like this?

What data type would I use to store the URL or file location?

Thank you



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




[PHP-DB] Re: FIle Uploading to database

2002-02-03 Thread Todd Williamsen

Well...  thanks to Dan Burner for the script...  BUT

I cannot get this friggin INSERT statement to execute..  which craps out..
I cannot figure it out.  I have been staring at it for about an hour and I
still cannot figure it out

here it is:

$db = @mysql_select_db($db_name, $connection) or die(Could not select
database);
$query = INSERT INTO Canidate(FirstName, LastName, Industry, Address1,
Address2, City, State, Zip, LocationPref, Phone, Email, ResumeUp) VALUES
('$FirstName', '$LastName', '$Industry' '$Address1', 'Address2', '$City',
'$State', '$Zip', '$LocationPref', '$Phone', '$Email', '$ResumeUp2');
$result = @mysql_query($query, $connection) or die(could not execute
query);
$pat = array(#, @, *, , %, @,$,',`);
$w= '_';
$ResumeUp2 = str_replace ($pat, $w, stripslashes($ResumeUp));
exec(cp '$ResumeUp' '/resumes/$ResumeUp2');
?

it errors out on the $result could not execute query

Let me know if you need more info!

Thank you!


Todd Williamsen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I don't want the file to be stored in the database, but its location.

 What I want to do:

 Upload a file, it gets stored on the webserver, but its location on the
 server is stored in the database.

 Where do I look for something like this?

 What data type would I use to store the URL or file location?

 Thank you





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




[PHP-DB] Re: FIle Uploading to database

2002-02-03 Thread Todd Williamsen

Umm..

SET parameter is for the UPDATE query


Adam Royle [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You missed the SET parameter in your query... example is below...

 $query = INSERT INTO Canidate SET (FirstName, LastName, Indus...

 Adam

 -Original Message-
 From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 04, 2002 11:06 AM
 To: [EMAIL PROTECTED]
 Subject: Re: FIle Uploading to database


 Well...  thanks to Dan Burner for the script...  BUT

 I cannot get this friggin INSERT statement to execute..  which craps out..
 I cannot figure it out.  I have been staring at it for about an hour and I
 still cannot figure it out

 here it is:

 $db = @mysql_select_db($db_name, $connection) or die(Could not select
 database);
 $query = INSERT INTO Canidate(FirstName, LastName, Industry, Address1,
 Address2, City, State, Zip, LocationPref, Phone, Email, ResumeUp) VALUES
 ('$FirstName', '$LastName', '$Industry' '$Address1', 'Address2', '$City',
 '$State', '$Zip', '$LocationPref', '$Phone', '$Email', '$ResumeUp2');
 $result = @mysql_query($query, $connection) or die(could not execute
 query);
 $pat = array(#, @, *, , %, @,$,',`);
 $w= '_';
 $ResumeUp2 = str_replace ($pat, $w, stripslashes($ResumeUp));
 exec(cp '$ResumeUp' '/resumes/$ResumeUp2');
 ?

 it errors out on the $result could not execute query

 Let me know if you need more info!

 Thank you!






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




[PHP-DB] Automating Date in mySQL

2002-02-02 Thread Todd Williamsen

I want the date to automatically be updated.  So if a post was made on
2/10/2001 I would like it to put it automatically in the database.

I do have a column called Date and the datatype is set to date.  But when
I add a record even if the sql states to insert the date it doesn't, or does
the date need to be manually added?

Thanks



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




[PHP-DB] SELECT statement does not return rows

2002-02-01 Thread Todd Williamsen

Weird..

I want to be able to edit records, which I have done in the past, and I
cannot see why it isn't working...  I have tried single qoutes around the
$row =  and that doesn't work either.  here is the code:

$db = @mysql_select_db($db_name, $connection) or die(Could not select
database);
$sql=SELECT * FROM Jobs WHERE id = '$id' ;
$result = mysql_query($sql,$connection) or die(Couldn't execute query);
while ($row = mysql_fetch_array($result))
{
$id = $row[id];
$Industry = $row[Industry];
$Other = $row[Other];
$JobTitle = $row[JobTitle];
$Description = $row[Description];
$Location = $row[Location];
$Date = $row[Date];
}
?
html
head
TitleEdit Job Posting/title
/head
body
h1Edit Job Posting/h1
form method=post action=do_mod_job.php
input type=hidden name=id value=? echo $id; ?
  table cellspacing=3 cellpadding=5 align=center
tr
thJob Information and Location/th
thJob Description/th
/tr
tr
td valign=top
pstrongJob Title:/strongbr
input type=text name=JobTitle value=?php echo $JobTitle? size=50
maxlength=75/p
pstrongIndustry:/strongbr
input type=text name=Industry value=? echo $Industry; ? size=50
maxlength=75/p
pstrongOther:/strongbr
input type=text name=Other value=? echo $Other;? size=50
maxlength=75/p
pstrongLocation:/strongbr
inout type=text name=Location value=? echo $Location; ? size=50
maxlength=75/p
pstrongDate:/strongbr
input type=text name=Date value=? echo $Date; ? size=30
maxlength=40/p
/td
td valign=top
pstrongDescription:/strongbr
  textarea name=Description cols=50 rows=10? echo
$Description; ?/textarea
/p
/td
/tr
tr
td align=center colspan=2br
pinput type=submit name=submit value=Update Job/p
br
/td
/tr
/table
/form
/body
/html



-- 
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] 2 Questions... INSERT and searching records....

2002-01-31 Thread Todd Williamsen

It seems that my insert statement doesn't want to cooperate..  I used the
same format as in Julie Meloni's book.  I know, sometimes, her code doesn't
always work either.

here it is:

$sql = INSERT INTO Jobs (id, Industry, Other, JobTitle, Description,
Location, Date)
 VALUES
 (\\,
 \$id\, \$Industry\, \$Other\, \$JobTitle\, \$Description\,
\$Location\, \$Date\);
 $result = @mysql_query($sql) or die(OOPS!!  Couldn't Execute Query!);
 ?

its not the whole code block... it dies and executes the OOPS!!  Couldn't
Execute Query! statement.
what is wrong... anybody?  Bueller?



-- 
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] Re: 2 Questions... INSERT and searching records....

2002-01-31 Thread Todd Williamsen

OOps... second question...

I wanted to do a search of text documents that are inserted into the
database.

1. What is the best data type for large amounts of text, like 2000
characters.  I thought BLOB, but I could be wrong...

2.  Within the above text, I wanted to search via keywords.  How would I do
that?


Todd Williamsen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 It seems that my insert statement doesn't want to cooperate..  I used the
 same format as in Julie Meloni's book.  I know, sometimes, her code
doesn't
 always work either.

 here it is:

 $sql = INSERT INTO Jobs (id, Industry, Other, JobTitle, Description,
 Location, Date)
  VALUES
  (\\,
  \$id\, \$Industry\, \$Other\, \$JobTitle\, \$Description\,
 \$Location\, \$Date\);
  $result = @mysql_query($sql) or die(OOPS!!  Couldn't Execute Query!);
  ?

 its not the whole code block... it dies and executes the OOPS!!  Couldn't
 Execute Query! statement.
 what is wrong... anybody?  Bueller?





-- 
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] Select statement only returns 1 record

2002-01-30 Thread Todd Williamsen

I am trying to get data from two columns, FirstName and Last name and
displaying all the records LastName, FirstName in a drop down menu.

The weird thing is that it only displays one record.  I thought the table
was hosed, but its not.  I tried it through another database and still
doesn't work.

Here is the code:

?
$db = mysql_connect($dbserver, $dbuser, $dbpass);
mysql_select_db($dbname,$db);
$sortby = name ASC;
$sql=SELECT * FROM webl_players ORDER BY $sortby;
$result=mysql_query($sql,$db);
$row = mysql_fetch_array($result);
$FirstName = $row[FirstName];
$LastName = $row[LastName];
?

select name=canidate
  option selected
  ?php echo $LastName, $FirstName; ?
  /option

I would list the whole page but its long!  There is another SQL statement at
the top of the page:

?php

$db = mysql_connect($dbserver, $dbuser, $$dbpass);
mysql_select_db($dbname, $db);
$sql = SELECT * FROM Canidate SORT BY 'LastName';
$result = mysql_query($sql);
?



-- 
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] Select statement only returns 1 record

2002-01-30 Thread Todd Williamsen

Nope, that doesn't work

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 30, 2002 1:01 PM
To: 'Todd Williamsen'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Select statement only returns 1 record


?
$db = mysql_connect($dbserver, $dbuser, $dbpass);
mysql_select_db($dbname,$db);
$sortby = name ASC;
$sql=SELECT * FROM webl_players ORDER BY $sortby;
$result=mysql_query($sql,$db);

print select name=canidate;
while( $row = mysql_fetch_array($result) )
{
$FirstName = $row['FirstName'];
$LastName = $row['LastName'];
$id=$row['id'];
print option value=$id $LastName, $FirstName/option;
}
?
print /SELECT;

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 12:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select statement only returns 1 record


I am trying to get data from two columns, FirstName and Last name and
displaying all the records LastName, FirstName in a drop down menu.

The weird thing is that it only displays one record.  I thought the
table
was hosed, but its not.  I tried it through another database and still
doesn't work.

Here is the code:

?
$db = mysql_connect($dbserver, $dbuser, $dbpass);
mysql_select_db($dbname,$db);
$sortby = name ASC;
$sql=SELECT * FROM webl_players ORDER BY $sortby;
$result=mysql_query($sql,$db);
$row = mysql_fetch_array($result);
$FirstName = $row[FirstName];
$LastName = $row[LastName];
?

select name=canidate
  option selected
  ?php echo $LastName, $FirstName; ?
  /option

I would list the whole page but its long!  There is another SQL
statement at
the top of the page:

?php

$db = mysql_connect($dbserver, $dbuser, $$dbpass);
mysql_select_db($dbname, $db);
$sql = SELECT * FROM Canidate SORT BY 'LastName';
$result = mysql_query($sql);
?



-- 
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] Updating a record with math and division

2001-12-28 Thread Todd Williamsen

Ok

So to update a record lets say...

I have a current value of 150 and the new value will be 250 now how would I
total them to equal 400?

I was thinking

$sql = UPDATE $table value1 =  value1 + ?

is that correct?  how do you update it with simple math?

What about division...

take the current value in the database + the new value divided by another
number, lets say another field



-- 
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] Updating a record with math and division

2001-12-28 Thread Todd Williamsen

That isn't the answer I was looking for...

Since you are so sarcasmnice/sarcasm could you be so kind in point me
where these golden docs are?  I looked all over php.net and mysql.com,
nada not only that the three books I have as well.  I am a newbie at
this, and do need a bit of hand holding thanks...


Miles Thompson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...

 Read the docs for the database in question. They will tell you what is and
is not allowed.
 Miles Thompson

 On Friday 28 December 2001 06:26 pm, Todd Williamsen wrote:
  Ok
 
  So to update a record lets say...
 
  I have a current value of 150 and the new value will be 250 now how
would I
  total them to equal 400?
 
  I was thinking
 
  $sql = UPDATE $table value1 =  value1 + ?
 
  is that correct?  how do you update it with simple math?
 
  What about division...
 
  take the current value in the database + the new value divided by
another
  number, lets say another field



-- 
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] Updating a record with math and division

2001-12-28 Thread Todd Williamsen

Yes I got that much...

So it would be

UPDATE tblname SET value1 + $value1?
David Piasecki [EMAIL PROTECTED] wrote in message
000201c18ffd$a8187ec0$a6ccb0d8@pc5">news:000201c18ffd$a8187ec0$a6ccb0d8@pc5...
 You missed the first place you should have looked, the manual page on
 the 'UPDATE' syntax:
 http://www.mysql.com/doc/U/P/UPDATE.html



 -Original Message-
 From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
 Sent: Friday, December 28, 2001 4:06 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Updating a record with math and division

 That isn't the answer I was looking for...

 Since you are so sarcasmnice/sarcasm could you be so kind in point
 me
 where these golden docs are?  I looked all over php.net and mysql.com,
 nada not only that the three books I have as well.  I am a newbie at
 this, and do need a bit of hand holding thanks...


 Miles Thompson [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]...
 
  Read the docs for the database in question. They will tell you what is
 and
 is not allowed.
  Miles Thompson
 
  On Friday 28 December 2001 06:26 pm, Todd Williamsen wrote:
   Ok
  
   So to update a record lets say...
  
   I have a current value of 150 and the new value will be 250 now how
 would I
   total them to equal 400?
  
   I was thinking
  
   $sql = UPDATE $table value1 =  value1 + ?
  
   is that correct?  how do you update it with simple math?
  
   What about division...
  
   take the current value in the database + the new value divided by
 another
   number, lets say another field



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