Jump to content

Javizy

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Everything posted by Javizy

  1. [!--quoteo(post=362093:date=Apr 6 2006, 01:52 AM:name=desithugg)--][div class=\'quotetop\']QUOTE(desithugg @ Apr 6 2006, 01:52 AM) [snapback]362093[/snapback][/div][div class=\'quotemain\'][!--quotec--] lol back again needed a lil help okay i succefully got the data from the multiple select option form to insert but not i need to know how to updat two or more rows at the same time for example Username ID status ___________________________ saad 1 admin alex 2 n00b KB 3 n00b darkness 4 member and i want to update the 'id' colum for user both saad and darkness <?php $result = mysql_query("UPDATE status SET id= id + 1 WHERE username='saad'") or die(mysql_error()); ?> but this would only update for 1 user ive tried " AND 'darkness" " , 'darkness" " AND username = 'darkness' etcc.. and lots of other stuff can som1 help me with this if its possiable and i need it so it can update unlimited amount of rows [/quote] You would use OR instead of AND, or a shortened version IN (as I was told earlier). [code]UPDATE status SET id = id + 1 WHERE username IN ('saad', 'alex', 'KB' ); [/code]
  2. Javizy

    firefox <> IE

    [!--quoteo(post=361949:date=Apr 5 2006, 03:12 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Apr 5 2006, 03:12 PM) [snapback]361949[/snapback][/div][div class=\'quotemain\'][!--quotec--] not only that, but if your doctype is HTML 4, you may actually need to have border='0' within your defining <table> tag. this tends to help quite a bit. i've gotten into the habit of declaring all tables that i'm going to style with CSS like this: [code] <table border='0' cellpadding='0' cellspacing='0' class='className'> [/code] this way, you basically are stripping all default attributes from the browser, and then you're free to add your CSS how you see fit. [/quote] That's a good tip actually. I always do it with cellpadding and cellspacing. Haven't had any issues with borders but I'll add that to the list in future.
  3. That's a lot better, thanks.
  4. Thanks for the replies guys. My first idea was to get a list of product_ids and then query each one for the options but obviously that amount of queries is ridiculous. I think I'll go with wickning's suggestion of getting a list of product_ids and then getting the options in one query with something like WHERE product_id = xx OR product_id = xx, etc. I dunno why I didn't think of that, I thought it might be possible with one query (probably would be with an ORDB). Thanks again for the help, after I've done this the shop section is pretty much finished :-D
  5. Javizy

    firefox <> IE

    Have you tried just using border: 0; instead of specifying a colour and what not?
  6. I'm making a little shop site and I'm having a hard time adding product options, like size. I added a ProductOption table which is related to Product, and has fields id, product_id, option_name, price. Design wise it seems logical to me, but retrieving and converting the data into a php object isn't so straightforward. Basically I have a getProducts function that creates an array of Product objects. The Product object has an array of Options as an instance variable. I can't think of an efficient way of querying the data. I need the Product table fields, along with all ProductOptions associated with that product_id (may be 1 or more). Has anybody implemented a cart with product options before? If this makes sense to anyone I'd much appreciate some insight, because I'm totally missing something here.
  7. [!--quoteo(post=361161:date=Apr 3 2006, 10:30 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 3 2006, 10:30 AM) [snapback]361161[/snapback][/div][div class=\'quotemain\'][!--quotec--] Not much you can do about that -- same thing could happen if the PayPal script happens to abort before it run the callback script too! The only way to "handle" this would be to mark has_paid as "in process" so that you can at least identify these aborted situation (to distinguish it from "N"). [/quote] What I mean is, if the database can't be accessed for some reason or another, the fact that IPN was sent won't be recorded, even if the order is completely verified. I'm thinking of recording such things in an XML file, with a report to go along with it that has an option to change has_paid to Y for that order after verification.
  8. Sorry ignore my post, I was explaining how to use single select boxes.
  9. Apparently it's possible to simulate a POST form using cURL, but I don't think this will be an option as my web host doesn't support it :-\ With the updating 'has_paid' to 'Y' when IPN is verified, what if there is an error like 'too many connections' or something similar? The user will have transferred the money, but it won't be recorded in the Orders table. I really don't like putting anything down to chance when it comes to money.
  10. [!--quoteo(post=360970:date=Apr 2 2006, 09:48 PM:name=desithugg)--][div class=\'quotetop\']QUOTE(desithugg @ Apr 2 2006, 09:48 PM) [snapback]360970[/snapback][/div][div class=\'quotemain\'][!--quotec--] inserting data into db from a multiple option form like <form action="trade1.php" method="post" multiple='multiple'> <select name="ids1" multiple="multiple" size="20"> <option value='"1' selected>number 1</option> <option value='2' selected>number 2</option> </select> </form> [/quote] Even though it has multiple options, only one name/value pair will be sent to trade1.php. So simply you would do: [code]/* Get value */ $ids1 = $_POST['ids1']; /* Insert into DB */ $conn = mysql_connect($dbHost, $user, $password); mysql_select_db($database) or die("Unable to select DB " . $database); query("INSERT INTO myTable (isd1) VALUES ( " . $ids1 . ");";[/code]
  11. [!--quoteo(post=360926:date=Apr 2 2006, 07:01 PM:name=wickning1)--][div class=\'quotetop\']QUOTE(wickning1 @ Apr 2 2006, 07:01 PM) [snapback]360926[/snapback][/div][div class=\'quotemain\'][!--quotec--] I don't think you can redirect to paypal with POST data. You could try an http redirect with GET data, if it isn't a lot of data. Other than that, you'd just have to lengthen your checkout and make them click through one more page. [/quote] Yeah I don't think there's a way around forms with PayPal, but it's possible to encrypt them so it should okay. So after clicking Checkout, the user is taken to a page that adds the unpaid Order row and has a 'Continue with payment' option? I don't like the idea of doing that because of users not continuing and me being left with a redundant row in the table, but it would work. I just wondered how other people do this, I don't want to be reinventing the wheel in areas that could lose people money if not done right :-s
  12. Is the user ID an integer? You have it wrapped in inverted commas, so that would cause a problem.
  13. I'm making a little site that sells photo prints and uses PayPal as a payment gateway. The problem I have is with making orders reliable. I was thinking of something like follows for the table structure: [img src=\"http://homepage.ntlworld.com/thebomb/pics/erd.jpg\" border=\"0\" alt=\"IPB Image\" /] The N:M would create a table OrderItem. Here's the flow of the system: [!--fonto:Courier New--][span style=\"font-family:Courier New\"][!--/fonto--]User adds items to basket User clicks 'checkout' PayPal processes payment PayPal sends data via IPN to one of my scripts[!--fontc--][/span][!--/fontc--] It's necessary to store order information before the IPN stage for verification and I can't think of a good way of doing this. The checkout button submits a form to PayPal with the order data, so where is there time to add to the Order table? What I would prefer would be when the user clicks checkout they're forwarded to a script that makes an Order row with field 'has_paid' set to 'N' and then sends them to the PayPal page along with the post data, allowing the IPN script to set 'has_paid' to 'Y' if all is valid. However, this doesn't seem to be possible without using a form. Any help/suggestions would be much appreciated.
  14. I'm currently setting up a little shop that uses PayPal as a payment system. I've searched online and on the board and found enough information to get going. The way certain things are done worry me though. Any help with any of these would be appreciated. 1. It seems as though the payment is completed before the user clicks the 'continue' button which leads back to my site. If for some reason the user did not make it back to the site, the database cannot be effectively updated in regards to the order. This seems to go against the concept of a transaction to me. 2. Sending data initially to PayPal through hidden form variables. I've read this is not a good way to do it, and I don't like the idea of anyone being able to view this information. Would it be better to send the vars through a socket (which is the only other post data solution I've come across) in some sort of Order class? 3. I've written a Basket class with a getTotal() function. I could send this to PayPal, but then the entire basket is counted as a single item, and this might confuse users. Is there a way around this? These are my three main concerns (particularly #1). If anyone is familiar with this stuff, are there any other security considerations I should be making? This is the first time I've done anything involved a payment system, and I want it to be as safe as possible. Thanks in advance for any help on this.
  15. I did this before with jsp by keeping an array of validated values (blank strings for invalid values) and printing them in the necessary input elements. You can easily extend this to highlight the invalid fields by changing the CSS class of the input element. [code]$values = array("name" => "Jiminy", "address" => "", "Post Code" => "RM7 4RT"); <input type="text" value="<?echo $values["name"]?>" />[/code] I'm not sure for what purpose you need them, but I just wanted to make it more convenient for users who made a mistake.
  16. [!--quoteo(post=359697:date=Mar 29 2006, 05:28 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 29 2006, 05:28 PM) [snapback]359697[/snapback][/div][div class=\'quotemain\'][!--quotec--] Technically, you don't even have to close the mysql connection, but your second method is definately the better of the two. There is no problem with leaving the connection open for the entire page. Subsequent query calls are just going to reuse the existing connection. [/quote] What I mean is, I want all the connection stuff to be taken care of by the ShopManager\Connection class, keeping the shop.php and basket.php pages as simple (logic wise) as possible. So that any pages that need to use the ShopManager don't have to worry about connections.
  17. I'm developing a ShopManager class which uses a Basket class to store items. The ShopManager class needs to perform certain database actions like getProducts, getProduct, and so on. I have a simple Connection class which has functions executeQuery(), and close(). Products and basket items are displayed in files shop.php and basket.php. Originally I was coding as follows in the ShopManager functions [code]$conn = new Connection(); /* Makes a connection automatically */ $conn->executeQuery($sql); $conn->close();[/code] However, several function calls may be required per php page. Since I'm not able to use pconnect this is a problem; I don't want to incurr multiple connection costs on a single page load. So I coded shop.php like follows: [code]$conn = new Connection(); $manager->getProducts(); $manager->basket->addItem(); $conn->close();[/code] Having connection logic in the "view" pages is going to make things less maintainable, reusable, etc, so I would appreciate any alternative suggestions. On a side note, could anyone explain access modifiers with PHP4? Use of private, public, etc doesn't seem to be supported until v5.
  18. This is a very simple problem so I don't think it was necessary to post your entire source. Anyway, you'll notice if you just use # for the href of an anchor it takes you to the top, something like #top is unnecessary.
  19. [!--quoteo(post=357970:date=Mar 24 2006, 05:08 PM:name=Gast)--][div class=\'quotetop\']QUOTE(Gast @ Mar 24 2006, 05:08 PM) [snapback]357970[/snapback][/div][div class=\'quotemain\'][!--quotec--] Yes, but it will probably not validate. [/quote] Why don't you have the buttons like [code]<input type="submit" name="submit" value="submit" /> <input type="submit" name="submit" value="cancel" />[/code] Then on the page the form usually leads to, check the submit value first off and redirect if it's cancel.
  20. <select style="height:20px"> should do it, or you could use a class to keep styles out of the HTML.
  21. That's strange. Maybe it has something to do with the inclusion of the </style> tag at the end since that'll kinda mess up your DOM tree.
  22. [!--quoteo(post=356447:date=Mar 19 2006, 06:50 PM:name=earl_dc10)--][div class=\'quotetop\']QUOTE(earl_dc10 @ Mar 19 2006, 06:50 PM) [snapback]356447[/snapback][/div][div class=\'quotemain\'][!--quotec--] I figured it out, apparently there's an html tag called valign, it conveniently does things like this [/quote] So you meant you wanted the sub tables aligned to the top of the outer table? Nowadays it's more common to use CSS than inline styles. You could achieve the same thing with something like: [code] td { vertical-align: top; } [/code]
  23. I've never come across a situation where I've needed to do something like that, and as far as I know it's not possible. I would do it like this... [code] table.parent { } table.parent td {   /* set defaults */ } table.parent td.1 {   /* set specific 1 */ } table.parent td.2 {   /* set specific 2 */ } [/code]
  24. It's DHTML. You'd create a js function that would be called when there's a new message, and this would position the "window" and make it visible. You'd need to use mouse capture to allow it to be moved. Also, you'd need a "close" button that would make it invisible again. Without the mouse capture it's really simple, and basically revolves around myWindowElement.style.visibility = "visible"
  25. What I posted [i]does[/i] work in both IE and FF with a valid XHTML 1.0 Transitional document. I also just validated my CSS file with no errors. As far as I know it's tables that don't a height attribute, but it's perfectly valid to specify a height with CSS. You can see an example of what I mean [a href=\"http://james-kirk.co.uk/rrp\" target=\"_blank\"]here[/a] I wouldn't recommend multiple CSS files. That makes the whole cascading aspect of stylesheets pretty useless, makes extra work for yourself, and generally complicates things. If you really can't get it to work I'd suggest rethinking your design rather than resorting to that.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.