[PHP-DB] time slots and PHP/MySQL

2002-08-21 Thread Matthew Crouch

this is a big question and i'm not trying to get you to do my modelling 
for me, but if anyone has experience with this i'd appreciate being 
pointed in the right direction:
How could one efficiently manage time slots in a dB? I mean for example 
telling the dB that Mike can be somewhere at 6:15 or 6:30 but not 6:45, 
and that Cynthia can be there at 6:15 or 7:00...
...and so on
my instinct is to create a "timeslots" table, but it looks like it would 
contain 35,040 records (one for each 15-minute period in the year). 
egad! The alternative is to create timeslots a month at a time or 
something, but the table would have to be reformulated every month.

any thoughts? feel free to get philosophical about it.

-M


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




[PHP-DB] Re: MySQL query from multiple tables

2002-07-04 Thread Matthew Crouch

it sounds like you may be serializing your SQL, in which case the following link might
help.
http://www.ashleyit.com/rs/jsrs/select/php/select.php


Matthew Nock wrote:

> Hi All,
>
> I have a strange query which I need to build - I have looked at the JOIN and
> aliasing functions of mySQL but not sure if I can achieve want I want to do.
>
> I have two tables (product_head, and product_features) (in addition to a
> number of other tables) which form the list of products I have available,
> and the features available with each product.
>
> I want to be able to retrieve from product_head the rows which are for a
> specific product category (ie: 1)..  this bit is easy.
>
> SELECT * from product_head where prod_cat_ID = 1;
>
> This query could return 1 or more rows - works great.
>
> but I also want to retrieve records from the product_features table.
> information stored in this table is:
>
> prod_ID feat_ID feat_value
>
> so for each product ID, there could be any number of features.  I need to
> retrieve only certain feat_value records, for specific products, where the
> feat_ID equals certain values .
>
> can I build a single query that will return all these results similar to
> below?
>
> Prod_ID Prod_name   Feat_1_valueFeat_2_valuefeat_3_value
> 1   prod1   34  25  15
> 2   prod2   10  15  15
> ...
>
> does this all make sense?


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




[PHP-DB] brand new elementary question

2002-06-24 Thread Matthew Crouch

got my other one sorted out; thanks everyone.
now:
how do i get it so when you hit "enter" on the keyboard it's the same as
hitting the "submit" button with the mouse? When I hit enter, it clears
my form and reloads the current page.


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




[PHP-DB] got it, thanks

2002-06-24 Thread Matthew Crouch



Seth Yount wrote:

> in you print statement you have ?lastname=%s, shouldn't that be '$s'
> denoting a variable being passed?  Try that out.
>
> gl -- Seth
>
> Matthew Crouch wrote:
>
> > this bit from my index page is giving me 2 headaches:
> > 1. it isn't passing anything into the URL
> > 2. the page that gets called ("name.php") sits and tries to load
> > forever. it looks like it's even filling up my hard drive with data (?!)
> >
> > Note: it does this (#2) even if I type in the URL with a variable and
> > value, like "name.php?lastname=smith"
> >
> >  > printf ("",
> > $lastname);
> > ?>
> > 
> >   
> >   
> > 
> >   
> > 
> >


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




[PHP-DB] what the heck? update

2002-06-24 Thread Matthew Crouch


I changed method to GET and the value of $lastname seems to be getting
passed but so is $submit, with the value "Search for Last Name" as you might
expect. Probably this ain't the answer

Matthew Crouch wrote:

> this bit from my index page is giving me 2 headaches:
> 1. it isn't passing anything into the URL
> 2. the page that gets called ("name.php") sits and tries to load
> forever. it looks like it's even filling up my hard drive with data (?!)
>
> Note: it does this (#2) even if I type in the URL with a variable and
> value, like "name.php?lastname=smith"
>
>  printf ("",
> $lastname);
> ?>
> 
>   
>   
> 
>   
> 


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




[PHP-DB] what the heck? (elementary question)

2002-06-24 Thread Matthew Crouch

this bit from my index page is giving me 2 headaches:
1. it isn't passing anything into the URL
2. the page that gets called ("name.php") sits and tries to load
forever. it looks like it's even filling up my hard drive with data (?!)

Note: it does this (#2) even if I type in the URL with a variable and
value, like "name.php?lastname=smith"

",
$lastname);
?>

  
  

  



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




[PHP-DB] thanks

2002-03-31 Thread Matthew Crouch

i think i got this solved; sorry about the non-php question but there
isn't a mysql newsgroup that i know of.

Matthew Crouch wrote:

> Here's an easy one that I can't find laid out for me anywhere:
> I want a self join that pairs up the id numbers of a table in every
> permutation
>
> e.g. i have id #s 1, 2, and 3
> i need this result:
> 1 2
> 1 3
> 2 1
> 2 3
> 3 2
> 3 1
>
> clear enough?


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




[PHP-DB] mysql joining 101

2002-03-30 Thread Matthew Crouch

Here's an easy one that I can't find laid out for me anywhere:
I want a self join that pairs up the id numbers of a table in every
permutation

e.g. i have id #s 1, 2, and 3
i need this result:
1 2
1 3
2 1
2 3
3 2
3 1

clear enough?


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




[PHP-DB] Re: Add and Subtract

2002-03-01 Thread Matthew Crouch

my guess is you've got a double-quote problem like that other guy...
 Hi All,
>
> Would someone please help me with the following code?
>
> I am trying to make this work like if I have 15 gold pieces and I deposit 5
> it will subtract 5 from the gold pieces I have and deposit the 5 into my
> account
> showing that I now have 10 gold pieces I can deposit and 5 in the bank.
>
> I would really appreciate any help.
> Thanks in advance.
>
> Jen Downey
>
> 
>
> 
> 
> 
>  Deposit
>   
> 
> 
>  
>  
> 
> 
> 
> 
> $ret = mysql_query($query);
> while(list($points)=
> mysql_fetch_row($ret))
>
> print("You have $points Gold Pieces you may withdraw!"); ?>
> 
> 
> 
>  Withdraw
>   
> 
> 
>  
>  
> 
> 
> 
>  $db["bank_points"]=("UPDATE wt_users set bank_points = bank_points +
> $user_deposit");
> $result=mysql_query($db["bank_points"]);
>
> $db["bank_points"]=("UPDATE wt_users set bank_points = bank_points -
> $user_withdraw");
> $result=mysql_query($db["bank_points"]);


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




[PHP-DB] Re: Retreiving data from a table

2002-03-01 Thread Matthew Crouch

i'm guessing you use mysql, so...
you can use the mysql_insert_id to retrieve the most recent addition, then
select on it

$newid=mysql_insert_id();
$sql=select [the auto_increment field] from table1 where id='$newid';

Does that help?

Morten Nielsen wrote:

> Hi,
> I got the following insert statement in my PHP code:
>
>  $qid = db_query("
>  INSERT INTO table1 (
>   Name
>  ) VALUES (
>'$frm[Name]'
>  )");
>
> This is working like I want it to. But in the table there is a column, which
> is AUTO_INCREMENT. I would like to retreive this number right after I added
> the data.
> Can anybody help me?
>
> Thanks,
> Morten


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




[PHP-DB] answered my own question

2002-03-01 Thread Matthew Crouch

for anyone else who needs it:

http://www.phpbuilder.com/snippet/download.php?type=snippet&id=356

Matthew Crouch wrote:

> should be simple as pie, of course, but i can't find a straightforward
> syntax example in the documentation. i'm trying to change the PHP date
> format to mysql's.
>
> my code:
> $today = date("MMDD");
> $sql = "INSERT into table (date) values ('$today')";
> and so on...
>
> is filling the date field with zeros, instead of 2002-02-28


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




[PHP-DB] Re: FW: PHP Question on MySQL grouping

2002-03-01 Thread Matthew Crouch

Another way is to set a testing variable and then print an  if it
changes
(this off the top of my head, probably bugs in it but you get the idea)

while $myrow=mysql_fetch_row($result) {
if $myrow["dishtype"]<>$test {
echo "";
//here you would print the rest of the info about the dish from the row
}
$test=$myrow["dishtype"];
}

Keiran Wynyard wrote:

> I need to loop through a grouped recordset adding a  at the
> end of each group, how can groups in recordsets be identified in
> PHP for specific formatting.
>
>  SELECT name AS name, dishtype AS dishtype, price AS price
>  FROM dishes
>  WHERE used = 1
>  GROUP BY dishtype, name
>  ORDER BY dishtype, price DESC
>
> The use is in the display of a menu for a restaurant, where there
> is a table containing all the dishes on the menu in any given
> instance, but they musst be displayed in a specific order,
> grouped by type. In other words, all Starters come first,
> followed by Main courses, followed by Desserts. Between each type
> there needs to be a seperator, the horizontal line.
>
>  Thanks for you help
>
> Keiran


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




[PHP-DB] Re: Building secure authentification with sessions

2002-03-01 Thread Matthew Crouch

this is in the ballpark:
http://phpbuilder.com/columns/ying2602.php3?page=1


Andy wrote:

> Hi there,
>
> I did recently read an article about security. Now I absolutly see the need
> of recoding my authentification procedure on a community site.
>
> There are questions I hoped some of you guys can answer
>
> 1. Is storing sensitive data like permission level secure in session
> variables?
>
> 2. What could be a good way to session register a user and know which users
> are online, know their permission level in congungtion with a MySQL db?
>
> 3. Is it better to store the needed info about the user in a db table
> holding all current sessions, or to store it in more than 1 session
> variable.
>
> 4. Maybe someone can relate to a good site dealing with security issuses on
> this topic. I would really like to avoid that some hacker gets admin access
> on my website :-)
>
> Thanx for any hints,
>
> Cheers Andy


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




[PHP-DB] easy date format question

2002-03-01 Thread Matthew Crouch

should be simple as pie, of course, but i can't find a straightforward
syntax example in the documentation. i'm trying to change the PHP date
format to mysql's.

my code:
$today = date("MMDD");
$sql = "INSERT into table (date) values ('$today')";
and so on...

is filling the date field with zeros, instead of 2002-02-28


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




[PHP-DB] request and response objects?

2002-01-30 Thread Matthew Crouch

basically a yes or no question my brother wants me to ask:
Does PHP support these objects? If not, Can they be faked?


-- 
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/Mysql web hosting: who's best?

2001-12-19 Thread Matthew Crouch

I looked at hypermart.net and they want $30 a month, which seems okay
but their package comes with things I don't need, like 15 email
addresses. I have a modest little dB -- does anyone know of good deals
for plain folk?


-- 
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: converting extracted variables to arrays

2001-12-19 Thread Matthew Crouch

here it is:
http://www.php.net/manual/en/function.explode.php

[EMAIL PROTECTED] wrote:

> Hi,
>   i have a variable which is multi valued seperated by # (say as) delimiter
>
> like student#name#address#college#etc... #...#
> i want to seperate it into an array with index $i
> can anyone suggest a way to do so
> TIA
> -Sharmad


-- 
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: Dynamically populating a dropdown box

2001-12-13 Thread Matthew Crouch

I'm no expert, and my code is probably buggy, but I think this is the gist of it:


%s", $myrow["colorid"], $myrow["colorname"]);
}
?>



Chris Payne wrote:

> Hi there everyone,
>
> I have a shopping cart which is starting to work nicely, but I have to select 
>size/color from the entries, how do I do this dynamically in PHP with MySQL?  I need 
>them to be dropdown form boxes but haven't got a clue how to populate them from the 
>fields of my database.
>
> Please help me with example code if possible, it would be greatly appreciated :-)
>
> Thank you everyone
>
> Regards
>
> Chris


-- 
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: parse error

2001-12-13 Thread Matthew Crouch

your line 357 doesn't appear to have its semicolon...

Rob Day wrote:

> Sorry for not giving enough info. This is right in the middle of the script.
> I do have the opening and closing tags. It must ne something else.
>
> -Original Message-
> From: Matthew Crouch [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 13, 2001 4:04 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: parse error
>
> you haven't shut your script with the ?> before starting your HTML, near as
> I
> can figure it
>
> Rob Day wrote:
>
> > I've written a small script that processes a form from a webpage and sends
> > the submitted data as an HTML e-mail that has the form all filled out
> > already. I've gotten smaller versions of this script to work without any
> > problem just to test the idea.I can't figure out why I'm now getting the
> > following error:
> > Parse error: parse error in /home/httpd/cgi-bin/rday/lists/do_listapp.php3
> > on line 358
> >
> > Here is the offending code:
> > 353 if ($moderation == "no"){
> > 354 $message .= " checked";
> > 355 }
> > 356
> > 357$message .= '
> > 358>no
> > 359Answer "yes" if you want all postings to the list to be
> > sent to
> > 360  a moderator for approval before distribution to the
> > list.
> >
> > Any help would be greatly appreciated. Thanks!
> > 
> > Rob Day
> > Web Team Leader
> > Texas State Library and Archives Commission
> > phone: 512.936.4463   fax: 512.463.5436
> > [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 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: parse error

2001-12-13 Thread Matthew Crouch

you haven't shut your script with the ?> before starting your HTML, near as I
can figure it

Rob Day wrote:

> I've written a small script that processes a form from a webpage and sends
> the submitted data as an HTML e-mail that has the form all filled out
> already. I've gotten smaller versions of this script to work without any
> problem just to test the idea.I can't figure out why I'm now getting the
> following error:
> Parse error: parse error in /home/httpd/cgi-bin/rday/lists/do_listapp.php3
> on line 358
>
> Here is the offending code:
> 353 if ($moderation == "no"){
> 354 $message .= " checked";
> 355 }
> 356
> 357$message .= '
> 358>no
> 359Answer "yes" if you want all postings to the list to be
> sent to
> 360  a moderator for approval before distribution to the
> list.
>
> Any help would be greatly appreciated. Thanks!
> 
> Rob Day
> Web Team Leader
> Texas State Library and Archives Commission
> phone: 512.936.4463   fax: 512.463.5436
> [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] Multiple mysql inserts

2001-12-13 Thread Matthew Crouch

I have multiple functions hitting the dB (mysql) with inserts in a
single page, and they can't seem to get together; i.e. I can get this or
that function to do its job, but not all of them at once. Is there
something I should know about "closing out" a mysql_query or $result
before another can be sent?


-- 
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: SQL problem is killing this newbie

2001-12-12 Thread Matthew Crouch

You need an associating table; members and movies are in a many-to-many
relationship here.
The associating table represents the act of viewing-a-movie, and describe who
and what are involved

comme ca:

"members"
memberid, name
1 Fred
2 Jack
3 Jill

"movies"
movieid, title
1 Fear and loathing
2 Monkey Town
3 PHP: The film
4 PHP: The sequel

"viewings"
viewingid, memberid, movieid
1 2 2
2 1 4
3 1 1
4 3 4
this data indicates that Jack saw "monkey town", Fred saw "Fear&Loathing" and
"PHP:The Sequel", and Jill saw only "PHP: The sequel"

Samios wrote:

> I am having a problem designing a query on a mysql 3.23 database.
>
> I have 2 tables - "member" and "movie".
> The "member" table stores the people details, the "movie" table records the
> movies they have seen (each record is one movie).
>
> MEMBER
> memberid int not null auto_increment primary key,
> membername varchar(50) not null,
> etc...
>
> MOVIE
> movieid int not null auto_increment primary key,
> movietitle varchar(50) not null,
> memberid int,
> index (memberid)
> etc...
>
> Obviously member to movie is a one-to-many relationship.
>
> I want to create a search page which will allow me to search for members who
> have watched a specified set of movies.
> i.e. I want to query the database for members who have seen "Star Trek" AND
> "Star Wars" AND "Planet of the APES".
>
> I can create a query which searches for "Star Trek" OR "Star Wars" OR
> "Planet of the Apes".
> Unfortunately the "AND" condition is causing me problems.
>
> I'm also hoping to use the "LIKE" operator in this query.
> e.g. where movietitle like "%star%".
> This will give me added flexiblity down the track.
>
> Any help would be greatly appreciated.


-- 
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: sorry...probably too easy

2001-12-05 Thread Matthew Crouch

solved my own problem.
if anyone else needs it, the function is substr($string, firstposition,
number)
http://www.devshed.com/Server_Side/PHP/StringTheory/page4.html

Mateo The Db Guy wrote:

> i'm fairly new to php, and thank you in advance for helping.
> is there a function that will extract the first character from a mysql
> result and put it into a variable?
> the goal is to make one of these  browse-by-alpha lists
>
> ABCDEFGHIJKLMNOPQRSTUVWXYZ
> A
> Adam
> Alethea
> Arnie
> B
> Billy
> Buster
> ...
>
> where all the names come from the mysql query, and the anchors are
> automatically built where they need to be.


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