Re: [PHP-DB] New to the list
Please use a _descriptive_ subject. On Sunday 29 August 2004 19:35, Stuart Felenstein wrote: > So, I dug around more and see for behaviour like this, > typically you would need to use javascript. The > examples I've found are exactly what I want, only they > use preformatted values and not the database / tables > I wish to use. Have php pull the data required, have php output the appropriate javascript code using the pulled data _instead_ of the 'preformatted values'. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* "Ada is PL/I trying to be Smalltalk. -- Codoso diBlini */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] New to the list
Right, I realize that as mentioned in my post. I thought this would be the best place though to ask how people work around this. Thank you, Stuart --- [EMAIL PROTECTED] wrote: > php is server-side. i.e., until the page is returned > to the server > the user's selections are unknown so no action can > be taken on them. > e.g., with php you can't get the selected state's > city list until the > user's request is submitted and a "new" page (with > the specific city > list) is returned to the user. > > > > -- Original Message -- > > From: Stuart Felenstein <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Date: Sunday, August 29, 2004 04:35:52 AM -0700 > > Subject: [PHP-DB] New to the list > > > > also new to php and databases. > > Brief background to set the stage: > > I'm attempting to build a site. I'm using > > Dreamweaver, mySQL, and a RAD product called > Impakt > > (the same people who do PHAKT). Impakt works on > the > > php4 - ADODB model. Up to this point I haven't > had to > > understand the code all too much to make things > work, > > aka. inserts, deletions, updates, etc. > > > > Now to why I write today. > > I have an insert transaction form, about 10 > fields. > > Two of those fields are for "city" and "state". I > > have two tables: > > > > State Table:| City Table: > > (innodb)| (innodb) > > StateID (Primary Key) | CityID > > State | StateID > > City > > > > The city table has a foreign key on the StateID > field > > referencing StateID in the state table. > > > > So far so good. > > > > In my form, I want a pull down menu for the state > and > > a list / menu for the City. (You can probably > > anticipate the question) When a selection is made > > from the state list I want the city menu / list to > > reflect the associated cities. > > > > Now I already know that using pure PHP I would > need to > > have the state selection set up as a post vars and > > pass it into another page. Unfortunately it can't > > work that way. > > > > So, I dug around more and see for behaviour like > this, > > typically you would need to use javascript. The > > examples I've found are exactly what I want, only > they > > use preformatted values and not the database / > tables > > I wish to use. > > > > That is pretty much my dilemma. Just not sure how > to > > go about it to make it work. > > > > Appreciate any help or suggestions! > > > > Thank you, > > Stuart > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: > http://www.php.net/unsub.php > > -- End Original Message -- > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] New to the list
also new to php and databases. Brief background to set the stage: I'm attempting to build a site. I'm using Dreamweaver, mySQL, and a RAD product called Impakt (the same people who do PHAKT). Impakt works on the php4 - ADODB model. Up to this point I haven't had to understand the code all too much to make things work, aka. inserts, deletions, updates, etc. Now to why I write today. I have an insert transaction form, about 10 fields. Two of those fields are for "city" and "state". I have two tables: State Table:| City Table: (innodb)| (innodb) StateID (Primary Key) | CityID State | StateID City The city table has a foreign key on the StateID field referencing StateID in the state table. So far so good. In my form, I want a pull down menu for the state and a list / menu for the City. (You can probably anticipate the question) When a selection is made from the state list I want the city menu / list to reflect the associated cities. Now I already know that using pure PHP I would need to have the state selection set up as a post vars and pass it into another page. Unfortunately it can't work that way. So, I dug around more and see for behaviour like this, typically you would need to use javascript. The examples I've found are exactly what I want, only they use preformatted values and not the database / tables I wish to use. That is pretty much my dilemma. Just not sure how to go about it to make it work. Appreciate any help or suggestions! Thank you, Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] new to the list / questions
So, what error does mySQL give you? Also, I suggest printing $sql to determine if it is properly formed. Then, cut/paste that into the mySQL command line to see what mySQL thinks about it. -Original Message- From: Ion Soltan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 05, 2001 12:44 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] new to the list / questions Hi guys, I just joined this list today, and I'm already seeking for advice :) So, I'm working on a project for my university. The project consists in a web interface (php) and a mysql database. The purpose of this project is to let teachers make room reservations for specific classes at specific times. I have been working with C and some other programming languages before, and found php to be similar, although I still have some small things to clarify here and there. At the present moment, I have already implemented the most part of this project, but I got stuck with the error handling. (Most likely because I do not know a lot about php -> mysql connectivity) I need to make a check at the time the user submits a new entry, that the new entry won't overlap timewise with other entries already in the database. The only thing that needs to be checked is the time, in a certain day/month/year. (Reservations cannot be carried over to a different day). Here's how my "selected" table looks like: $tables = "CREATE TABLE selected ( id int(3) ZEROFILL unsigned auto_increment NOT NULL, month tinyint(3) unsigned NOT NULL DEFAULT '0', date tinyint(3) unsigned NOT NULL DEFAULT '0', year smallint(4) unsigned NOT NULL DEFAULT '0', time_start smallint(4) unsigned NOT NULL DEFAULT '0', time_end smallint(4) unsigned NOT NULL DEFAULT '0', class tinytext, special_request blob, PRIMARY KEY (id), UNIQUE id (id), INDEX id_2 (id) )"; And below is a piece of code with my attempts to do the check. (mysql does not like it, so I'm assuming it's not correct). ---BEGIN--- Error, I could not connect to the database at $dbserver. Using username $dbuser and password $dbpass.Please go back and try again."); $x = mysql_select_db("lcdb", $db); flush(); $sql="Select * FROM selected WHERE (( start_time < $start_time) && ( end_time < $end_time ) && ( start_time < $end_time ) && ( end_time < $start_time )) || (( start_time > $start_time) && ( end_time > $end_time ) && ( start_time > $end_time ) && ( end_time > $start_time ))"; $r = mysql_query($sql, $db); if ($row = mysql_num_rows($r)) { $sql = "INSERT INTO selected (time_start, time_end, date, month, year, class, special_request) VALUES ('$start_time', '$end_time', '$day', '$month', '$year','$cla ss','$special_needs')"; if(!mysql_query($sql, $db)) { echo $sql . " : " . mysql_error() . ""; die("$!"); } echo ""; echo ""; echo ""; echo "Your Reservation has been made.Click here to go back to the listing."; echo ""; } else die("Error!"); } else { -END So... If any of you could help me out, I would GREATLY appreciate it. Thanks in advance, Ion -- 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] new to the list / questions
Hi guys, I just joined this list today, and I'm already seeking for advice :) So, I'm working on a project for my university. The project consists in a web interface (php) and a mysql database. The purpose of this project is to let teachers make room reservations for specific classes at specific times. I have been working with C and some other programming languages before, and found php to be similar, although I still have some small things to clarify here and there. At the present moment, I have already implemented the most part of this project, but I got stuck with the error handling. (Most likely because I do not know a lot about php -> mysql connectivity) I need to make a check at the time the user submits a new entry, that the new entry won't overlap timewise with other entries already in the database. The only thing that needs to be checked is the time, in a certain day/month/year. (Reservations cannot be carried over to a different day). Here's how my "selected" table looks like: $tables = "CREATE TABLE selected ( id int(3) ZEROFILL unsigned auto_increment NOT NULL, month tinyint(3) unsigned NOT NULL DEFAULT '0', date tinyint(3) unsigned NOT NULL DEFAULT '0', year smallint(4) unsigned NOT NULL DEFAULT '0', time_start smallint(4) unsigned NOT NULL DEFAULT '0', time_end smallint(4) unsigned NOT NULL DEFAULT '0', class tinytext, special_request blob, PRIMARY KEY (id), UNIQUE id (id), INDEX id_2 (id) )"; And below is a piece of code with my attempts to do the check. (mysql does not like it, so I'm assuming it's not correct). ---BEGIN--- Error, I could not connect to the database at $dbserver. Using username $dbuser and password $dbpass.Please go back and try again."); $x = mysql_select_db("lcdb", $db); flush(); $sql="Select * FROM selected WHERE (( start_time < $start_time) && ( end_time < $end_time ) && ( start_time < $end_time ) && ( end_time < $start_time )) || (( start_time > $start_time) && ( end_time > $end_time ) && ( start_time > $end_time ) && ( end_time > $start_time ))"; $r = mysql_query($sql, $db); if ($row = mysql_num_rows($r)) { $sql = "INSERT INTO selected (time_start, time_end, date, month, year, class, special_request) VALUES ('$start_time', '$end_time', '$day', '$month', '$year','$cla ss','$special_needs')"; if(!mysql_query($sql, $db)) { echo $sql . " : " . mysql_error() . ""; die("$!"); } echo ""; echo ""; echo ""; echo "Your Reservation has been made.Click here to go back to the listing."; echo ""; } else die("Error!"); } else { -END So... If any of you could help me out, I would GREATLY appreciate it. Thanks in advance, Ion -- 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]