Jump to content

Canman2005

Members
  • Posts

    669
  • Joined

  • Last visited

    Never

Everything posted by Canman2005

  1. thanks all, managed to crack it, stupid mistake I made
  2. Hi I have a HTML form which posts to a PHP script. On the PHP script I have $_SESSION['mystuff'][] = array('idnumber'=>''.$_SESSION['myID'].'','titlename'=>''.$_POST['productname'].''); and basically this array builds up each time the form is submitted I then output this data using $num=0; foreach($_SESSION['mystuff'] as $mystuffvals) { print $_SESSION['mystuff'][$num]['titlename']; print "<br>" $num = $num+1; } this all works fine, but I want to be able to add a "delete" link next to each one so that it can be removed. how possible is that? I did try adding <a href="?remove=<?php print $num; ?> under the bit of code print $_SESSION['mystuff'][$num]['titlename']; and then running something at the top of the page which looks like if(isset($_GET['remove'])) { unset($_SESSION['mystuff'][$_GET['remove']]); } ?> but that seems to unset random arrays and I can't think what could be wrong. Please help Thanks J
  3. Hi all I was recently contacted by a friend who is having SPAM issues, basically someone has managed to upload tons of crap files and also inserted eval(base64_decode("ZXJyb3Jfcm..... about 10 times into every PHP page on the server, and doing a search reveals 1001 instances of this eval(base64_decode("ZXJyb3Jfcm..... code. How could this have happened and what measures do we need to take to prevent this?
  4. Sorry, I would say a SELECT query to grab the title, it's what I would use
  5. Wonder if someone can advise I have a script which runs on a CRON job, so every hour a script is activated. When the script runs, it INSERTS between 1 and 12 records into a database table, works a charm so far. When each QUERY is run on the script, it grabs the last ID number that was INSERTED and that is entered into another table, so if my script INSERTS a new row with an ID of 34877, then the ID number 34877 is entered into another database table. To grab the last ID number, I have always used $last_id = mysql_insert_id(); as seen on http://php.net/manual/en/function.mysql-insert-id.php which has always worked great. I now have to create another script on a CRON job, which does a similar TASK, it INSERTS a record into the same database and then grabs the last ID number. The plan is to roll about 150 of these script out, so each one is INSERTING data, and grabbing the last ID of the row just created. By 2015, they plan to have several thousand of these scripts, all being run at the same time. This is basically part of a bigger system and this is the method in which the 3rd party suppliers need data handled, so I have no option. My question is, if I have tons of scripts INSERTING data to the same database table and each time an INSERT is done, the last ID is grabbed, can PHP get overloaded and confused and then end up returning the wrong ID number of the row INSERTED. Or if I put $last_id = mysql_insert_id(); straight after each INSERT, then is it gurenteed that the right ID number is returned. Just concerned the QUERIES will end up in a que and incorrect ID numbers will be returned. Basically, is $last_id = mysql_insert_id(); flawless in getting the ID number of the row just INSERTED? Cheers everyone
  6. Hello all I wonder if someone can give me some advice, sorry if this is in the wrong place, I couldn't seem to find the right forum to put it in. I am helping a friend to build a PC support ticket system for use by around 100 support groups, 50 schools and 20 universities, over time a total potential student population of between 300,000 and 800,000 might use it. Of course they as not all going to be accessing the system at once, but of something major happens, there could be almost half the students submitting a ticket at once, but I want to build it in a way that it could cope with 1,000,000 users, I know server space maybe expensive and luckily I wont have to pickup the bill for that. So my questions are; [*]Can PHP handle this volume of traffic with multiple SELECTS, INSERTS etc [*]Can PHP ever crash due to overload or is it always the server which has the overload and crashes, if it's PHP, what can be done to stop that? [*]What would be the best way to hold user data? Is is best to spread the data over multiple tables [*]Is there anything I should consider in PHP when working out a viable system [*]Any advice on the type and level of server we should use I assume PHP would be the best to use as companies like Facebook seem to use PHP and they handle 500 millions users, so I guess it's stable enough. I guess Cloud hosting would be best to balance the load?? I was going to code this all myself over time and learn advanced PHP a bit more, is this a good idea or should I be learning using a framework like ZEND or something like Drupal? Thanks all
  7. Thanks Ken So if I don't use a WHERE clause, is there any way in which to get it to do something like a "loop". and go through each row and update with a different random code? Thanks
  8. Hi all I have the following simple code mysql_query("UPDATE `people` SET `access` = '".rand(11111,99999)."'"); But at the moment each row gets the same "rand()" code, is there anyway to assign each row a different "rand()"? Thanks
  9. thanks, that seemed to work great Just another question, but is it also possible to add something like that at the end of the QUERY, so adding JOIN t.things ON t.userid = p.id to the end of SELECT p.id, p.name, p.topic FROM people p WHERE p.type = 'Math'; so I guess it would be something like SELECT p.id, p.name, p.topic FROM people p (p.topic = 'yesterday', JOIN t.things ON t.userid = p.id) WHERE p.type = 'Math'; Thanks very much
  10. Hi all I wonder if someone can help. Is it possible to add an "if" statement into a QUERY? For example, I have SELECT p.id, p.name, p.topic FROM people p WHERE p.type = 'Math'; But I want to add if(p.topic == 'today') { p.date } to the end of SELECT p.id, p.name, p.topic so it would look something like SELECT p.id, p.name, p.topic, if(p.topic == 'today') { p.date } FROM people p WHERE p.type = 'Math'; So in real terms it would end up looking like either SELECT p.id, p.name, p.topic FROM people p WHERE p.type = 'Math'; or if topic equaled "today" then it would use SELECT p.id, p.name, p.topic,p.date FROM people p WHERE p.type = 'Math'; I know the above is not possible, but what would I change it to if at all possible. Thanks all Ed
  11. Hi all Any ideas why my QUERY SELECT i.id, i.date, (SELECT COUNT(*) FROM `sold` WHERE item_id = i.id) AS total FROM items i WHERE total > 1 does not work? it's being a nightmare and cannot figure out what its problem is Thanks Dave
  12. Hi all Just wondering if someone can help me with with my SELECT query SELECT b.name, (SELECT value FROM options WHERE id = bc.level1) AS l1, (SELECT value FROM options WHERE id = bc.level2) AS l2, (SELECT value FROM options WHERE id = bc.level3) AS l3 FROM items b LEFT JOIN cats bc ON b.id = bc.item_id WHERE l3 = 'Apple' AND l3 = 'iPod' AND l3 = 'Touch' as I keep getting a #1054 - Unknown column 'l3' in 'where clause' But I cannot figure it out Any help would be great Thanks
  13. Could you help a little more? I've tried so many options but none seem to work thanks
  14. HI all I wonder if you can help. I have 2 database tables, which look like; ---products--- `id`,`title`,`price` 1 ipod 9.99 2 mp3 99.99 ---archive--- `id`,`product_id`,`price` 1 1 19.99 2 1 5.00 3 2 15.00 The first table `products` shows my items for sale ------------ The second table `archive` shows what the products previous prices were, so your see that I have a field called `product_id`, and in that field, two of the rows are '1', so that related to row 1 of the `products` table (ipod) and the other rows values is '2', so that is related to row 2 in the `products` table (mp3). This basically stores the past prices of products, so that shows that the; 'ipod' was at somepoint in the past 19.99 and also 5.00, and the; 'mp3' at somepoint in the past was 15.00 ------------ Ok, I have a simple QUERY at the moment which looks like SELECT p.title, p.price FROM products p WHERE p.title = $_GET['q'] This returns ipod 9.99 mp3 99.99 My question is, how can I extend my SELECT QUERY but add to the WHERE statement something which would also return any rows which have been more expensive in the past than they currently are, so I guess that would need to check the `archive` table to find the prices of the products in the past. So with my data "mp3" would not be returned, as it is currently 99.99 and in the past it was 15.00, so its not been reduced in price at anytime "ipod" would be returned though, as it is currently 9.99 and in the past it was 19.99, so that shows it was reduced in price. Can anyone help? Been working all night to try and figure out and going to jump out the window at somepoint LOL Thanks everyone Dave
  15. Hi all I have the following code <select name="items[]" onChange="scriptloader(content.php?thisid='+this.value,'loadingarea');"> <option value="23">Apple</option> <option value="11">Microsoft</option> <option value="4">Google</option> </select> <span id="loadingarea"></span> Basically when something is selected from the drop down list, it passes the selected value through to a script and loads it within the "loadingarea" SPAN tags. So for example, if Microsoft is selected, then it loads the URL content.php?thisid=11 Into the "loadingarea" SPAN tags. This all works fine. My problem is that I have lots of the above code on one page, so my page can look like <select name="items[]" onChange="scriptloader(content.php?thisid='+this.value,'loadingarea');"> <option value="23">Apple</option> <option value="11">Microsoft</option> <option value="4">Google</option> </select> <span id="loadingarea"></span> <select name="items[]" onChange="scriptloader(content.php?thisid='+this.value,'loadingarea');"> <option value="23">Apple</option> <option value="11">Microsoft</option> <option value="4">Google</option> </select> <span id="loadingarea"></span> <select name="items[]" onChange="scriptloader(content.php?thisid='+this.value,'loadingarea');"> <option value="23">Apple</option> <option value="11">Microsoft</option> <option value="4">Google</option> </select> <span id="loadingarea"></span> Basically I have a script to duplicate the block of code, so that multiple drop downs can be added to the same page. The problem is, that because I sometimes have multiples of this block of this code, when I select something from the 2nd or 3rd drop down list, it loads their URL into the 1st "loadingarea" SPAN tag. Is there a way to tell scriptloader(content.php?thisid='+this.value,'loadingarea') that it should be loading its content into the SPAN tag below the drop down that is currently being selected from? If that makes any sense Been trying different options all day, and cannot find a solution. Please help Thanks all Dave
  16. thanks man, that's a great help, ill have a try
×
×
  • 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.