[PHP-DB] Input to DB from form
I'm trying to input that data entered into a form into a table in my DB. Here is the code I have. $db = mysql_connect(localhost,cloft,spring); mysql_select_db(countryloft,$db); $sql = INSERT INTO catalogreq (BFNAME,BLNAME,ADD1,ADD2,BCITY,BZIPA,BSTATE,BCTRY,BTELO,DATE) VALUES ('$BFNAME','$BLNAME','$BADD1','$BADD2','$BCITY','$BZIPA','$BSTATE','$BCTRY', '$BTELO','$TODAY'); This is embedded in an HTML document and loads the entire document, but doesn't add the information to the table. Any help would be wonderful! James -- 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] permissions for writing file
I'm trying to use PHP and MySQL to query a table and write the contents to a new file. When run the command to outfile it tells me I don't have permissions. This is on a Unix machine. mysql select * into outfile /home/u1/funfun/www.somewebsite.com/catalogreq/ catalog.txt mysql fields terminated by ',' optionally enclosed by '' mysql fields terminated by ',' optionally enclosed by '' mysql fields terminated by ',' optionally enclosed by '' -- 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: permissions for writing file
My problem is that I'm trying to run the query via a telnet sessions before I code through PHP. Is there a solution that anyone knows for this? James Kupernik [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm trying to use PHP and MySQL to query a table and write the contents to a new file. When run the command to outfile it tells me I don't have permissions. This is on a Unix machine. mysql select * into outfile /home/u1/funfun/www.somewebsite.com/catalogreq/ catalog.txt mysql fields terminated by ',' optionally enclosed by '' mysql fields terminated by ',' optionally enclosed by '' mysql fields terminated by ',' optionally enclosed by '' -- 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] outfile permission error
I'm trying to create a new file on my server from the data in a table. When I do the query it returns a permission error. I'm logged into my server through a telnet sessions and the permissions on the dir allow me to write to it. Here is the query below. mysql select * into outfile /home/u1/me/www.somesite.com/catalogreq/ catalog.txt - fields terminated by ',' optionally enclosed by '' - lines terminated by \n - FROM catalogs; ERROR 1045: Access denied for user: 'me@localhost' (Using password: YES) Any help you be great!! This really has me and my server admin confused. -- 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] password problem
I'm creating this form where the person needs to enter a password to move on. When they enter the password it just loops back to enter the password and doesn't move on. But then I remove the requirement for a password the page moves on and loads the information from the DB. Why is this? -- 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] enter key?
I found the problem in the form and fixed that, but now anytime I want to submit the form by hitting enter, it acts like it's reloading the page. What would be the cause of that? When I click on the submit button the verification and program function correctly, but when I hit enter, they do not. Any help would be great! Thanks -- 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] enter key?
Sorry about that ?php if ($submit) { if ($person == -) { $error = Please select your name!; } elseif ($magicword != password) { $error = Please enter correct password!; } else { echo bHi $person, here are the catalog requests/b\n; $db = mysql_connect(localhost,login,password); mysql_select_db(countryloft); $result = mysql_query(SELECT * FROM catalogs); echo brbrtable border=1\n; echo trtdubName/b/u/tdtdubAddress/b/u/tdtdubCity /b/u/tdtdubState/b/u/tdtdubZip Code/b/u/tdtdubCountry/b/u/td/tr\n; while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%sbr%s/tdtd%s/tdtd%s/tdtd%s/tdtd%s/td/tr\n , $myrow[0],$myrow[1],$myrow[2],$myrow[3],$myrow[4],$myrow[6],$myrow[5],$myrow [7]); } echo /table\n; } } if (!$submit || $error) { echo pfont color=red$error/font/p\n; ? form method=POST action=?php echo $PHP_SELF ? table border=0 cellpadding=3 cellspacing=0 style=border-collapse: collapse bordercolor=#11 id=AutoNumber1 tr td width=50%Who is this? /td td width=50% p align=rightselect size=1 name=person option selected value=-Choose your name/option option value=JamieJames Kupernik/option option value=TammyTammy Kupernik/option option value=LisaLisa Korte/option /select/td /tr tr tdPassword:/tdtdinput type=password name=magicword size=10/td /tr /table pinput type=Submit name=submit value=Get Catalog Requests/p /form ?php } //endif ? Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Friday 18 January 2002 00:25, James Kupernik wrote: I found the problem in the form and fixed that, but now anytime I want to submit the form by hitting enter, it acts like it's reloading the page. What would be the cause of that? When I click on the submit button the verification and program function correctly, but when I hit enter, they do not. Please post some code to save us a lot of conjecturing and hypothesising. You cannot rely the behaviour of hitting enter to submit a form. In IE NN pressing enter to submit a form results in the value for the submit button NOT being sent. So clicking on the submit button to submit a form is not the same as pressing enter to submit the form. Thus if you were relying on the value of the submit button your code wouldn't work. AFAIK Opera does the 'right' thing and sends everything when you press enter to submit the form. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Sometime when you least expect it, Love will tap you on the shoulder... and ask you to move out of the way because it still isn't your turn. -- N.V. Plyter */ -- 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] Resource id #2 ?
I run this query $countreq = mysql_query(SELECT COUNT(*) FROM catalogs WHERE PROCESSED IS NULL); then try to echo $countreq but end up getting Resource id #2 instead of the count total. What would cause this? Thanks for any advise! James -- 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] select and update together
Is it possible to select 10 records that have a NULL field and update that field to become Y instead of NULL? If so what would this syntax be? This is what I have now $result = mysql_query(SELECT * FROM catalogs WHERE PROCESSED IS NULL LIMIT $i,10); I want to add an UPdate to it, but not sure it's possible. Thanks for any advice you can provide. James -- 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] limit sytax error
when I try to do the update with a limit on which records, it gives me a sytax error on the limit, is there anyway to get around this? UPDATE catalogs SET PROCESSED = 'Y' LIMIT $i,10 thanks -- 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] fwrite()
I'm trying to take the contents of a table and write them to a file on my server. Everything seems to function ok (AKA no errors) but no file gets written ... I can't figure out why. Can anyone shine some light on this dark problem? $db = mysql_connect(localhost,cloft,spring); mysql_select_db(countryloft); // get requests from table $result = mysql_query(SELECT * FROM catalogreq WHERE PROCESSED IS NULL); $fp = fopen($DOCUMENT_ROOT/catalogreq/catalogs.txt,w); fwrite($fp, $result); fclose($fp); $updatereq = mysql_query(UPDATE catalogreq SET PROCESSED = 'Y'); echo Thank you!; Thanks for any help! -- 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] fwrite()
Still when I make the changes suggested the file will not be created, yet I get no form of an error message. Is there something else I'm missing? I'm trying to take the contents of a table and write them to a file on my server. Everything seems to function ok (AKA no errors) but no file gets written ... I can't figure out why. Can anyone shine some light on this dark problem? $db = mysql_connect(localhost,cloft,spring); mysql_select_db(countryloft); // get requests from table $result = mysql_query(SELECT * FROM catalogreq WHERE PROCESSED IS NULL); $fp = fopen($DOCUMENT_ROOT/catalogreq/catalogs.txt,w); fwrite($fp, $result); fclose($fp); $updatereq = mysql_query(UPDATE catalogreq SET PROCESSED = 'Y'); echo Thank you!; Thanks for any help! fwrite() needs a string as its second parameter. You are passing a DB result index. Even if a file were being created, it would not contain what you had hoped for. You will need to use $result with mysql_fetch_array() in order to get any useful data out of it. However, that function will return arrays of data, which you will need to massage into your deisred format and issue it in the form of a string to fwrite(). Daniel J. Lashua -- 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] phpMyAdmin
I'm trying to load phpMyAdmin on, and it seems to work fine, but when I browse a table and run my mouse over the contents of that table I get a jazascript error. Does anyone know a solution for this problem? I doesn't happen in the earlier version of phpMyAdmin .. just this later version. Any help would be great! Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: phpMyAdmin
Nevermind ... I found the problem! (slamming head against desk) James Kupernik [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm trying to load phpMyAdmin on, and it seems to work fine, but when I browse a table and run my mouse over the contents of that table I get a jazascript error. Does anyone know a solution for this problem? I doesn't happen in the earlier version of phpMyAdmin .. just this later version. Any help would be great! Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mail()
I'm trying to run a mail function .. the program is running, but I'm not getting the email. Here is the code .. any one have any ideas? $toaddress = $friendemail; $subject = A message from .$fromname..; $mailcontent = Here's a special message from a friend .Your friend, .$fromname. at .$fromemail. writes:\n\n ..$message.; $fromaddress = $fromemail; mail($fromemail, $subject, $mailcontent, $fromaddress); I talked with my ISP and the sendmail_path is set up correctly I know it's not DB related, but I didn't know where else to turn. Thanks for any help you can provide. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] results on multiple pages
I am retrieve records from my MySQL table and I want to display the results 12 per page along with allow for a sort. I was just send a query to the table with a limit each time, but it didn't sort all the records, so I need to load all the results into a table to sort then display. Here is what I have for code ?php Mysql_connect(localhost,user,pass); mysql_select_db(countryloft); if (!$nextpg) { $i = 0; } else { $i = $i + 12; } $prodTbl = mysql_query(select * FROM countryloft WHERE category LIKE '%folk%' ORDER BY displayorder); $num_results = mysql_num_rows($prodTbl); $itemsPerPage = 12; echo table; $mycolumn = 1; $maxcolumn = 3; //loop table until end of results for ($i=$i; $i $itemsPerPage; $i++) { $row = mysql_fetch_array($prodTbl); echo td width=200 align=centera href=productinfo.php?prodID=.$row['record'].img src=http://www.thecountryloft.com/countryloft/yellowpics/.$row['image3']. border=0; echo brfont size=2.$row['title']./font; echo brfont size=2.$row['price']./font/td\n; if ($mycolumn == $maxcolumn) { echo /tr; } $mycolumn = $mycolumn + 1; if ($mycolumn $maxcolumn) { $mycolumn = 1; } } echo /table\n; echo a href=$PHP_SELF?i=$inextpg=yesNext Page/a; ? Any help would be great!! Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sessions
Thanks .. it is the wonders of open source. Are sessions required for a shopping basket? I don't want people to login, just order and go. Matt Stewart [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... i'd imagine there'll be a decent one on phpbuilder, or devshed, or webmonkey, or phpwizard if not, there's plenty of source code for existing shopping cart systems around these sites, so you can take them and rewrite it to your liking and design! the wonders of open source! -Original Message- From: James Kupernik [mailto:[EMAIL PROTECTED]] Sent: 23 May 2002 15:48 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] sessions Do you know where there is any good tutorials on creating a php shopping cart? I enabled the auto.session_start .. then took out session_start .. that seemed to do the trick. Any help on php shopping carts would be great! Thanks Matt Stewart [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... sent the session_start(); before any output, that should do it... -Original Message----- From: James Kupernik [mailto:[EMAIL PROTECTED]] Sent: 23 May 2002 15:38 To: [EMAIL PROTECTED] Subject: [PHP-DB] sessions I get this error when I try to start a session (I'm trying to create a shopping cart). Warning: Cannot send session cache limiter - headers already sent Thanks -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] foreach
I'm using this: if($save) { foreach ($cart as $record = $qty) { if($$record==0) unset($cart[$record]); else $cart[$record] = $$record; } $totalPrice = calculate_price($cart); $items = calculate_items($cart); } and I'm getting this: Warning: Invalid argument supplied for foreach() Why is that? Any help is greatly appriciated! Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] foreach
yes because I'm using it in another foreach, but this one doesn't want to work. Pierre-Alain Joye [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Mon, 3 Jun 2002 12:48:47 -0400 James Kupernik [EMAIL PROTECTED] wrote: and I'm getting this: Warning: Invalid argument supplied for foreach() Why is that? are you sure $cart is an array ? pa -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] foreach
found my problem .. thank you for your help! You guy put me in the right direction to solve this problem. Thanks!! Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Tuesday 04 June 2002 00:52, James Kupernik wrote: yes because I'm using it in another foreach, but this one doesn't want to work. Pierre-Alain Joye [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Mon, 3 Jun 2002 12:48:47 -0400 James Kupernik [EMAIL PROTECTED] wrote: and I'm getting this: Warning: Invalid argument supplied for foreach() Why is that? are you sure $cart is an array ? Try: print $cart; // would show 'Array' if array Are you trying to use this in a function? If so have you declared it global? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The first 90% of a project takes 90% of the time, the last 10% takes the other 90% of the time. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] values across functions
I have a file, it's a shopping cart. Currently is contains all the fuctions required in the cart, including the shipping and billing form. It won't take the values from the shipping form and use them in the functions that calculate the tax and S H. Why would this be? I've gotten other variables to transfer, just not these. Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] case
I want to test a value that was typed into a form, but I don't want the case to be a problem, how can I get around this?? This is what I have now: function calculate_tax($OrderedByState,$ShipState) { global $totalPrice; //tax calculation $taxRate = 0.05; if ($OrderedByState==MA $ShipState==MA) { $taxcost=$taxRate*$totalPrice; } else if ($OrderedByState==MA $ShipName != $ShipState!=MA) { $taxcost= 0.00; } else if ($OrderedByState==MA $ShipState==) { $taxcost=$taxRate*$totalPrice; } else if ($ShipState==MA) { $taxcost=$taxRate*$totalPrice; } else { $taxcost= 0.00; } return $taxcost; } Thanks for any help! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: case
PLEASE IGNORE! Thanks! James Kupernik [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I want to test a value that was typed into a form, but I don't want the case to be a problem, how can I get around this?? This is what I have now: function calculate_tax($OrderedByState,$ShipState) { global $totalPrice; //tax calculation $taxRate = 0.05; if ($OrderedByState==MA $ShipState==MA) { $taxcost=$taxRate*$totalPrice; } else if ($OrderedByState==MA $ShipName != $ShipState!=MA) { $taxcost= 0.00; } else if ($OrderedByState==MA $ShipState==) { $taxcost=$taxRate*$totalPrice; } else if ($ShipState==MA) { $taxcost=$taxRate*$totalPrice; } else { $taxcost= 0.00; } return $taxcost; } Thanks for any help! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php