[PHP-DB] GD with IIS and MS SQL Server
I work with a county office in Houston, Texas and have been forced to use Windows IIS (on Windows 2000 Server) with MS SQL Server. They have permitted me to use PHP (instead of ASP) when I showed them problems on every county ASP site. Most applications on IIS are running well including database connections and all my PHP functions but I am having problems getting GD applets to work. The GD application that I am most interested in outputs a bar code image. On the Windows Server this image does not appear and there are no error messages outputted even when the display error messages option is enabled (at least this is what our IT department claims!) This application works perfectly on my local Apache Server (which runs on my Windows XP machine). Has anyone attempted to get PHP / MS SQL Server / Windows IIS to work? If so, have you had similar difficulties when you tried to enable GD? - Matthew
Re: [PHP-DB] mysql, php error
James wrote: I'm pretty new to this...I've set this book example up on my PC and it's fine. I've attempted this on two Macs... Here's the error I get when I try to run the application. What does the error mean? UNHANDLED ERROR on line 84 in /Library/WebServer/Documents/wda2-winestore/index.php. [PHP Error 20050307145950]Error: "Non-static method DB::connect() should not be called statically" (error #2048). [snip] You're calling a classes method statically when it cannot be called as such - the function makes references to $this, or has otherwise been shown to be non-static. You need to create an instance of the object, then call the method through it. E.G. instead of: DB::connect('some','variables'); you have to use: $mydb = new DB; $mydb->connect('some','variables'); Without the exact code, I can only give you examples of about how it should look - but that's the gist of it. cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql, php error
I'm pretty new to this...I've set this book example up on my PC and it's fine. I've attempted this on two Macs... Here's the error I get when I try to run the application. What does the error mean? UNHANDLED ERROR on line 84 in /Library/WebServer/Documents/wda2-winestore/index.php. [PHP Error 20050307145950]Error: "Non-static method DB::connect() should not be called statically" (error #2048). [PHP Error 20050307145950]Backtrace: [PHP Error 20050307145950] 0: connect (line 84 in /Library/WebServer/Documents/wda2-winestore/index.php) [PHP Error 20050307145950]Variables in connect (): [PHP Error 20050307145950] GLOBALS is Array [PHP Error 20050307145950] _POST is NULL [PHP Error 20050307145950] _GET is NULL [PHP Error 20050307145950] _COOKIE is Array [PHP Error 20050307145950] _FILES is NULL [PHP Error 20050307145950] _PEAR_default_error_mode is 1 [PHP Error 20050307145950] _PEAR_default_error_options is 1024 [PHP Error 20050307145950] _PEAR_destructor_object_list is NULL [PHP Error 20050307145950] _PEAR_shutdown_funcs is NULL [PHP Error 20050307145950] _PEAR_error_handler_stack is NULL [PHP Error 20050307145950] hostname is 127.0.0.1 [PHP Error 20050307145950] databasename is winestore [PHP Error 20050307145950] username is wineuser [PHP Error 20050307145950] password is w1nes [PHP Error 20050307145950] _SERVER is Array [PHP Error 20050307145950] dsn is mysql://wineuser:[EMAIL PROTECTED]/winestore [PHP Error 20050307145950] php_errormsg is var: Deprecated. Please use the public/private/protected modifiers [PHP Error 20050307145950] HTTP_SESSION_VARS is NULL [PHP Error 20050307145950] _SESSION is NULL [PHP Error 20050307145950] template is Object id #1 -James -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shopping Cart
Wendell Frohwein wrote: Hi martin, thanks for the email. I'm sorting it out slowly but surely. I was just a little over worked the night I wrote that novel of an email. I don't know if you saw my latest email titled "Mysql Result". That's the last step I am at. I used a select statement across multiple tables to get all the values that I wanted. I forgot because I was so tired that, once I had those values in there that I could sort by anything I wanted to. If you have a solution for my Mysql Result problem, that would help me out alot. Most people are saying that I have to do a sub query, so I am not really sure. Thanks though. -Wendell Frohwein [snipped from another email] > I wanted to know if it would be possible for it to output it like so: > > +--+---+-+--+ > | makename | modelname | versionname |years | > +--+---+-+--+ > | Acura| Integra | RS | 92,93| > | Acura| Integra | GSR | 94,95,96,97,98,99,01 | > +--+---+-+--+ [snip] As penance for suggesting the quick way out in another posting, I've answered your question! (I would've answered anyway - I'm a softie. I got distracted this morning with the whole 'work' thing - sorry for the delay.) I remembered doing this before - and sure enough: GROUP_CONCAT: http://dev.mysql.com/doc/mysql/en/group-by-functions.html The relevant bits: """ GROUP_CONCAT([DISTINCT] expr [,expr ...] [ORDER BY {unsigned_integer | col_name | expr} [ASC | DESC] [,col_name ...]] [SEPARATOR str_val]) mysql> SELECT student_name, -> GROUP_CONCAT(test_score) -> FROM student -> GROUP BY student_name; Or: mysql> SELECT student_name, -> GROUP_CONCAT(DISTINCT test_score -> ORDER BY test_score DESC SEPARATOR ' ') -> FROM student -> GROUP BY student_name; """ The default separator is the comma. Just toss in a 'GROUP_CONCAT(year) AS year' and appropriate 'GROUP BY' clause and have at it. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re:data grabbing and mathematics!
Neil Smith [MVP, Digital media] wrote: At 17:15 07/03/2005 +, you wrote: well - two options spring to mind... 1) use a single table, with 23 columns instead of 2. Then sum the columns in your query. - 1 query, no loops required. 2) have your script pull everything and add it all up. - 22 queries, a loop for each, array storing scores & indexed by name. Actually I disagree strongly unless your intention is to be able to read the rows yourself ! As the stated intention is to add up scores (doing the maths) in fact much more efficiently you want to have just 3 columns in a single table, "tblBlah" : UserRoundNumber RoundScore Bob 1 6 Bob 2 2 Bob 3 3 Steve 1 5 Steve 3 1 Steve 4 6 [snip] Now you've got a list of rounds and the average score per round. And you don't have to write a gigantic query across 23 tables like SELECT tbl1.RoundScore, tbl2.RoundScore, tbl3.RoundScore, tbl4.RoundScore even if that was practical (you'd have to use outer joins and the result set would be huge). Using multiple tables, or even multiple columns is deeply inefficient for this. You can set up a couple of queries to merge all the tables into one in a few minutes, it's called database refactoring and in your case would improve the manageability of your data by10x. [snip] Using multiple tables was described for comparison reasons, to show why it was not a good idea. Using multiple columns is the most space/time efficient - assuming players aren't only playing a few rounds. It is, however, not the most *flexible*, as you're saying. You need to modify the number of columns if things ever change, though you aren't limited to the number of players. Your database is fully normalized, but has the penalty of storing more data (minor), and is slightly more work on him if he wishes to display a summary, which I assumed was also part of his intention. Your way is the way I would do it for a full proper application, my suggestions were the way I would do it if it is something where the rules simply don't change (think sports/etc.) - I gave quick and simple suggestions for (what I saw as) a quick and simple app. I agree with your solution wholly, if his deadline isn't in 2 hours. Unfortunately, all too often our deadlines are yesterday. For this sort of table, you would create an index on each of the 3 columns to imccrease the query speed massively. A nice side effect apart from speed, is that data stored in this way takes up no space if a (new) user hasn't completed any rounds (for example ;-) [snip] One should be indexing all their tables properly :P All good valid points, well said. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] regex question
At 11:04 3/7/2005, Chip Wiegand wrote: >I am writing some regex on a php form to validate input and have come up >with this, for example - > >if (empty($first) || !eregi("^[A-Za-z]+[- ]?[A-Za-z]+$", $first)) > >for checking a persons name. This allows a single name, or a hyphenated >double name, or a non-hyphenated double name, and it works. My question is >this - why is the third set followed by a '+' optional? I thought the + >meant the preceding group is present 1 or more times. The ? means the >preceding group is present 0 or more times. Why is it that when I put a ? >in the place of the + after the last ] > >if (empty($first) || !eregi("^[A-Za-z]+[- ]?[A-Za-z]?$", $first)) > >the regex is broken? > >Regards, >Chip If you want to add the capability for those weird, foreign names [ ;^) ], take a look at the RegEx on this page: http://www.RegExLib.com/UserPatterns.aspx?authorId=45511 Start Here to Find It Fast! -> http://www.US-Webmasters.com/best-start-page/ $8.77 Domain Names -> http://domains.us-webmasters.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Shopping Cart
Hi martin, thanks for the email. I'm sorting it out slowly but surely. I was just a little over worked the night I wrote that novel of an email. I don't know if you saw my latest email titled "Mysql Result". That's the last step I am at. I used a select statement across multiple tables to get all the values that I wanted. I forgot because I was so tired that, once I had those values in there that I could sort by anything I wanted to. If you have a solution for my Mysql Result problem, that would help me out alot. Most people are saying that I have to do a sub query, so I am not really sure. Thanks though. -Wendell Frohwein -Original Message- From: Martin Norland [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 7:08 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Shopping Cart Wendell Frohwein wrote: > Hello everyone. Just want to thank you for all the help you have > provided me in the past. I have a new task that I am trying to tackle, > but have come into a snag. I am building a customized shopping cart for > auto accessories. I have gotten about 90% of the cart worked out except > for the search feature. It is not a textual search. It is a vehicle > specific search. > > When products are added to the cart, all the standard information is > there along with the vehicle make, model, and year. Example: Honda Civic > Si 1999. So this sounds like a peace of cake, as I would think. But in > the customized car industry, some products fit on multiple cars. > Example: DC Sport 4-1 Header AHS6607s fits all 92-93 Acura Integra's, > but also fits 94-99 Acura Integra's GSR Only. > > When adding a product. I have this option that says, "Select Vehicle > Make, Model, and Year". Option for newly created product says, "Not > Selected". So they click to add and a window opens that allows you to > pick these choices from drop down menus. So for the above examples, you > would choose: > > Make Drop Down: Acura > Model Drop Down: Integra > Year Text Field: 92-93 > > Then you click add vehicle to this product. That window stays open and > allows you to put another entry for the current product. > > Make Drop Down: Acura > Model Drop Down: Integra > Year Text Field: 94-99 > > Once again, click add vehicle to this product. > > So all this goes into a table that I called cart_search. Here is the > table layout for the cart_search table: > > CREATE TABLE `cart_search` ( > `id` INT( 20 ) NOT NULL AUTO_INCREMENT , > `pid` INT( 20 ) NOT NULL , > `make` INT( 20 ) NOT NULL , > `model` INT( 20 ) NOT NULL , > `year` INT( 4 ) NOT NULL , > PRIMARY KEY ( `id` ) > ); > > For the above examples, the following rows would be added: (forgive my > crappy hand coded mysql output) > > |id|pid|make|model|year| > 11234 1 1 1992 > 21234 1 1 1993 > 31234 1 1 1994 > 41234 1 1 1995 > 51234 1 1 1996 > 61234 1 1 1997 > 71234 1 1 1998 > 81234 1 1 1999 > > > in the cart_makes table the id that corresponds with Acura would be 1 > in the cart_models table the id that corresponds with Integra would be 1 > This is the reason for the 1's in the above simulated mysql output. > > When that is all done, the window is closed and you are back at the add > product page. Click Add Product button at the bottom. A new row is > inserted to cart_products and the id row is retrieved with > mysql_insert_id(). Then all the cart_search rows that have 1243 as the > pid would be set to the respective product id that was retrieved by > mysql_insert_id() > > So now you are a potential customer on the website wishing to search for > some products for your 93 acura integra. You go to the search page and > select Acura from drop down 1, page refresh's and the model dropdown is > populated with all Acura models, you select Integra as the model, Page > refreshes again populating the Year drop down with a list of years, You > choose 1993. Hit the search button and mysql does a query to the db as > so: > > $query=mysql_query("SELECT * FROM cart_search WHERE > make='{$_POST["make"]}' AND model='{$_POST["model"]}' AND > year='{$_POST["year"]}'"); > > If the database was only populated with the entry's from above, It would > then return 1 result with a product id for that dc sports header we > added. > > > So after all this, I supposed it works. But not like it should, Cause I > have no idea how to sort it, and to top it off, this just seems like a > really long process just to search a database for some products that > match specified make, model and years. > > Incase you are wondering the search page would r
[PHP-DB] Re:data grabbing and mathematics!
At 17:15 07/03/2005 +, you wrote: JeRRy wrote: Hi, I have 23 tables, well I have more but these 23 tables are the main agenda regarding this question. In each of the table is a column titled "score" and a column titled "nickname" ... These are the two columns we need for this. well - two options spring to mind... 1) use a single table, with 23 columns instead of 2. Then sum the columns in your query. - 1 query, no loops required. 2) have your script pull everything and add it all up. - 22 queries, a loop for each, array storing scores & indexed by name. Actually I disagree strongly unless your intention is to be able to read the rows yourself ! As the stated intention is to add up scores (doing the maths) in fact much more efficiently you want to have just 3 columns in a single table, "tblBlah" : UserRoundNumber RoundScore Bob 1 6 Bob 2 2 Bob 3 3 Steve 1 5 Steve 3 1 Steve 4 6 So for all rounds, you do : SELECT SUM(RoundScore) FROM tblBlah WHERE User='Bob' GROUP BY User And to get Bob's round 2 score : SELECT RoundScore FROM tblBlah WHERE User='Bob' AND RoundNumber=2 You can do all sorts of stuff now which doesn't involve queries which run like SELECT COUNT(*) FROM tblBlah WHERE User='Steve' GROUP BY User And you've just found out how many rounds Steve has completed. Or you can do SELECT RoundNumber, AVG(RoundScore) FROM tblBlah GROUP BY RoundNumber Now you've got a list of rounds and the average score per round. And you don't have to write a gigantic query across 23 tables like SELECT tbl1.RoundScore, tbl2.RoundScore, tbl3.RoundScore, tbl4.RoundScore even if that was practical (you'd have to use outer joins and the result set would be huge). Using multiple tables, or even multiple columns is deeply inefficient for this. You can set up a couple of queries to merge all the tables into one in a few minutes, it's called database refactoring and in your case would improve the manageability of your data by10x. For this sort of table, you would create an index on each of the 3 columns to imccrease the query speed massively. A nice side effect apart from speed, is that data stored in this way takes up no space if a (new) user hasn't completed any rounds (for example ;-) HTH Cheers - Neil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] regex question
Chip Wiegand wrote: I am writing some regex on a php form to validate input and have come up with this, for example - if (empty($first) || !eregi("^[A-Za-z]+[- ]?[A-Za-z]+$", $first)) for checking a persons name. This allows a single name, or a hyphenated double name, or a non-hyphenated double name, and it works. My question is this - why is the third set followed by a '+' optional? I thought the + meant the preceding group is present 1 or more times. The ? means the preceding group is present 0 or more times. Why is it that when I put a ? in the place of the + after the last ] if (empty($first) || !eregi("^[A-Za-z]+[- ]?[A-Za-z]?$", $first)) the regex is broken? The ? doesn't mean 0 or more, it means 'optional' - 0 or 1 times. without specific examples on what works or what breaks, I can't explain it much better than this - but rest assured, that's your problem. now I'm sitting here wondering if ?* and ?+ are interchangeable, and thinking so. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] regex question
I am writing some regex on a php form to validate input and have come up with this, for example - if (empty($first) || !eregi("^[A-Za-z]+[- ]?[A-Za-z]+$", $first)) for checking a persons name. This allows a single name, or a hyphenated double name, or a non-hyphenated double name, and it works. My question is this - why is the third set followed by a '+' optional? I thought the + meant the preceding group is present 1 or more times. The ? means the preceding group is present 0 or more times. Why is it that when I put a ? in the place of the + after the last ] if (empty($first) || !eregi("^[A-Za-z]+[- ]?[A-Za-z]?$", $first)) the regex is broken? Regards, Chip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] data grabbing and mathematics!
JeRRy wrote: Hi, I have 23 tables, well I have more but these 23 tables are the main agenda regarding this question. In each of the table is a column titled "score" and a column titled "nickname" ... These are the two columns we need for this. [snip] Now I want the scores added up. So using the + not * (times) but just adding. So for Bob is 5 + 3 = 8 and this figure must than be placed in another table with that name. What I want to do is just have one code written up so I don't need to change it. So in other words the code would include all 22 tables and the method to add each other together and update to the actual main scoring table. So the score aRE updated once a week. I don't mind if I need to trigger the update (preffered) from a php page/script. That's not the problem but I want to know what code I would use to grab these details and add them up using all 22 tables in the one script. So each time the script is ran it will re-calculate all tables to make sure they are correct if an update is made to a score. So the script would grab all 22 tables score and nickname and than match the nickname and update their score in the scoring table. What I have is this: My Tables are round 1 through to round22 and the scoring totals go into table called tipping. So round1 through to 22 need to be calculated and keeping the totals for each nickname correct with their totals. Don't want the scores to be jumbled with a different nickname. How would I do this that would be a pretty fast process and reliable? If you need more information please let me know. Each round table will have identical Nicknames in each, none will have more or few, same amount. Keeping in mind each round that has not had a total set is defaulted as nothing in the score field, it's blank. But if it's required to have a value of 0 in there for the calculations to work I can default this in. If anyone can help me here it would be great, I have been stuck on this for a while. There is only going to be like 15 names max in each round to do totals for so it's not a huge database. Thanks for your time. [snip] well - two options spring to mind... 1) use a single table, with 23 columns instead of 2. Then sum the columns in your query. - 1 query, no loops required. 2) have your script pull everything and add it all up. - 22 queries, a loop for each, array storing scores & indexed by name. anything else is going to be a join from hell. With only 22 tables and 15 rows in each table, you literally won't be able to blink before either of these methods would be finished calculating your totals. Whatever you code up will be as reliable as the code used for it :) A better question to ask is, will this be something that cycles yearly or regularly? If so, you'll want to be storing some identifier for the event/session/quarter/year/etc. - in which case any join option would be insanely further compliated, and all of your queries would need the chunk added. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] data grabbing and mathematics!
Hi, I have 23 tables, well I have more but these 23 tables are the main agenda regarding this question. In each of the table is a column titled "score" and a column titled "nickname" ... These are the two columns we need for this. Now lets throw a few names so you understand my needs. Lets say Bob, Bill and Barry are the "nickname"'s ... Nickname: Score: Bob5 Bill 3 Barry 7 Okay lets say this is in a table titled "1". Now in table titled "2" Bob 3 Bill 4 Barry6 Now I want the scores added up. So using the + not * (times) but just adding. So for Bob is 5 + 3 = 8 and this figure must than be placed in another table with that name. What I want to do is just have one code written up so I don't need to change it. So in other words the code would include all 22 tables and the method to add each other together and update to the actual main scoring table. So the score aRE updated once a week. I don't mind if I need to trigger the update (preffered) from a php page/script. That's not the problem but I want to know what code I would use to grab these details and add them up using all 22 tables in the one script. So each time the script is ran it will re-calculate all tables to make sure they are correct if an update is made to a score. So the script would grab all 22 tables score and nickname and than match the nickname and update their score in the scoring table. What I have is this: My Tables are round 1 through to round22 and the scoring totals go into table called tipping. So round1 through to 22 need to be calculated and keeping the totals for each nickname correct with their totals. Don't want the scores to be jumbled with a different nickname. How would I do this that would be a pretty fast process and reliable? If you need more information please let me know. Each round table will have identical Nicknames in each, none will have more or few, same amount. Keeping in mind each round that has not had a total set is defaulted as nothing in the score field, it's blank. But if it's required to have a value of 0 in there for the calculations to work I can default this in. If anyone can help me here it would be great, I have been stuck on this for a while. There is only going to be like 15 names max in each round to do totals for so it's not a huge database. Thanks for your time. Jerry Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] data grabbing and mathematics!
Hi, I have 23 tables, well I have more but these 23 tables are the main agenda regarding this question. In each of the table is a column titled "score" and a column titled "nickname" ... These are the two columns we need for this. Now lets throw a few names so you understand my needs. Lets say Bob, Bill and Barry are the "nickname"'s ... Nickname: Score: Bob5 Bill 3 Barry 7 Okay lets say this is in a table titled "1". Now in table titled "2" Bob 3 Bill 4 Barry6 Now I want the scores added up. So using the + not * (times) but just adding. So for Bob is 5 + 3 = 8 and this figure must than be placed in another table with that name. What I want to do is just have one code written up so I don't need to change it. So in other words the code would include all 22 tables and the method to add each other together and update to the actual main scoring table. So the score aRE updated once a week. I don't mind if I need to trigger the update (preffered) from a php page/script. That's not the problem but I want to know what code I would use to grab these details and add them up using all 22 tables in the one script. So each time the script is ran it will re-calculate all tables to make sure they are correct if an update is made to a score. So the script would grab all 22 tables score and nickname and than match the nickname and update their score in the scoring table. What I have is this: My Tables are round 1 through to round22 and the scoring totals go into table called tipping. So round1 through to 22 need to be calculated and keeping the totals for each nickname correct with their totals. Don't want the scores to be jumbled with a different nickname. How would I do this that would be a pretty fast process and reliable? If you need more information please let me know. Each round table will have identical Nicknames in each, none will have more or few, same amount. Keeping in mind each round that has not had a total set is defaulted as nothing in the score field, it's blank. But if it's required to have a value of 0 in there for the calculations to work I can default this in. If anyone can help me here it would be great, I have been stuck on this for a while. There is only going to be like 15 names max in each round to do totals for so it's not a huge database. Thanks for your time. Jerry Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shopping Cart
Wendell Frohwein wrote: Hello everyone. Just want to thank you for all the help you have provided me in the past. I have a new task that I am trying to tackle, but have come into a snag. I am building a customized shopping cart for auto accessories. I have gotten about 90% of the cart worked out except for the search feature. It is not a textual search. It is a vehicle specific search. When products are added to the cart, all the standard information is there along with the vehicle make, model, and year. Example: Honda Civic Si 1999. So this sounds like a peace of cake, as I would think. But in the customized car industry, some products fit on multiple cars. Example: DC Sport 4-1 Header AHS6607s fits all 92-93 Acura Integra's, but also fits 94-99 Acura Integra's GSR Only. When adding a product. I have this option that says, "Select Vehicle Make, Model, and Year". Option for newly created product says, "Not Selected". So they click to add and a window opens that allows you to pick these choices from drop down menus. So for the above examples, you would choose: Make Drop Down: Acura Model Drop Down: Integra Year Text Field: 92-93 Then you click add vehicle to this product. That window stays open and allows you to put another entry for the current product. Make Drop Down: Acura Model Drop Down: Integra Year Text Field: 94-99 Once again, click add vehicle to this product. So all this goes into a table that I called cart_search. Here is the table layout for the cart_search table: CREATE TABLE `cart_search` ( `id` INT( 20 ) NOT NULL AUTO_INCREMENT , `pid` INT( 20 ) NOT NULL , `make` INT( 20 ) NOT NULL , `model` INT( 20 ) NOT NULL , `year` INT( 4 ) NOT NULL , PRIMARY KEY ( `id` ) ); For the above examples, the following rows would be added: (forgive my crappy hand coded mysql output) |id|pid|make|model|year| 11234 1 1 1992 21234 1 1 1993 31234 1 1 1994 41234 1 1 1995 51234 1 1 1996 61234 1 1 1997 71234 1 1 1998 81234 1 1 1999 in the cart_makes table the id that corresponds with Acura would be 1 in the cart_models table the id that corresponds with Integra would be 1 This is the reason for the 1's in the above simulated mysql output. When that is all done, the window is closed and you are back at the add product page. Click Add Product button at the bottom. A new row is inserted to cart_products and the id row is retrieved with mysql_insert_id(). Then all the cart_search rows that have 1243 as the pid would be set to the respective product id that was retrieved by mysql_insert_id() So now you are a potential customer on the website wishing to search for some products for your 93 acura integra. You go to the search page and select Acura from drop down 1, page refresh's and the model dropdown is populated with all Acura models, you select Integra as the model, Page refreshes again populating the Year drop down with a list of years, You choose 1993. Hit the search button and mysql does a query to the db as so: $query=mysql_query("SELECT * FROM cart_search WHERE make='{$_POST["make"]}' AND model='{$_POST["model"]}' AND year='{$_POST["year"]}'"); If the database was only populated with the entry's from above, It would then return 1 result with a product id for that dc sports header we added. So after all this, I supposed it works. But not like it should, Cause I have no idea how to sort it, and to top it off, this just seems like a really long process just to search a database for some products that match specified make, model and years. Incase you are wondering the search page would return about 3 columns. Product Description, Catalog Number, and Price. It would be pulling all this information out of the cart_products table by its product id number that was returned by the mysql_query above. So I am sorry if this seems like a novel to anyone. I just really believe that there is an easier method to doing all of this. Any help that someone can provide me would be greatly appreciated. I was looking at a lot of websites on the net that sale car accessories and no one really has a search that is this detailed. Most of them are static html pages created by hand. This business has way to many products to make hundreds of static pages like that. So thank you in advanced, and I hope someone could lend a hand. [snip] You're right, you're 90% done. The only remaining 10% is basically confidence. Sounds to me like you have the right code, the right interface, and a fine implementation working already. If you're wondering how to sort the products that are re
[PHP-DB] authentication problem (php and popups)
Hi! I have an authentication problem... My users are authenticated through a mysql table. This set up a session variable to "true" and allow them to browse different pages (in each page I test that session variable). To deny direct access to the directory, I put an htaccess which simply denies all accesses. Things are working fine, except when I want to open a popup.In that case I again have the apache "forbidden". What I don't understand: my site is built has an index page which include in it's center the requested specific pages. So I have something like index.php?page_called=protected1 and in index I do an include of protected1.php. This will include the page protected1.php which is in the protected directory in the webpage without any problem. I don't understand why this is working as I include the file directly (include ("./protectedDirectory/protected1.php")) whereas a simple javascipt window open with that script is not allowed. And I have no idea how to modify that, for some little things it's easier for my user to have a display popup (eg to remind him old values), and currently I have to put that file out of the protected directory. I could put that files somewhere else than under the webroot, but I think there is a way of allowing popup opening by the php script? Sorry if this may be a bit off topic, but I tried to find inforamtion on google/apache and found nothing, and I'm sure some of you are using that system as well? Thanks for your time! _ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unable MySQL db connect Remotely
check "host" on privilege table is mysql allowed to connect from your host ??? Tsegaye Woldegebriel wrote: I wanted to connect to mysql on a remote server, but I have error message: denied for [EMAIL PROTECTED] even if I have the right password and username. the xxx.xxx.xxx.xxx part is our Windows 2003 Small Business Server ip address, and I am on a client computer for this network.(I am locally connected to a LAN). Thank you in advance for every friend around the globe to reply nicely. -- Tatang Widyanto Unit Pengkajian dan Penerapan Teknologi Informasi Universitas Brawijaya http://www.brawijaya.ac.id -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Unable MySQL db connect Remotely
I wanted to connect to mysql on a remote server, but I have error message: denied for [EMAIL PROTECTED] even if I have the right password and username. the xxx.xxx.xxx.xxx part is our Windows 2003 Small Business Server ip address, and I am on a client computer for this network.(I am locally connected to a LAN). Thank you in advance for every friend around the globe to reply nicely. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php