RE: [PHP] More newbie help - mixing 2 different things into one database

2002-03-21 Thread Laurie Landry

Oh... maybe I should take a "How to send a full and complete email"
newbie class instead? :)

Here's the code:

Add a Link to the Links Database

$subjects";
}

// create SQL statement
$country_sql = "SELECT countries FROM countries
ORDER BY countries ASC";

// execute SQL query and get result
$country_result = mysql_query($country_sql,$connection)
or die("Couldn't execute query.");

// put data into drop-down list box
while ($row2 = mysql_fetch_array($country_result)) {

$countries  = $row2["countries"];
$option_block2 .= "$countries";
}
function
show_form($organization="",$description="",$url="",$subject1="",$subject
2="",$geographic="") { ?>

  
 
   *Organization:
   



 
   *Description:




 
   URL:
   



 
   *Subject
1:
   

  
  - Select Subject -
  



 
   Subject 2:
   

  
  

  

 
   Geographic Region:
  

  
  
  
  - Countries -
  



 
   


  

  





   
   
  
  Added to Links Database:
  
   
linkID:
 
  

  
   
Organization:
 
  

  
   
Description:
 
  

  
   
URL:
 
  

  
   
Subject 1:
 
  

  
   
Subject 2:
 
  

  
   
Geographic Region:
 
  

  
   
Modify 
  This Record | Delete 
  This Record
  




Add another Link | Modify 
a Link Record | Delete a Link
Record
View all Links Records | Return 
to Admin Menu | Go to Website



> > Hi,
> > 
> > In this example: I'm trying to introduce the selection data from 
> > another table in the database into this form.  The form is a simple 
> > form where if missing any data, you're redirected back to 
> the page to 
> > form but with data filled in some areas that you had filled 
> in before.
> > 
> > Now, instead of manually inputting the selection fields for 
> subjects 
> > and countries which will continually be updated, I've included a 
> > database where in another form, if there's a new subject to 
> be added 
> > to the database, the user will go to a different form and 
> fill in the 
> > new subject. That works.
> > 
> > Now, I'm trying to call in those data and put it into the selection 
> > option blocks - it doesn't' work, and I don't know why? 
> I've created a 
> > test page that calls in those option blocks on its own, and 
> it works, 
> > and the form with the manually-inputted subject titles or country 
> > titles works on its own as well. Somehow the two doesn't 
> mix well, and 
> > I'd appreciate help in this matter.


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




[PHP] Fetching 1 array from either one of 2 possible columns?

2002-03-21 Thread Laurie Landry

I'm working on a query by selection type of form, where if a user
selects a subject to get information. Each database entry will have 2
subject fields, Subject 1 being the main subject and Subject 2 being the
cross-subject. A table is set up like this:

+--+--+--+--+--+-+
| ID   | Organization | URL  | SUBJECT1 | SUBJECT2 | Geographic  |
+--+--+--+--+--+-+
|  1   | Acme | www  |  Math|  English | Canada  |
|  2   | Loony Toons  | www  |  Comedy  |  Math| Brazil  |

...


The idea is that the query will check the database to see if $Subject
has a match in either Subject1 or Subject2. the geographic is an
optional selection. If I select Math as a subject, and left the
Geographic option unselected, I want it to go into either Subject1 and
Subject2 to find Math. In this case both records would be a hit.

Below is my query setup and formatting:
***
$sql = "SELECT * FROM links WHERE SUBJECT1='$subject' OR
SUBJECT2='$subject' AND GEOGRAPHIC='$geographic'
 ORDER BY ORGANIZATION ASC";

$sql_result = mysql_query($sql);
if (!$sql_result) {
   echo "Can't execute $sql " . mysql_error();
   exit;
}

// organizes data in an orderly manner (ie bulleted area)
while ($row = mysql_fetch_array($sql_result)) {

$esc_organization = $row["ORGANIZATION"];
$esc_desc = $row["DESCRIPTION"];
$esc_url = $row["URL"];
$esc_subject = $row["SUBJECT1"];
$esc_geographic = $row["GEOGRAPHIC"];

$organization = stripslashes($esc_organization);
$description = stripslashes($esc_desc);
$url = stripslashes($esc_url);
$subject = stripslashes($esc_subject);
$geographic = stripslashes($esc_geographic);

$option_block .= "

http://$url\";>$organization
$description
URL: http://$url\";>$url\n";
}

Now, of course, if I were to use this, it will only use the Subject1
data. How do I tell it to use the results from either Subject 1 or
Subject 2?

Thanks in advance,

Laurie M. Landry



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




[PHP] More newbie help - mixing 2 different things into one database

2002-03-21 Thread Laurie Landry

Hi,

In this example: I'm trying to introduce the selection data from another
table in the database into this form.  The form is a simple form where
if missing any data, you're redirected back to the page to form but with
data filled in some areas that you had filled in before.

Now, instead of manually inputting the selection fields for subjects and
countries which will continually be updated, I've included a database
where in another form, if there's a new subject to be added to the
database, the user will go to a different form and fill in the new
subject. That works.

Now, I'm trying to call in those data and put it into the selection
option blocks - it doesn't' work, and I don't know why? I've created a
test page that calls in those option blocks on its own, and it works,
and the form with the manually-inputted subject titles or country titles
works on its own as well. Somehow the two doesn't mix well, and I'd
appreciate help in this matter.

Thanks in advance,

Laurie M. Landry
http://www.lmlweb.com



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




[PHP] Links as a query point instead of form drop down box

2001-05-16 Thread Laurie Landry

I understand how to use a dropdown box to make your selection in which that
selection is the criteria to display a database content; but I was wondering
how I can achieve a query by link.

For example, if you went to index.html file where there is a php coding that
generates the categories available (arrays) and outputs:

Apples
Oranges
Bananas

If you click on apples, it will send a query to the database to show all
listings under the category "apples". (SELECT category FROM FRUITS WHERE
category=apples)

how would I add the query criteria to the link? and how would I set up
showdata to take the information from the selected link?

thanks in advance,

Laurie M. Landry
 Design & Development

www.lmlweb.com
[EMAIL PROTECTED]

T: (604) 872-6915
F: (425) 732-1547


-- 
PHP General 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] MySQL Query not working?

2001-05-14 Thread Laurie Landry

Hi, I've got this sql setup where

$sql = "UPDATE CLASS_ADS
SET client_id = \"$client_id\", date = \"$date\", category = \"$category\",
title = \"$title\", description = \"$description\", contact_name =
\"$contact_name\",  contact_number = \"$contact_number\", email =
\"$email\",  url = \"$url\", WHERE client_id = \"$client_id\" ";

and of course the following:

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

which when I test the page, it tells me it couldn't execute the query.

I hope the information above is enough for someone to help me pinpoint where
I went wrong.

(all the fields in the named table in the database is set accordingly with
one thing: the client id number is autogenerated by the database, so I'm not
sure if the client_id should be there.)

Thanks in advance:

Laurie M. Landry
 Design & Development

www.lmlweb.com
[EMAIL PROTECTED]

T: (604) 872-6915
F: (425) 732-1547


-- 
PHP General 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] PHP Editor

2001-05-12 Thread Laurie Landry

I like using Homesite - color coordination of code as well. I use
Dreamweaver for the design elements as well, but sometimes it doesn't work
very well for php coding.

Laurie M. Landry
 Design & Development

www.lmlweb.com
[EMAIL PROTECTED]

T: (604) 872-6915
F: (425) 732-1547

> -Original Message-
> From: Dave Mateer [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 11, 2001 2:36 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] PHP Editor
>
>
> I'm using ColdFusion Studio which makes life very easy - good colour
> co-ordination of the code, and only takes 1 button the do an FTP upload up
> to the web-server (I'm using a Windows box to do editing, then a Linux box
> as webserver).
>
> We've been using Dreamweaver as well to bring the design elements
> together...works well, when you're doing the html stuff.  For
> pure coding, I
> recommend ColdFusion Studio.  ahhh it costs money though.
>
> Textpad (from textpad.com) is good...can d/load an evaluation copy (fully
> functional, and doesn't time out)..
>
> Hope this help
>
> David.
>
>
>
> "Daniel" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi,
> >
> > Just wondering whether you guys use any type of editor when
> programming in
> > PHP? if so what have you found to be useful?
> >
> >
> > Thanks
> >
> >
> > Daniel
> >
> >
> > --
> > PHP General 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 General 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]