Jump to content

tetuanrp

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tetuanrp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ahh, think I found my answer. The LIKE statement which I've never really used: SELECT * FROM mycoupons WHERE deal_description LIKE '%my keyword%'; Sometimes it just takes a few Google searches Thx
  2. Hmm, didn't know about that one. Not sure if that would work as I have a long description, not really comma seperated: ie. Haystack is "This is my long string about colors including blue, green, red and yellow" I wanna search this string using MYSQL for "green". Using php I'd do a strpos, but with MYSQL don't think there's a function for that.
  3. I have a site with a ton of coupons. Each coupon is a row in the database, and has a deal_description for each coupon. Currently, if I want to search all of the deals, for a number of keywords, this is how I do it: Deal example (1 row of 10,000): "Basketball shoes 10 dollars off with coupon" Keywords I want to check against: "basketball, shoes" SQL QUERY ALL ROWS FOR LOOP FOR ARRAY OF KEYWORDS ('basketball','shoes') END LOOP END QUERY This causes a memory error with an array of over 2 items. Think the server can't handle 10,000 rows of coupons * an array w/ 5 items for example: 50,000 actions. Is there any way I can do a for loop like this?: FOR LOOP FOR ARRAY OF KEYWORDS ('basketball','shoes') SQL QUERY AGAINST DEAL_DESCTIPION FOR KEYWORD[$i] END QUERY END LOOP That would be much less intensive, although I don't think MYSQL has a Strpos function for me to check a string of text for a keyword. Thanks in advance.
  4. Got two scripts which I'm trying to combine. One which when run, takes my mysql db and dumps it into an excel sheet, then prompts the browser to download. The other is your basic mail() script. I would like to combine these, so when I run the first script, instead of prompting the browser it adds it as an attachment to an email. Is that tough? I feel the hardest part is creating the file, not attaching it. Here's my code: <?php include 'config.php'; include 'opendb.php'; $query = "SELECT * FROM orders"; $result = mysql_query($query) or die('Error, query failed'); $tsv = array(); $html = array(); while($row = mysql_fetch_array($result, MYSQL_NUM)) { $tsv[] = implode("\t", $row); $html[] = "<tr><td>" .implode("</td><td>", $row) . "</td></tr>"; } $tsv = implode("\r\n", $tsv); $html = "<table>" . implode("\r\n", $html) . "</table>"; $fileName = date('m-d-Y').'.xls'; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=$fileName"); echo $tsv; //echo $html; include 'closedb.php'; //MAIL SCRIPT $to = 'me@mysite.com'; $subject = 'Excel Sheet'; $message = 'My Sheet'; $additionalHeaders = "From: me@mysite.com\n"; $OK = mail($to, $subject, $message, $additionalHeaders); ?> I take it $tsv is the file?? So how can I do a simple mail and add it as an attachment? Thanks in advance Ryan
  5. If anyone has this issue in internet explorer, I used: session_cache_limiter('none'); before session_start(), and that did the trick. -R
  6. So I've been trying to figure out why this is occuring on internet explorer, but can't come to a solution. I have a simple login in page (username/password). If verified I create a session and send the user to a new page. At the top of that page, the first line is: <?php session_start() ?> On ie, when you click login, about 50% of the time, the page that you're taken too with the above php, doesn't load at all. I couldn't figure out why. It seems it's hitting the page, but isn't loading anything. I know this as I then put the php code after the closing </html>, and I'm getting a "cache headers already sent" error on the page, so I assume this is occuring when the php is at the top of the page script, although I'm not actually getting the error code unless I put it at the bottom. Any ideas?
  7. Thanks Ken, Anyway I can make the require statement an absolute path instead? Would make a few other things easier. -R
  8. I'm loading in an external script: <?php require_once('http://www.mysite.com/php/check_session.php'); checkSession('test'); ?> And my check_session.php file is this: <?php function checkSession($sessName) { echo $sessName; } echo 'function loaded'; ?> Why would I be getting this? It's clearly defined and I'm calling it after I loaded in the check_session.php file (and I'm getting my echo test as well, so I know it's not a targetting issue): Fatal error: Call to undefined function: checksession() in base.php on line 4
  9. Actually, removed the Session checker on the page I'm redirecting too, and that did it for some reason. Guess I'll have to figure out another way to verify sessions.
  10. ALright, I've come to a conclusion that the header function does not work correctly in ie when it's the action of a form. Any one have any other methods for page redirection?
  11. Yep, just cleared cache, rebooted even, and tried. Can someone on ie6 or lower try going and hitting submit (after the correct info is entered). Then hit back, and simply hit submit again? When I do it, it comes to a blank screen. IF I do get to that blank screen, and hit refresh, the correct pages that it should have originally redirected to shows. Really strange.
  12. Tried a full url, and no luck. It's really strange, I'll click the submit button, it'll follow the header to the correct page. I'll then hit back, and hit submit again, and it'll just go to a blank page (the url bar won't change either). I put an echo in just to make sure it's hitting the php script everytime, and that works correctly every time I submit, it's just the header function acting goofy. Only on ie. Seems like a very basic issue. Form page: http://clients.palisadesinteractive.com/mgm/ u: mgm p: m1g2m3 Login.php script: <?php session_start(); $_SESSION['authenticated'] = 'mgm'; header("Location: http://clients.palisadesinteractive.com/mgm/base.php"); ?>
  13. Okay, so I stripped down everything I could. This problem only arises in i.e. I have a form, with an action set to login.php. In that login.php, I was checking the DB for the user, and using header to redirect. I was noticing in i.e. sometimes it'd follow the header, sometimes not. So now I stripped out my login.php to be just a header: header("Location: mgm/base.php"); If I keep submitting the form, sometimes it will follow the header, sometimes not. Why would that be? Only a one line script which is driving me nuts. Thanks!
×
×
  • 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.