Jump to content

Ken2k7

Members
  • Posts

    5,196
  • Joined

  • Last visited

    Never

Everything posted by Ken2k7

  1. They shouldn't have to input it. If that data ever gets out, say goodbye to everything.
  2. Please read the part in red. You forgot the <tr>.
  3. I can't really tell with just those lines of code, but take a look at mysql_real_escape_string to secure inputs if you aren't already using it.
  4. That's basically 1 row, 1 column as opposed to 1 row, 3 columns. Just remove all those counters you have there for determining when to close and open a <tr> tag and just open and close it on the echo.
  5. $surname = $_GET['surname']; Or better yet: $surname = filter_input(INPUT_GET, 'surname'); Like that. But is there something wrong with $_GET or filter_input? If you need to keep data across different files, use $_SESSION.
  6. NO! Why give out your database connection data? What's the point of it?
  7. You have an extra $ in your variables. Also, you can insert multiple entries like this: INSERT INTO mytable (desc, model) VALUES ('desc1', 'model1'), ('desc2', 'model2'); Add a comma and another set so you run 1 SQL instead of 10.
  8. That was confusing. Could you elaborate on that and or provide an example?
  9. He's right though. It was just funny to read that response to the OP's question because it didn't answer the question directly.
  10. I didn't say they have to be variables. If you have the loop, you can easily go through $_POST['txtDesc'+$i] to get the value so I have no idea why this is so complicated for you to understand.
  11. No; it shouldn't work. There is a missing parenthesis.
  12. 1. $csv is just a temp variable to store value. There's nothing special about $csv. 2. php.net is a great site. Please use it for any functions you don't understand. sprintf. It'll give you a much better explanation than what I can do. Plus, I don't like to repeat something that's already written somewhere. I'm a lazy typer. 3. Again, php.net - rtrim
  13. o.O huh? You get the values and put them into the query. I'm not understanding your question at all. You know that the fields are txtDesc#. The # part will be specified by $i. So you just fetch the values of those fields and put them into the query.
  14. lol
  15. Straight from the Forum Guidelines & Rules located here: http://www.phpfreaks.com/page/rules-and-terms-of-service
  16. The implementation is up to you. But I suggest you try to understand what I did rather than copy and paste. If you understood the concept, you wouldn't have that question.
  17. Try this SQL: SELECT ul.userid, ul.linkid, l.categoryid, l.label, l.icon, l.url FROM userlinks ul INNER JOIN links l ON (ul.linkid = l.linkid) WHERE ul.favourited = 'N'; Here are the results: mysql> SELECT ul.userid, ul.linkid, l.categoryid, l.icon, l.url -> FROM userlinks ul -> INNER JOIN links l -> ON (ul.linkid = l.linkid) -> WHERE ul.favourited = 'N'; +--------+--------+------------+----------+-------------------------+ | userid | linkid | categoryid | icon | url | +--------+--------+------------+----------+-------------------------+ | 1 | 62 | 1 | sky | http://www.sky.com | | 1 | 63 | 1 | google | http://www.google.co.uk | | 1 | 65 | 1 | play | http://www.play.com | | 2 | 64 | 2 | facebook | http://www.facebook.com | | 2 | 65 | 1 | play | http://www.play.com | +--------+--------+------------+----------+-------------------------+ 5 rows in set (0.01 sec)
  18. $csv = ''; foreach ($friends as $key => $value) { if (array_key_exists('id', $value)) $csv .= sprintf('%d,', $value['id']); } $csv = rtrim(',');
  19. Data Grid isn't bind to any one specific language. But there's definitely a way to do that. One way would be to give them separate names like: txtDec1, txtDec2, etc. You can initially set up a table with 10 rows, all editable fields. Then have a button to add more if need be. Use JavaScript to save how many rows are added + the original 10. Then upon submit, have JavaScript fill a hidden field with that count and have PHP do a loop through them all.
  20. I have already explained this. Please refer here - http://www.phpfreaks.com/forums/index.php/topic,296307.msg1403392.html#msg1403392 It's not that your AND statement is NOT applied. It is, but just in the wrong order. Like I said in the other topic, AND has precedence over OR. So because of that, your SQL will first match this: towncity= 'Maidenhead' and fname = '$search_text' So it'll try to find where towncity is equal to Maidenhead and fname is equal to [/tt]$search_text[/tt]. If not matches are found there, it will then continue with OR. So I'll break it down: 1. towncity= 'Maidenhead' and fname = '$search_text' 2. or organisationname ='$search_text' 3. or surname ='$search_text' That's not the order you want. In fact, you want: 1. towncity= 'Maidenhead' and 2. fname = '$search_text' or organisationname ='$search_text' or surname ='$search_text' So to make sure OR runs first, you need to enclosed them in parentheses. It's like in math: [tex]5+4\cdot6=29[/tex] That's because multiplication takes precedence over addition. [tex](5+4)\cdot6=54[/tex] Parentheses takes precedence over multiplication. Same logic here. I hope this explains the issue clearly. All the best, Ken
  21. So you want something similar to a Data Grid?
  22. The error I see is that you messed up string concatenation in a few places. Though, I don't know why that would throw a 500 error. Also, read the rules about proper ways to post code. There's a link in the red text that displays before you post.
  23. Unless you defined the function, it's mysql_query not mysqlquery. Try Google or php.net. =]
  24. That would retrieve the first two results. I think you misread. SELECT * FROM (SELECT * FROM table ORDER BY id DESC LIMIT 2) t ORDER BY id ASC;
  25. How are they calling your PHP file and sending the XML file?
×
×
  • 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.