[PHP-DB] Image Bank with php mysql!! ??!!

2001-07-30 Thread Koutsogiannopoulos Karolos

Hello everyone...   

I wan't your opinion regarding a program i am constructing. It is about an
image bank for graphic studios or anyone else who needs a program that can
insert his pictures or descriptions of it and be able to make a fast and
reliable search.
The Question is:

What would be best.? Inserting the pictures in the DB or in the file system
? Also notice that it is a reference db and not an actual bank. I mean that
there will be only photos of low quality and not the full picture which
could be very large.

Expecting your justified opinions that would be a lot of help..

Thanks

___
PGP KEY ID: 0xA86600E9
___




Re: [PHP-DB] Finding NoMatches in MySQL

2001-07-30 Thread Dobromir Velev

Hi,
I think this query should do the job

SELECT jobs.uid FROM jobs LEFT JOIN employers ON jobs.id1 = employers.uid
WHERE employers.uid is Null

Dobromir Velev


-Original Message-
From: Dave Watkinson [EMAIL PROTECTED]
To: PHP-MySQL List [EMAIL PROTECTED]
Date: Monday, July 30, 2001 12:56 AM
Subject: [PHP-DB] Finding NoMatches in MySQL


Hi all

During the process of importing a lot of Oracle data into MySQL, I have two
tables that are giving me a bit of a headache. One is a list of jobs and
the
other is a list of employers. There's now a unique id for each table, and
the job table also has a column called id1, which *should* correspond to
employers.uid.

With me so far?

Well, the problem is that there were loads of duplications in the employers
table, and after deleting the duplicates some of the jobs.id1 records now
point to non-existing records.

How do I do a query that does something like this...

select jobs.uid from jobs where jobs.id1 not in employers.uid

???

many thanks in advance!

Dave



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





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




RE: [PHP-DB] MySQL newbie: inserting new entry to table?

2001-07-30 Thread Howard Picken

I'm a learner too.

But as I understand it, You make a connection to the database (or open it?).
Once it's open or connected to, you can access the different tables within
it.

I think the difference between mysql_db_query  mysql_query is that
later assumes that
you all ready connected to the database where the first connects at the same
time.

Anyway glad you fixed your problem.  It wasn't a holiday in Australia (just
a Sunday night :-))

Cheers
Howard


-Original Message-
From: sg [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 29 July 2001 9:40 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL newbie: inserting new entry to table?


Thank You Howard!

You sure are quick!

I found a way to make it work. I used to have both scripts (the one that
displays and the one that inserts new entries) on the same page...
Once I separated them I had a link on a third page. I first clicked on the
insert entry link then back to the display page... My new entry was there...

Now for the solution you gave me. I haven't tried it yet but I'd like to
know the difference.
I see you don't provide the database name in the mysql_query call. How does
MySQL know what base to work with?
I've seen both 'mysql_query' and 'mysql_db_query' in several tutorials but
haven't yet figured the difference between them (told you a was a newbie...)

Thanks again for your interest, I thought everybody would be on holidays...

Sébastien



--
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] double mysql calls?

2001-07-30 Thread Photocon

Hello all...

Im having a bit of trouble with a mysql update feature. What I am doing is 
having a script email a list of people in a database (one email address per 
db record) and have the script update the database that it has sent an 
email to that particular person. Currently I have:

while ($Row = mysql_fetch_array ($Result)) {
 $UserID=$Row-user_id;
 if ($Row[EmailSent] == 0) {
 if ($Row[email]) {
 $Msg0 = Dear $Row[RealName] \n\n;
 $To = $Row[email];
 $TotalMsg = $Msg0$Msg1$Msg2$Msg3$Msg4$Msg5;
 if (mail($To, $Subject, $TotalMsg, $AddHeaders)) {
 ++$Good;
 $Query1= UPDATE $connectdb1 SET 
EmailSent=\1\ WHERE user_id=\$UserID\ LIMIT 1;
 mysql_query($Query1, $Link);
 } else {
 ++$Bad;
 }
 } else {
 ++$CountNoEmail;
 }
 } else {
 ++$CountAlreadySent;
 }
++$CountTotal;
}

What am I doing wrong? can I have multiple incarnations of mysql queries 
like this? How could I get a UserID out of a while statement for later 
updating? Thanks for any help.

--Photocon
Conrad Hunziker III
www.nightskyent.com


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




[PHP-DB] Re: Image Bank with php mysql!! ??!!

2001-07-30 Thread Hugh Bothwell


Koutsogiannopoulos Karolos [EMAIL PROTECTED] wrote in
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I wan't your opinion regarding a program i am constructing. It is about an
 image bank for graphic studios or anyone else who needs a program that can
 insert his pictures or descriptions of it and be able to make a fast and
 reliable search.

http://www.hotscripts.com/PHP/Scripts_and_Programs/Image_Galleries/more2.htm
l


 What would be best.? Inserting the pictures in the DB or in the file
system

I would keep the image name in the database; save the original image
in a dedicated directory with a numeric name like 4920185.jpg and
then the thumbnail either with a suffix (like 4920185b.jpg) or with the
same name in a thumbnails directory; store the number as the picture ID.

The numbers should be large and pseudorandom, ie you don't want
to make it easy for someone to write a script to leech all your
pictures (it'll still be possible, but harder).  Maybe use the database
ID to seed a random number generator, and use the Nth generated
number?

Have a text field for keywords, a text field for description,
a price field?, the author's name, email, and homepage.  If you put
the image directory below the web root directory, then the images
can only be accessed via a script, and you can restore the original
name at download (this solves the problem of name collisions).

If you're going to sell the pictures, you should allow a buyer more
than one download, in case they screw up or accidentally delete
it on their system; I would have a table for 'current purchases' with
a buyer ID and picture ID, and allow them something like access
for a week, up to 20 downloads of that image.

 ? Also notice that it is a reference db and not an actual bank. I mean
that
 there will be only photos of low quality and not the full picture which
 could be very large.

(shrug) as above, keep the images in the filesystem; then it
doesn't matter how large it is.



-- 
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: Storing last access

2001-07-30 Thread Hugh Bothwell


Olinux O [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,
 I would like to display messages that are entered into
 a database since the last time i checked it. [Much
 like web based email marks NEW messages.]

 What is the best way to do this? By adding an
 additional column to the Messages Table OR creating a
 new table with the field Table_Name and
 Last_Checked

Adding a field to the table is a single-user solution; if you
want this useable by more than one person, a second
table is needed.

There are two ways of going about this; if you want
to know whether individual messages are read or
not, you will have to keep individual user/message
records; if all you want is messages since a given
date, you can just add a 'last-read' timestamp to your
users table.



-- 
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] A Join Question

2001-07-30 Thread Steve Fitzgerald

I'm trying to create a join statement that pulls out a CompanyName based
on a given CompanyID that is tied to a specified ContactID.

For example, if ContactID=1 then the corresponding CompanyName might be
Smith, Inc. depending on what was entered.

Here are the tables.

table = Contacts

FIELD | TYPE | ATTRIBUTES | NULL | DEFAULT | EXTRA |


ContactID | INT(4) | UNSIGNEED | NO | AUTO_INCREMENT |  Primary
Key/Unique
CompanyID | INT(4) |


// more fields



table = Company

FIELD | TYPE | ATTRIBUTES | NULL | DEFAULT  | EXTRA |

CompanyID | INT(4) | UNSIGNEED | NO  | AUTO_INCREMENT |  Primary
Key/Unique
CompanyName | INT(4) |

//more fields

-

What I have tried so far is:

SELECT * FROM contacts,company WHERE contacts.CompanyID=$ContactID and
companyID= $ContactID

I've tried slightly other variations including:

SELECT CompanyName,WebSite
FROM $table_name1,$table_name2
WHERE contacts.CompanyID='$CompanyID'


also,

SELECT *
FROM Contacts,Company
WHERE
Contacts.CompanyID=Company.CompanyID AND
Contacts.CompanyID='$ContactID'

With this I get an empty set.


None of these seem to work. I'm obviously not doing the join right, but
I'm not sure what I'm leaving out.

Thanks.

Steve




-- 
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: Query displays one

2001-07-30 Thread Hugh Bothwell


Mike Gifford [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 The problem is that I am only getting one response from this query rather
than
 5.  I can't figure this out.  What did I do to only get one response?

Try removing the ORDER BY and LIMIT and run the query by
hand - how many responses do you get?  The search may only
return one article.




-- 
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: A Join Question

2001-07-30 Thread Hugh Bothwell


Steve Fitzgerald [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm trying to create a join statement that pulls out a CompanyName based
 on a given CompanyID that is tied to a specified ContactID.

 For example, if ContactID=1 then the corresponding CompanyName might be
 Smith, Inc. depending on what was entered.

SELECT
CompanyName
FROM
Company
INNER JOIN
Contacts
ON
Company.CompanyID = Contacts.CompanyID
WHERE
ContactID=$ContactID



-- 
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] ODBC and PHP

2001-07-30 Thread Andrew Hill

Ariadne,

What is the exact error you get?
Among other debugging tricks, you can get an ODBC trace from the ODBC
Administrator control panel (if using Win32 on client side) and look at
where the API calls are failing.

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software  http://www.openlinksw.com
Universal Data Access  Data Integration Technology Providers

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Friday, July 27, 2001 6:30 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] ODBC and PHP



 I´m using PHP 4 with ODBC and sometimes I get a response that was unable
 to connect to the MSSQL database. Then I go to the ODBC configuration to
 test the connection and I get a response that everything is working fine,
 but my pages still can´t connect. Is that normal? What can I do?

 I´m using NT Server 4 with apache 1.3.

 []s

 Ariadne




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




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




Re: [PHP-DB] Re: Image Bank with php mysql!! ??!!

2001-07-30 Thread tony . mccrory


To take it a step further, I would suggest creating a php script
downloadimage.php as follows:

?php
//downloadimage.php
//some code to verify requested download against customers details,
remembering not to send any output to the browser (would upset the header()
function)
//
header(Content-type: image/jpeg);
$image_name=urldecode($requiredimage);
header( Content-Description: JPEG Image from Freds Library ($image_name)
);
header( Content-Disposition: attachment; filename=$image_name );
$the_image=/imagelibrary/highresolution/$image_name;
readfile($the_image);
?


Then link to that with
a href=downloadimage.php?imagename=10293492.jpgcustomerid=11217Download
Image/a


Make sure the images are outside of your webservers document root.  Then
you can programatically decide whether to serve the image to the user.
Removes the possibility of leeching the entire library..

Tony

--
Tony McCrory
IT, Trinity Mirror group (Ireland)
(028) 9068 0168
[EMAIL PROTECTED]


   

Hugh Bothwell

hugh_bothwell@hoTo: [EMAIL PROTECTED]  

tmail.com   cc:   

 Subject: [PHP-DB] Re: Image Bank with 
php  mysql!! ??!!  
07/30/2001 02:14   

PM 

   

   






Koutsogiannopoulos Karolos [EMAIL PROTECTED] wrote in
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I wan't your opinion regarding a program i am constructing. It is about
an
 image bank for graphic studios or anyone else who needs a program that
can
 insert his pictures or descriptions of it and be able to make a fast and
 reliable search.

http://www.hotscripts.com/PHP/Scripts_and_Programs/Image_Galleries/more2.htm

l


 What would be best.? Inserting the pictures in the DB or in the file
system

I would keep the image name in the database; save the original image
in a dedicated directory with a numeric name like 4920185.jpg and
then the thumbnail either with a suffix (like 4920185b.jpg) or with the
same name in a thumbnails directory; store the number as the picture ID.

The numbers should be large and pseudorandom, ie you don't want
to make it easy for someone to write a script to leech all your
pictures (it'll still be possible, but harder).  Maybe use the database
ID to seed a random number generator, and use the Nth generated
number?

Have a text field for keywords, a text field for description,
a price field?, the author's name, email, and homepage.  If you put
the image directory below the web root directory, then the images
can only be accessed via a script, and you can restore the original
name at download (this solves the problem of name collisions).

If you're going to sell the pictures, you should allow a buyer more
than one download, in case they screw up or accidentally delete
it on their system; I would have a table for 'current purchases' with
a buyer ID and picture ID, and allow them something like access
for a week, up to 20 downloads of that image.

 ? Also notice that it is a reference db and not an actual bank. I mean
that
 there will be only photos of low quality and not the full picture which
 could be very large.

(shrug) as above, keep the images in the filesystem; then it
doesn't matter how large it is.



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




IMPORTANT NOTICE  The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended
to be relied upon by any person without subsequent written confirmation of
its contents.  Furthermore, the content of this e-mail is the personal view
of the sender and does not represent the advice, views or opinion of our
company.  Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation.  In particular (but
not by way of limitation) our company disclaims all responsibility and
accepts no 

[PHP-DB] RE: Tree Display

2001-07-30 Thread Mikusch, Rita

Have your table set up with the following two fields (among others!):

-Category
-Parent

Result1 parent = 0 (it has no parent). Item1 parent is Result1 (ie the
parent field of item1 is result1's unique identifier). Item2 parent is
Result1. Result2 parent = 0. Result2's children have Result2 as
their parent.

Now you have to write the PHP code so that the corrent items are display. If
no results are clicked then display all results in a column. 

Result1's URL would be something like samepage.php3?result=result1. Have
PHP code that checks if you have a value for Result then displays that
result's items . . . and if you have a value for result1 and item1
then display the items for result1 and the content for item1. 

I use a tree display for website menus and submenus. And I've created an
entire administrative interface that makes it really easy to move sections
of the trees around. It makes it really easy when people come to me at the
last minute and want me to rearrange some part of the main menu, or add a
whole section.

You should be able to use this from other tree structures like product
lists, etc etc.

Hope this makes sense . . . 

Rita.

-Original Message-
From: Sharif Islam [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 27, 2001 2:13 PM
To: [EMAIL PROTECTED]
Subject: Tree Display



I am still trying to figure out how to do it. I want to display my result
from the data base in tree/menu like system.

So the result page will look like this:


  +Result1 (you click this , it will expand)
  -Item1 (you click this and get more info)
  -Item2
  -Item3

  +Result2
  -Item1
  -Item2


All the records will be pulled from the same table.

Any hint?




-- 
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] new lines in text field

2001-07-30 Thread Kenn Murrah

Greetings.

I'm trying to concatenate several values entered in my form, then write them
to a TEXT field in my mySQL database.  All is well, except that I want to
each value to appear on a different line.  I've tried \n and that didn't
work.  What am I doing wrong?

Thanks in advance for the help.

Kenn


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




[PHP-DB] PHP on Linux and MS SQL

2001-07-30 Thread Adam Oliver

Anybody know of a good installation description for connection PHP on linux
to MS SQL on a 2000 machine?  I've been through about 3 so far and none of
them have worked.

Adam



-- 
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: Query displays one

2001-07-30 Thread Mike Gifford

Hi Hugh,

Hugh Bothwell wrote:

 Mike Gifford [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
The problem is that I am only getting one response from this query rather

 than
 
5.  I can't figure this out.  What did I do to only get one response?
 Try removing the ORDER BY and LIMIT and run the query by
 hand - how many responses do you get?  The search may only
 return one article.


I tried removing these and I got a similarly disappoinging response (one reply), 
so I decided to look again for code that is actually working and copy it from 
scratch.  I hit upon this and it is working now.

Thanks for your help.


function latest_articles() {
global $id,$main_file,$front_end_url,$alt, $articlestable, $categorytable;
$alt_var=;
$contentquery4 = mysql_query(SELECT a.*,s.URLname FROM $articlestable 
a, 
$categorytable s WHERE a.articleSectionID = s.articleSectionID ORDER BY a.date 
DESC) or mysql_die();
if ($result = mysql_num_rows($contentquery4)) {
while ($contentarray4 = mysql_fetch_array($contentquery4)) {
$category = $contentarray4[URLname];
if ($alt) {
if ($contentarray4[alt_title]) {
$link_name = 
$contentarray4[alt_title];
$alt_var = ?alt=french;
} else {
$link_name = $contentarray4[title];
$alt_var = ?alt=french;
}
} else {
$link_name = $contentarray4[title];
$alt_var = ;
}
$content .= \nlia 
href=\.$front_end_url./.$main_file./.urlencode($category)./.$contentarray4[articleID]./
 
. $alt_var .\  class=\articleslink\.stripslashes($link_name)./a;
$i++;
if ($i==5) {
break;
}
}
}
return $content;
}

-- 
Mike Gifford, OpenConcept Consulting, http://openconcept.ca
Offering everything your organization needs for an effective web site.
Abolish Nuclear Weapons Now!: http://pgs.ca/petition/
It is a miracle that curiosity survives formal education. - A Einstein


-- 
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: new lines in text field

2001-07-30 Thread Hugh Bothwell


Kenn Murrah [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm trying to concatenate several values entered in my form, then write
them
 to a TEXT field in my mySQL database.  All is well, except that I want to
 each value to appear on a different line.  I've tried \n and that didn't
 work.  What am I doing wrong?

You skipped a step here, between write it to my database and
appear on a different line.

I assume that you insert to the database, then pull it out and
display it as HTML.  '\n' doesn't cause a line-break in HTML.

You can either use br instead of \n before putting it in
the database (less portable), or look at the nl2br() function
(I would prefer this option, personally).




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

2001-07-30 Thread Jonathan Hilgeman

try just changing mysql_fetch_array to mysql_fetch_assoc

Bryan [EMAIL PROTECTED] wrote in message
006801c1192c$649f6e30$272478cc@bryanspc">news:006801c1192c$649f6e30$272478cc@bryanspc...
 mysql_fetch_array places 2 records for each one returned (example)

 Array
 (
 [0] = 56
 [location_id] = 56
 )

 Is there any way to delimate that and have the key present only once?
 here is my code :

 /*
  *
  *
  *  Start code
  *
  *
  */

 while ($aRow = mysql_fetch_array($sResult) ) {
 print_r($aRow);


 foreach ($aRow as $key = $sValue) {

 $sData[$key] = SELECT * FROM location WHERE region='$sValue' AND region
 !='yes';
 $sDataResult[$key] = mysql_query($sData[$key], $sDbcnx) or
 die(mysql_error());

 /* print Main heading linking to no where */

 print OPTION VALUE=\#\.$sValue./OPTION;


 while($aData[$key] = mysql_fetch_array($sDataResult[$key]) ) {

 /* grab the data from the main heading and print all the info for that
 record */

 print
 OPTIONVALUE=\indexes/index.php?iLoc_id=.trim($aData[$key]['location_
 id']).\nbsp;nbsp;nbsp;.trim($aData[$key]['location'])./OPTION\
 n;

 } /* end while */


 } /* end foreach */

 } /* end main while */

 /*
  *
  *
  * End Code
  *
  *
  */




-- 
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] INSERT with a JOIN

2001-07-30 Thread Steve Fitzgerald

I'm trying to create an INSERT statement that will change a field in one
table based upon the id defined in another table.

Here is what I tried:

$sql1 = INSERT INTO $table_name1 (FirstName,LastName,WorkPhone,
HomePhone,EmailName,Birthday)
VALUES
('[$FirstName]','[$LastName]','[$WorkPhone]','[$HomePhone]','[$EmailName]','
[Birthday]')
;


$sql2 = INSERT INTO $table_name2 (CompanyName,WebSite)
VALUES
('[$CompanyName]','[$WebSite]')

WHERE contacts ON company.CompanyID =
contacts.CompanyID WHERE ContactID='$ContactID'
;

 $result_1 = @mysql_query($sql1,$connection) or die(Couldn't execute
query.);
 $result_2 = @mysql_query($sql2,$connection) or die(Couldn't execute
query.);
 ?

The goal is based upon a unique field call ContactID I want to be able to
update the CompanyName associated with the ContactID.

For example: ContactID=1 might have an associated CompanyName= Smith, Inc.
What I want to do is UPDATE/INSERT a new CompanyName and have that reflected
by changing the CompanyID associated with the ContactID.





-- 
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] Application dev w/ PHP MySql

2001-07-30 Thread Robert Barish

Hello
I am having to learn php and mysql, at the sametime and with a time 
constraint.  So I am hoping I can have a lending hand from all the coding 
gurus out there.   Let my give you a little back ground.  I the owner of an 
ISP tech support outsourcing company and am trying to develop a call note 
system where the techs input to mysql notes on the call the teched and then 
have our clients (isps) use and authenicated site to do a search view the 
browser on a particuliar user's call note history.   At the present time I am 
working on the Insertion part of the php script.  I have created a data base 
in mysql and have been able to populate the data base.When the tech hits 
the submit button and the data is inserted into the customer table, with 
cust_key, tech_key, cust_fname, cust_lname, cust_username, cust_timestamp 
columns and into table issues with issue_key, issue_type, issue_entry, 
issue_date columns.  I have this part working great.  

There is one more table in need to populate when the tech submits a call note 
and this is labled cust_issue_association.  The cust_issue_association table 
has the following columns cust_key and issue_key.  This table is being use to 
tie in the tables for a search.   My problem is I have no idea on how to 
populate this table.   When a call note is submitted into the customer table 
the cust_key is auto_incremented and in the issues table the issue_key is 
auto incremented.   So the million dollar question that is  driving me crazy 
with is how do I get these two keys to be inserted into 
cust_issue_association table when the call note is submitted. I have 
attached what I have done so far (please excuse the readabiltiy and basicness 
of the code this is my first time doing this)   

I hope I have described this clearly enough.   Of course, I will give created 
in the code  and on the appropriate html page, where create is do for the 
people who help me.  

Thank you ahead of time for all your inputs. 

Bob


-- 
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] INSERTING DATA into a MySQL DB

2001-07-30 Thread Christopher Trewin

Hi All,

I am having a problem with Inserting Data from a generated form.
To explain this clearly the code is listed below. There are three pages and 
a
table in the db.

When the sql statement is run, it ends at the INSERT clause.

Any help would be appreciated ...

---
TABLE
---
# phpMyAdmin MySQL-Dump
# version 2.2.0rc3
# http://phpwizard.net/phpMyAdmin/
# http://phpmyadmin.sourceforge.net/ (download page)
#
# Host: ww2
# Generation Time: July 31, 2001, 9:39 am
# Server version: 3.23.25
# PHP Version: 4.0.2
# Database : test
# 

#
# Table structure for table 'server'
#

CREATE TABLE server (
  server_type varchar(4) NOT NULL default '0',
  server_name varchar(10) NOT NULL default '0',
  server_intip varchar(15) NOT NULL default '0',
  server_intport int(5) NOT NULL default '0',
  server_protocol char(3) NOT NULL default '   '
) TYPE=MyISAM;

---
Page One
---

HTMLHEADTITLESelect the Number of Onsite Servers you need: Step 
1/TITLE/HEAD
BODY
FORM method=POST action=create.servers.php3
PPlease Enter the Number of Onsite Servers your school needs./P
PNumber of Servers:   INPUT type=text name=num_servers size=5/p
INPUT type=submit value=Display Servers
/FORM/BODY/HTML

---
Page Two
---

HTML
HEADTITLECreate a Database Table: Step 2/TITLE/HEAD
BODY
FORM method=POST action=create.servers.process.php
table cellspacing=5 cellpadding=5
tr
thServer Type/th
thServer Name/th
thInternal Server IP/th
thInternal Server Port/th
thUDP/TCP/th
/tr

?
for ($i = 0 ; $i $num_servers; $i++) {

echo 
tr
td align=center
select name=\server_type[]\
option value=\float\web/option
option value=\float\mail/option
option value=\float\other/option
/select
/td

td align=center
input type=\text\ name=\server_name[]\ size=\20\
/td

td align=center
input type=\text\ name=\iserver_intip[]\ size=\20\
/td

td align=center
input type=\text\ name=\server_intport[]\ size=\5\
/td

td align=center
select name=\server_protocol[]\
option value=\float\TCP/option
option value=\float\UDP/option
/select
/td
/tr;
}

?

trtd align=center colspan=3INPUT type=submit value=Create 
Table/td/tr

/table
/FORM
/BODY
/HTML

---
Page Three
---

HTML
HEAD
TITLEInserting Data/TITLE/HEAD
BODY

h1Inserting Data/h1

?

$sql = INSERT INTO SERVER VALUES (; for ($i = 0; $i  
count($server_type); $i++) {
  $sql .= $server_type[$i] $server_name[$i] $server_intip[$i] 
$server_intport[$i];
if ($server_protocol[$i] != ) {
  $sql .=  ($server_protocol[$i]),;
} else {
  $sql .= ,;
}
}
$sql = substr($sql, 0, -1);
$sql .= );

$connection = mysql_connect(localhost,username,password)
or die(Couldn't connect to server.);

$db = mysql_select_db(test, $connection)
or die(Couldn't select database.);

$sql_result = mysql_query($sql,$connection)
or die(Couldn't execute query.);

if (!$sql_result) {
echo PCouldn't insert data!;
} else {
echo Pdata inserted!;
}
?
/BODY
/HTML

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
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] INSERTING DATA into a MySQL DB

2001-07-30 Thread Christopher Trewin

My last post may have been a little unclear,
I have attached the pages.

Thanks ...


From: Christopher Trewin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] INSERTING DATA into a MySQL DB
Date: Tue, 31 Jul 2001 09:48:23 +1000

Hi All,

I am having a problem with Inserting Data from a generated form.
To explain this clearly the code is listed below. There are three pages and
a
table in the db.

When the sql statement is run, it ends at the INSERT clause.

Any help would be appreciated ...



_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


# phpMyAdmin MySQL-Dump
# version 2.2.0rc3
# http://phpwizard.net/phpMyAdmin/
# http://phpmyadmin.sourceforge.net/ (download page)
#
# Host: ww2
# Generation Time: July 31, 2001, 9:39 am
# Server version: 3.23.25
# PHP Version: 4.0.2
# Database : test
# 

#
# Table structure for table 'server'
#

CREATE TABLE server (
  server_type varchar(4) NOT NULL default '0',
  server_name varchar(10) NOT NULL default '0',
  server_intip varchar(15) NOT NULL default '0',
  server_intport int(5) NOT NULL default '0',
  server_protocol char(3) NOT NULL default '   '
) TYPE=MyISAM;





-- 
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] Can't connect to MS SQL

2001-07-30 Thread Adam Oliver

I have PHP running on Apache for win32.  The mssql module is enabled.  I am
trying to connect to a database with the following code.

?php
$hostname = 192.168.1.1:1433;
$username = test;
$password = smiley;
$dbName = meyedev;
$dbc = mssql_connect($hostname,$username,$password) or DIE(DATABASE FAILED
TO RESPOND.);
mssql_select_db($dbName) or DIE(Table unavailable);
mssql_close($dbName);
?

However I get the following error.

Warning: MS SQL: Unable to connect to server: 192.168.1.1:1433 in c:\program
files\apache group\apache\htdocs\meyedev\connect.php4 on line 11
DATABASE FAILED TO RESPOND.

What am I doing wrong?

Adam



-- 
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] Linux, Oracle 8.1.5, configure: libclntsh.so: Don't use llseek; slpmprodstab undefined

2001-07-30 Thread Rick Hickerson

I'm at wit's end.

.../php-4.0.6/configure gives an error, and debug.log says libclntsh.so:  don't
use llseek, use lseek64, and slpmprodstab is undefined.

I've looked everywhere.  All of php.org.  All of this newsgroup.  The linux
forum at Oracle TechNet.

The one lead I found was a reference to an Oracle note 68151.1, which apparently
no longer exists on their site.

I see a gensyslib in $ORACLE_HOME/bin which apparently creates
$ORACLE_HOME/lib/sysliblist.  This latter contains one line: -ldl -lm
-lpthread.

I note that -plthread isn't in the command line producing the error in
debug.log.  Should it be?  How do I get it there?

TIA for any advice.  (I'm not a C programmer, just a DBA trying to get something
working)  My debug.log is below.

Rick
-- 
Rick HickersonT(978)659-4901  _\|/_ Agilent Technologies
IT Consulting Engineer (646)452-7668   /|\  Innovating the HP Way
3000 Minuteman Rd, MS 596  (877)868-9829
Andover, MA  01810IT | Information Technology

CONFIGURE:   './configure' '--with-mysql' '--with-apxs' '--with-pgsql'
'--with-oci8' '--prefix=/usr'
CC: gcc
CFLAGS: -g -O2
CPPFLAGS:-DLINUX=22 -DUSE_HSREGEX -DUSE_EXPAT -DNO_DL_NEEDED -DSUPPORT_UTF8
CXX:
CXXFLAGS:   
INCLUDES:-I/opt/php/php-4.0.6/@includedir@  -I$(top_builddir)/Zend
-I/opt/php/php-4.0.6/ext/mysql/libmysql
-I/opt/oracle/app/oracle/product/8.1.5/rdbms/demo
-I/opt/oracle/app/oracle/product/8.1.5/network/public
-I/opt/oracle/app/oracle/product/8.1.5/plsql/public
LDFLAGS: -Wl,-rpath,/opt/oracle/app/oracle/product/8.1.5/lib
-L/opt/oracle/app/oracle/product/8.1.5/lib -Wl,-rpath,/usr/lib/pgsql
-L/usr/lib/pgsql
LIBS:   -lpq -lm -ldl -lcrypt -lresolv -lm -ldl -lnsl  -lresolv -lclntsh
DLIBS:  
SAPI:   apache
PHP_RPATHS:  /opt/oracle/app/oracle/product/8.1.5/lib /usr/lib/pgsql
uname -a:   Linux tackroom.and.agilent.com 2.4.3-20mdk #1 Sun Apr 15 23:03:10
CEST 2001 i686 unknown

gcc -o conftest -g -O2  -DLINUX=22 -DUSE_HSREGEX -DUSE_EXPAT -DNO_DL_NEEDED
-DSUPPORT_UTF8  -Wl,-rpath,/opt/oracle/app/oracle/product/8.1.5/lib
-L/opt/oracle/app/oracle/product/8.1.5/lib -Wl,-rpath,/usr/lib/pgsql
-L/usr/lib/pgsql conftest.c -lpq -lm -ldl -lcrypt -lresolv -lm -ldl -lnsl 
-lresolv -lclntsh 15
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/../../../libclntsh.so: the
`llseek' function may be dangerous; use `lseek64' instead.
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/../../../libclntsh.so: undefined
reference to `slpmprodstab'collect2: ld returned 1 exit status

-- 
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] Can I UPDATE 2 tables with 1 SQL statement?

2001-07-30 Thread Mark Gordon

Heres what I'm trying to do:

$data=addslashes(fread(fopen($form_data, rb), filesize($form_data)));

//some lines of code edited out 

$result = mysql_query (
UPDATE bands, binary_data 
SET genreid='$genre', bandname='$name', bandesc='$description',
bandurl='$url', bandemail='$email', bin_data='$data',
filename='$form_data_name', filesize= '$form_data_size',
filetype='$form_data_type'
WHERE bandname='$name' AND bands.bin_id=binary_data.bin_id
);

Thanks all you smart people.

=
Mark
[EMAIL PROTECTED]

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: [PHP-DB] Can't connect to MS SQL

2001-07-30 Thread Frank M. Kromann

Hi Adam,

Host name should not include the port number. If you need to use a non standard port 
number you should create a client configuration (using client network utility) and 
then use the name of the configuration as the host name.

- Frank

 I have PHP running on Apache for win32.  The mssql module is enabled.  I am
 trying to connect to a database with the following code.
 
 ?php
 $hostname = 192.168.1.1:1433;
 $username = test;
 $password = smiley;
 $dbName = meyedev;
 $dbc = mssql_connect($hostname,$username,$password) or DIE(DATABASE FAILED
 TO RESPOND.);
 mssql_select_db($dbName) or DIE(Table unavailable);
 mssql_close($dbName);
 ?
 
 However I get the following error.
 
 Warning: MS SQL: Unable to connect to server: 192.168.1.1:1433 in c:\program
 files\apache group\apache\htdocs\meyedev\connect.php4 on line 11
 DATABASE FAILED TO RESPOND.
 
 What am I doing wrong?
 
 Adam
 
 
 
 -- 
 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]