Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. I am still quite confused. What items are stored in the database, and why do you want the links? All this information is relevant to making a suitable database design. Databases are not designed to make "check the entire database" easy to do. They are designed to make operations like "Check column X of table Y" easy and fast. So if you could store all your items in a single table, with a column to identify what type they are, you might find it easier to search them.
  2. That is very unusual database design. Was it designed by you or your friend? And what tables do you have in the database?
  3. Ok, the important part of what they said is "the files listed have been modified over FTP". That means access was made using your username and password. Have you got antivirus software installed? If not, you should install that. You should also make sure your computer has all the automatic updates from Windows Update. If you have trouble cleaning the virus, it's best if you go to a forum that specializes in these things. And of course you should change your password Change it now, and then change it again after you're sure there's no viruses left on your computer.
  4. Yes, it looks like you've been hacked. Have you downloaded and installed any scripts on your website? Or any forum software, guestbook software, etc etc?
  5. Try this: echo $_SESSION['program32']['userId'] . " should have the value 2\n"; If you have multiple array elements then you can use foreach to go through each one in turn.
  6. Is this for processing domain names? strstr() cannot choose the second "." from the end. It matches simple string patterns only. An alternative is to explode() on ".", count() the number of items in the array, take the last two items from the array and implode() them again using ".". Or you can explode(), reverse the array, take the first two items, reverse again and then use implode(). That's not as fast but some people like that approach because there's no arithmetic Another approach is using a regexp, which is able to specify rules like "take the last two items seperated by dots". Also if you are processing domain names, be aware of issues with country level domain names. Some are two levels and some are three levels, and some countries even mix both two and three level.
  7. Yes you can use a variable in a table name but you should do it in one of these ways: $sqlTextBox1 = "UPDATE store_".$store_num."_inv SET serialStart = '$txtInput' WHERE lottoName = '$selectResult'"; $sqlTextBox1 = "UPDATE store_{$store_num}_inv SET serialStart = '$txtInput' WHERE lottoName = '$selectResult'"; The reason it won't work the same way as your other variables there is that the "_" character within the table name confuses php. The {} symbols protect the variable so it can be placed next to an underscore and not confuse php. BTW, having a table for each store number is almost certainly bad database design. It's usually better to have store number as a column in your table.
  8. Yep that's exactly it. Here's two examples: INSERT INTO table (textcol) values ('null') INSERT INTO table (textcol) values (null) The first query will insert the string 'null', the second will insert a null value. The difference is the quotes.
  9. The important thing here is the interface you're using to PG and how you pass data to it. And yep the string "null" is not null, it's the string "null". PHP's null is also not the same as postgres null, though they share some similarities. Anyway, how do you pass this data to postgres?
  10. Well if it's a market that you want the timestamp associated with, I would do something like this: ALTER TABLE markets ADD COLUMN last_mail_ts timestamp without time zone; Or you could make it with time zone if you prefer. To check if it's time for a mailout: SELECT market, now() - last_mail_ts > '7 days'::interval AS its_time FROM markets; Then each time you do a mailout: UPDATE markets SET last_mail_ts = now() WHERE market = 'foomarket'; The other table I was talking about is just for logging, in case you want to look back and ask "When did i send mail to foomarket?". It would be something like: CREATE TABLE market_email_log ( mail_ts timestamp without time zone not null default now(), market text not null, ); You might add a primary key or maybe additional information about what was mailed out.
  11. I would go with the timestamp option. More information is usually better. Then you can mail any market with a timestamp older than 7 days. Another thing I would consider is a table recording every batch of emails ever done. Are you using postgres?
  12. Well the problem with item_number is it doesn't uniquely identify an item. So the question is do you store your items as "widget|red" and "widget|green" or "widget" - "red" and "widget" - "green". The first option is using a combined key of item number and options. The second option would fit a 2 level array like this: $_SESSION[$_POST['item_number']][$_POST['options']] = ...; From a technical perspective, there's nothing wrong with using a long string as an array key.
  13. Thanks for posting the code. Does $pet_spa contain all of your data? And you want to keep calling strtok() to get more items until there's no more data? In that case you could do this. nclude 'petspainfo.php'; $breed = rtrim(strtok($pet_spa, " \n")); $appointment = rtrim(strtok(" \n")); $day = rtrim(strtok(" \n")); $time = rtrim(strtok(" \n")); $charge = rtrim(strtok(" \n")); printf ("%9s\n", "Breed App. Day Time Charge"); while($breed){ echo $breed, " "; echo $appointment, " "; echo $day, " "; echo $time, " "; echo "\$" . number_format ($charge,2); $breed = rtrim(strtok(" \n")); $appointment = rtrim(strtok(" \n")); $day = rtrim(strtok(" \n")); $time = rtrim(strtok(" \n")); $charge = rtrim(strtok(" \n")); } You might have some issues here - it depends on what the contents of $pet_spa actually is. I'm making a few assumptions about that. You can use "break" from inside the while loop and it ought to work. It won't work outside the while loop though, as there's nothing to break out of.
  14. I need to see the rest of your code to help you.
  15. It looks like it's not really item_number that defines an item, but "item_number + options". So you might use a combination of both as a key, for example: $key = $_POST['item_number'] . "|" . $_POST['options']; $_SESSION['items'][$key] = array($_POST['item_number'], $_POST['item_name'], $_POST['options'], $_POST['amount']); I've also added ['items'] into the session variable - the reason is that there may be a security issue by setting these items at the top level of $_SESSION. If someone sends an unexpected value for item_number they might be able to overwrite other entries in $_SESSION. If you know this won't be a problem then you can remove the ['items'].
  16. Based on the code you've posted, you don't need to use while. Just do the echos without while. If you have multiple lines to loop through, the while needs to go outside, somewhere in the code that you haven't posted.
  17. I don't think he wants the dollar sign escaped. He's substituting a site name into the explode calls so he can find the correct line in the file.
  18. Look for "javascript tutorial" or "javascript hide form elements" and you'll find some guides and sample code, as well as other people asking the same question as you are.
  19. You can choose a character which cannot appear in your site name, and "protect" your site name with it. For example, instead of $site-0*end$site you might use |$site|-0*end|$site| Then you explode on "|$site|" instead of just "$site" Or you could store your data like this: $site|counter Then you would explode on "|", and your results would be a site name and a counter. But then you need to find the correct line before exploding - it looks like your current code uses the explode itself to find the entry.
  20. You need to use javascript. If you also require information from the server when an option is selected then you need ajax, but from what you've said, you just need plain javascript. Keep in mind that values can still be submitted even if they are not visible.
  21. To narrow down the possibilities, do you get 0 sized session files with this code: <?php session_start(); $_SESSION['canyouseeme'] = true; ?> If it is an NT permission issue I can't help you.. hopefully someone else here can.
  22. $agentName = $row['AgentName']; $email = $row['email']; # <--- $empID = $ca; # vvvvvv if($row['Email'] == $email && $row['Position'] == "FLA" || $row['Position'] == "PRS" ) { I've marked two pieces of code here - one references $row['email'], the other $row['Email']. That looks sus to me. The lowercase one is probably correct. This may lead to the insert query not being executed at all. The other sus thing there is that you probably should write this: if($row['Email'] == $email && ($row['Position'] == "FLA" || $row['Position'] == "PRS" )) { With brackets to tell php exactly how you want that "and/or" to be interpreted.
  23. The following code? Being out of disk space is one cause of 0 sized files where there ought not to be 0 sized files.
  24. The equivalent of $a[key($a)] = addslashes($as); is $a[$k] = addslashes($as); I think what you need is this: while ($a = mysql_fetch_assoc($z)) { if (array_key_exists('user_id', $a)) { $a['user_id'] = ''; } foreach ($a as $k => $as) { $a[$k] = addslashes($as); } if ($c > 0) { $q .= ", "; } $q .= "('".implode(array_values($a),"','")."')"; $c++; } I've blanked the user_id value before doing the addslashes foreach. You could put that inside the loop like this if you wanted: if ($k == 'user_id') $a[$k] = ''; And I didn't edit any of your other code inside that loop - only the code that blanks user_id and calls addslashes(). BTW there is no need to use array_values() before calling implode(). You can pass $a directly.
  25. You can use var_dump() or print_r() to see the contents of the array. Then you can see what your extra array element is. I'm a bit suspicious about $a[key($a)] .. If that does what I think it does, you can do it more simply like this: foreach ($a as $k => $as) { ... And $k will be they key of the current item.
×
×
  • 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.