Jump to content

kanikilu

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling
  • Location
    Dallas, TX

kanikilu's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I don't know if it matters, but you don't need the doctype, head and other HTML markup in your connect.php or process.php files. I see you have it trying to echo "connected!" in your connect.php file. Does that even show up? If not, I think maybe there is a configuration problem on the server. Are you sure PHP is even working correctly? If not, try a very simple example. Create a new file called phpinfo.php and put the following in there: <?php phpinfo(); ?> Save and upload it, then browse to that file on your server.
  2. My regular expression experience leaves something to be desired, but I think something like this might work (or set you on the path towards something that works)... $in_file = file('original.txt'); $out_file = 'replace.txt'; $pattern = '/VALUES \(.*[0-9],\s/'; $replace = "VALUES ("; $newTxt = array(); foreach($in_file as $line) { $newTxt[] = preg_replace($pattern, $replace, $line); } file_put_contents($out_file, $newTxt);
  3. Not positive on this, but try: $order_detail="INSERT INTO detail_table (`unique_id`, `order_id`, `customer_name`, `customer_login_id`, `order_date`, `product_name`, `quantity`, `shipping`, `price`, `total_cost`, `compatibility`) VALUES ('" . $unique_id . "', '" . $order_id . "', '" . $username . "', '" . $log_id . "', '" . $shop_date . "', '" . $row['product_name'] . "', '" . $row['quantity'] . "', '" . $row['shipping_cost'] . "', '" . $row['price'] . "', '" . $row['total_cost'] . "', '" . $row['compatibility'] . "')"; I'd think you could just escape those quotes instead of concatenating, but, it probably doesn't make much difference...
  4. It's been a while since I've needed to use sessions, but I think they may be one way to go about accomplishing this. http://us.php.net/manual/en/function.session-start.php Something like: session_start(); $_SESSION['aff'] = ($_GET['aff'] ? $_GET['aff'] : FALSE); Now you can check for that session variable on each page and keep track of it, without having to append a query string to every URL.
  5. <?php $lines = file('DATfiles/text.dat'); $firstLine = explode(' ', $lines[0]); $first10words = array_slice($firstLine, 0, 10); $string = implode(' ', $first10words); echo $string; ?> This works, but there may be (probably is) a better way to do this...I'm just picking up PHP after a couple years, so I'm a little rusty. Wasn't sure if you needed to account for punctuation or not, but that can handled pretty easily with something like str_replace().
  6. This is a quick-n-dirty alternative I came up with: <?php $num = range(0,9); // 0-9 $ascii = range(65,90); // ASCII codes for A-Z foreach ($ascii as $key => $value) { $char[$key] = chr($value); } $mixed = array_merge($num, $char); $rand_keys = array_rand($mixed, 6); foreach ($rand_keys as $value) { $charID .= $mixed[$value]; } echo $charID; ?> Note, this won't necessarily give you numbers AND alpha characters all the time, I tried it several times and twice there were all alpha's, and the others were a mix of both...
  7. [code]function URLforwardProcessingAfterClick() { if (contact) {   includingMain = include "mailFormInput.php";   else if(aboutUs) {       includingMain = include "aboutUs.php";   else if(sitemap) {       includingMain = include "sitemap.php";   else if(hireMe) {       includingMain = include "hireMe.php";   else if(searching) {       includingMain = include "searching.php"; }}}}} }[/code] If that's supposed to be PHP, you've got some problems. First, it looks like you are trying to use variables (contact, includingMain, aboutUs, etc.) however you didn't preceed them with "$". Next, each of those else if's need to be closed of individually instead of all at the same time like you have it. For example (I'm assuming that those are variables here): [code]if ($contact) {   $includingMain = include "mailFormInput.php";   else if($aboutUs) {         $includingMain = include "aboutUs.php";   } else if($sitemap) {         $includingMain = include "sitemap.php";   } else if($hireMe) {         $includingMain = include "hireMe.php";   } else if($searching) {         $includingMain = include "searching.php";   } }[/code] ...and if that's not supposed to be PHP, I think you have wrong forum ;)
  8. You'd probably get a better response here if you actually asked a question or told us what was wrong with the code you posted...
  9. Very basic example: [code]<?php $message = 'http://testing.testing.com/Testing_testing_testing_testing/test_test_test_test/testing_testing_testing'; $max_length = 50; if (strlen($message) > $max_length) {   $part1 = substr($message, 0, (($max_length / 2) - 1));   $part2 = substr($message, -10);   $url = $part1 . '...' . $part2; } else {   $url = $message; }   echo "<a href='$message'>$url</a>"; ?>[/code]
  10. CSV stands for comma seperated values. It's a flat-file database format. [a href=\"http://en.wikipedia.org/wiki/Comma-separated_values\" target=\"_blank\"]http://en.wikipedia.org/wiki/Comma-separated_values[/a] In what way exactly are you not understanding how to use PHP to interact CSV files?
  11. How is your site setup in terms of directory structure? Perhaps try using the absolute path. If your [i]if[/i] statements always seem to fail, you could also try to just echo out $_SERVER['PHP_SELF'] somewhere outside your if's just to see what you are getting... --EDIT-- Nevermind, then, glad that worked, I was running out of ideas ;-)
  12. Ok, I just always check that kind of stuff first. I don't see anything obviously wrong with your code. Are you able to turn on display_errors in the php.ini if it's not already? Can you access the httpd error log? Sometimes those provide a little help... Also, I don't think you need a "\r\n" after the From header, since there are no additional headers being sent.
  13. This probably doesn't have anything to do with your problem, but why are you escaping forward slashes? [code]if($_SERVER['PHP_SELF'] == "\/index.php")[/code] Shouldn't that simply be: [code]if($_SERVER['PHP_SELF'] == "/index.php")[/code]?
  14. I guess the first thing I'd do (if you haven't already) is print_r($_POST); to be sure that you actually have any data to send. Then take it from there...
  15. How is the date stored in the database...that is, what format (e.g.: unix timestamp)?
×
×
  • 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.