[PHP-DB] stuck on stupid...can't find the bloody error...
okay, please help the newbie idiot. Forgive me, for I cannot code my way out of a paper bag. What, O great Oracle of PHP Goodness is wrong with this picture? When I punch in a work order, it spits back a blank page and does nothing whatsoever with the db. Even if I deliberately enter a work order number that already exists. Help this feeble-minded programmer wannabe? Oh, as to the \' madness down yonder: should I or shouldn't I backslash the single quotes? TIA Dan html headtitleThe Board Lady - Work Order Database 0.1a/title/head body ?php define ('DB_USER', ''); define ('DB_PASSWORD', '*'); define ('DB_HOST', 'localhost'); define ('DB_NAME', 'boards'); $dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to database: ' . mysql_error()); @mysql_select_db (DB_NAME) OR die ('Could not connect to database: ' . mysql_error()); $page_req=$HTTP_GET_VARS['action']; if ($page_req == ) {$page_req=0;} if ($page_req == 0) { echo SWORD data entrybr\n; echo form action=\add.php\ method=\get\; echo Work Order #: input type=\text\ name=\wo_num\br\n; echo Customer Name: input type=\text\ name=\name\ Phone: input type=\text\ name=\phone\br\n; echo Email Addy: input type=\text\ name=\email\ Date In: input type=\text\ name=\date\br\n; echo Board Type and SN: input type=\text\ name=\board_type\ Last 3 of SN: input type=\text\ name=\last_three\br\n; echo Weight In: input type=\text\ name=\weight_in\ Weight Out: input type=\text\ name=\weight_out\br\n; echo input type=\hidden\ name=\action\ value=\1\\n; echo INPUT type=\submit\ value=\Add Work Order\ INPUT type=\reset\br\n; } if ($page_req == 1) { $wo_num=$HTTP_GET_VARS['wo_num']; $name=$HTTP_GET_VARS['name']; $phone=$HTTP_GET_VARS['phone']; $email=$HTTP_GET_VARS['email']; $date=$HTTP_GET_VARS['date']; $board_type=$HTTP_GET_VARS['board_type']; $last_three=$HTTP_GET_VARS['last_three']; $weight_in=$HTTP_GET_VARS['weight_in']; $weight_out=$HTTP_GET_VARS['weight_out']; $query_testingforadupe = SELECT job_no FROM boards WHERE job_no == $job_no ORDER BY job_no ASC; $result_testingforadupe = @mysql_query ($query_testingforadupe); if ($result_testingforadupe) { echo That's a duplicate work order number, you ditz. Try again, this time without screwing it all up.brbr\n; echo form action=\add.php\ method=\get\; echo Work Order #: input type=\text\ name=\wo_num\br\n; echo Customer Name: input type=\text\ name=\name\ Phone: input type=\text\ name=\phone\br\n; echo Email Addy: input type=\text\ name=\email\ Date In: input type=\text\ name=\date\br\n; echo Board Type and SN: input type=\text\ name=\board_type\ Last 3 of SN: input type=\text\ name=\last_three\br\n; echo Weight In: input type=\text\ name=\weight_in\ Weight Out: input type=\text\ name=\weight_out\br\n; echo input type=\hidden\ name=\action\ value=\1\\n; echo INPUT type=\submit\ value=\Add Work Order\ INPUT type=\reset\br\n; } else { $query_insert = INSERT INTO boards (wo_num, name, phone, email, date, board_type, last_three, weight_in, weight_out) VALUES (\'$wo_num\', \'$name\', \'$phone\', \'$email\', \'$date\', \'$board_type\', \'$last_three\', \'$weight_in\', \'$weight_out\'); $result_insert = @mysql_query ($query_insert); if ($result_insert == ) { echo input type=\hidden\ name=\action\ value=\0\\n; echo INPUT type=\submit\ value=\Continue\\n; } else {echo OOPS! Your programmer is an idiot!\n;} }} mysql_close(); ? /body /html
Re: [PHP-DB] stuck on stupid...can't find the bloody error...
echo form action=\add.php\ method=\get\; echoform action=\add.php?action=$page_req\ method=\get\; Try that first, and see if it fixes your issue. I'm shutting down for the day and unfortunately, I didn't have time to parse through the remainder of script. ~Rachel = ~Rachel __ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ http://photos.yahoo.com/ph/print_splash -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Using $_SESSION array for large number of variables. Any recommendations?
Hi all, System : Windows XP / Apache / MySql / PHP I'm considering using session variables to store a large amount of data. How much is 'large'? To be honest, I have no idea at this point - very early days. For arguments sake, lets say the system consisted of 100 users who will all store between them say 1000 different variables and objects for a period of 1 or 2 days. In a nutshell, reason for storing this info is to save the state of php programs. Is this approach advisable, or are there limits / other considerations when using session variables? I would greatly appreciate peoples comments on potential problems pursuing this approach from anyone with extensive experience using session vars. Thanks ... Ross . Ross Honniball JCU Bookshop Cairns Supervisor . James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia . Ph:07.4042.1157 Fx:07.4042.1158 Em:[EMAIL PROTECTED] . There are no problems. Only solutions. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: stuck on stupid...can't find the bloody error...
Dan Bowkley wrote: else { $query_insert = INSERT INTO boards (wo_num, name, phone, email, date, board_type, last_three, weight_in, weight_out) VALUES (\'$wo_num\', \'$name\', \'$phone\', \'$email\', \'$date\', \'$board_type\', \'$last_three\', \'$weight_in\', \'$weight_out\'); No need to escape the single quotes. Not entirely sure if it's invalid or not, but it's unneccessary. $result_insert = @mysql_query ($query_insert); if ($result_insert == ) { echo input type=\hidden\ name=\action\ value=\0\\n; echo INPUT type=\submit\ value=\Continue\\n; } else {echo OOPS! Your programmer is an idiot!\n;} Try this: if (([EMAIL PROTECTED]($query_insert)) != FALSE) { ... echo HTML ... } else {echo Oops! Your programmer is broken. Oh and here's what MySQL said: br /\n.mysql_error();} Hopefully that works for you. I think the problem may be the escapes quotes. Cheers, Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: stuck on stupid...can't find the bloody error..
Isnt easy to use if (! $page_req) or if (strcmp($page_req,0)) instead of if ($page_req == ) or if ($page_req == 0) ? -- saludos, J. Alejandro Ceballos Z. | ---+--- http://alejandro.ceballos.info | [EMAIL PROTECTED] | Life is like a shooting star ---+ it don't matter who you are | if you only run for cover, | is a waste of time | we are lost 'til we are found | this phoenix rises up | from the ground | and all these wars are over. | |-- Live, The dolphin's cry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Using $_SESSION array for large number of variables. Any recommendations?
Apr 25 at 7:48pm, Jimmy Brock wrote: I would recommend cookies, not session. Cookies are stored on the users machine, whereas session data is stored on the server. If you have a power failure or have to reboot the server session data will be lost -- since session data is stored in memory. First, the default session handler stores data on disk, not in memory. Not sure if restarting the webserver trashes them or not. Cookies would not suffice for this much data. The size of each cookie and the number of cookies allowed per site is limited. Not sure on the actual limitations in modern browsers, but you probably shouldn't store more than 20 cookies, and they probably should not exceed 1024 bytes per cookie. Furthermore, all the cookie data is transmitted from the client on each hit, so there are practical limitations with bandwidth as well. -- Kelly Hallman -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Using $_SESSION array for large number of variables. Any recommendations?
I would recommend cookies, not session. Cookies are stored on the users machine, whereas session data is stored on the server. If you have a power failure or have to reboot the server session data will be lost -- since session data is stored in memory. Ross Honniball [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, System : Windows XP / Apache / MySql / PHP I'm considering using session variables to store a large amount of data. How much is 'large'? To be honest, I have no idea at this point - very early days. For arguments sake, lets say the system consisted of 100 users who will all store between them say 1000 different variables and objects for a period of 1 or 2 days. In a nutshell, reason for storing this info is to save the state of php programs. Is this approach advisable, or are there limits / other considerations when using session variables? I would greatly appreciate peoples comments on potential problems pursuing this approach from anyone with extensive experience using session vars. Thanks ... Ross . Ross Honniball JCU Bookshop Cairns Supervisor . James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia . Ph:07.4042.1157 Fx:07.4042.1158 Em:[EMAIL PROTECTED] . There are no problems. Only solutions. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Using $_SESSION array for large number of variables. Any recommendations?
Hi, I would suggest a mysql table for the data. For large amounts it is probably more efficient - not sure how much resource is needed to manage 100K pieces of information using $_SESSION, but an indexed mysql table is probably much quicker. table CREATE TABLE `session_data` ( `userID` VARCHAR( 20 ) NOT NULL , `var_name` VARCHAR( 100 ) NOT NULL , `var_data` VARCHAR( 250 ) NOT NULL , PRIMARY KEY ( `userID` , `var_name` ) ); you then retrieve the data at the beginning of each page request. This is also persistent, so it will be there for as long as needed. If you have a login system this also allows the user to switch machines or browsers - $_SESSION is linked to the browser. From experience this works well. hth Peter --- Excellence in internet and open source software --- Sunmaia Birmingham UK www.sunmaia.net tel : 0121-242-1473 fax : 0870 7621758 International +44-121-242-1473 --- -Original Message- From: Jimmy Brock [mailto:[EMAIL PROTECTED] Sent: 26 April 2004 00:48 To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Using $_SESSION array for large number of variables. Any recommendations? I would recommend cookies, not session. Cookies are stored on the users machine, whereas session data is stored on the server. If you have a power failure or have to reboot the server session data will be lost -- since session data is stored in memory. Ross Honniball [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, System : Windows XP / Apache / MySql / PHP I'm considering using session variables to store a large amount of data. How much is 'large'? To be honest, I have no idea at this point - very early days. For arguments sake, lets say the system consisted of 100 users who will all store between them say 1000 different variables and objects for a period of 1 or 2 days. In a nutshell, reason for storing this info is to save the state of php programs. Is this approach advisable, or are there limits / other considerations when using session variables? I would greatly appreciate peoples comments on potential problems pursuing this approach from anyone with extensive experience using session vars. Thanks ... Ross . Ross Honniball JCU Bookshop Cairns Supervisor . James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia . Ph:07.4042.1157 Fx:07.4042.1158 Em:[EMAIL PROTECTED] . There are no problems. Only solutions. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How to display table columns
hi, I want to display the table coulumns along with those values below it. I am only able to display the table values, now I want to diplay the corresponding table attribut above the value. eg : name age sex abc1m xyz 2f I want to display name, age and sex. I am using mysql as database. thanks in advance. - Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢
[PHP-DB] Re: How to display table columns
I think what you may be looking for is the DESCRIBE command. It allows you to get information about table columns. http://dev.mysql.com/doc/mysql/en/DESCRIBE.html Andy Andy Amol wrote: hi, I want to display the table coulumns along with those values below it. I am only able to display the table values, now I want to diplay the corresponding table attribut above the value. eg : name age sex abc1m xyz 2f I want to display name, age and sex. I am using mysql as database. thanks in advance. - Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to display table columns
Well, you would create a table like this echo tabletrtdname/tdtdage/tdtdsex/td/tr; Then, you would do a query (assuming you've already made a connection to your database)... $result = mysql_query(SELECT name,age,sex FROM database.usertable); Then, run through the results... while ($row = mysql_fetch_assoc($result)) { echo trtd.$row[name]./tdtd.$row[age]./tdtd.$row[sex]./td/tr; } Then, end the table like this echo /table; There you have it. - Original message - From: andy amol [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Sun, 25 Apr 2004 19:47:37 -0700 (PDT) Subject: [PHP-DB] How to display table columns hi, I want to display the table coulumns along with those values below it. I am only able to display the table values, now I want to diplay the corresponding table attribut above the value. eg : name age sex abc1m xyz 2f I want to display name, age and sex. I am using mysql as database. thanks in advance. - Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to display table columns
andy amol wrote: hi, I want to display the table coulumns along with those values below it. I am only able to display the table values, now I want to diplay the corresponding table attribut above the value. eg : name age sex abc1m xyz 2f I want to display name, age and sex. http://us2.php.net/manual/en/function.mysql-field-name.php -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php