Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by dalecosp

  1. Can you show us the db_query function? There's no such function built into PHP, so it's likely a custom function and probably isn't doing what you want it to, either because it's broken, or because you don't understand how to use it (which could easily still be the programmer's fault if (s)he didn't document it clearly)....
  2. Perhaps I misunderstand you. What it sounds like you are saying is this: A loop is running, and for each item in the loop you call file_get_contents() on an external webpage, maybe something like this: $mail_body = file_get_contents("http://mysite.com/template_generator.php?firstname=$firstname&somevar=$variable");If that is the case, it's terribly inefficient. You need a template in memory as a variable: $mail_template = <<<EOT Dear {firstname}, Are you still interested in purchasing the {name_of_product} from our web site? Thanks, MyCompany.com EOT;You should then call str_replace on this variable with the data for each iteration of the loop. Now it sounds like *maybe* the problem is that you can't get all your data from more than one location all up front, which is also part of what I'd be doing in this sort of situation. If you can't, that is a bit of a problem. I don't freelance much, but I do need to get my convertible out of the $hop with its $hiny new engine and exhau$t $y$tem ...
  3. And the other thing is probably this: You're doing an HTTP GET to a PHP script for this? Ouch! This will at least DOUBLE your throughput: format your file a la "a template", read the file ONCE into a variable, and str_replace() the DB values into the template var.
  4. Given that this is starting to sound like I'm helping a spammer, I'm a little loath to comment; however: PHP is using a heck of a lot of overhead opening and closing a connection to the SMTP server. What you should do if you want to scale is to have PHP open a socket and speak directly to the SMTP server without opening and closing the connection for a given number of mails (which you should test against your SMTP server, you do NOT want to choke it to death). If you know how to speak SMTP, this shouldn't be too difficult.
  5. Into what table? An HTML table? A Database Table? The Dining Table? Assuming the 2nd option above (DB table), I guess, eh ... don't create a unique index? But seriously, you don't give us your DB structure, and you don't give us sample data or tell us what the data is (it appears to be an array of URLs?) ... How about this? mysql> describe xsit; +-------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+---------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | var | text | YES | | NULL | | +-------+---------+------+-----+---------+----------------+ 2 rows in set (0.00 sec) Seems like it would work with that? [edit]PS: someone will probably say "Stop using the old mysql_* functions. I agree [/edit]
  6. You'll want to use some valid SQL for this: $select = mysql_query("SELECT "); //this won't work :-( //try this instead $movies_table = "name_of_your_table"; $query = "select no,name,price from $movies_table where price >20 order by price DESC;"; $select = mysql_query($query);
  7. Come on now friend ... it's not THAT hard //lines like these will need changed: echo "<span><a id='page_a_link' href='info5.php?page=$j'>< Prev</a></span>"; //needs phone parameter echo "<span><a href='info5.php?page=$i' id='page_a_link'>$i</a></span>"; //needs phone parameter //to this echo "<span><a id='page_a_link' href='info5.php?page=$j&phone=$phone'>< Prev</a></span>"; //has phone parameter echo "<span><a href='info5.php?page=$i&phone=$phone' id='page_a_link'>$i</a></span>"; //has phone parameter //At the top, because you're only POSTing the first time (and using GET thereafter), you will need something like: if (isset($_POST['phone'])) { $phone = $_POST['phone']; } elseif (isset($_GET['phone']) { $phone = $_GET['phone']; } And you probably should consider some type of validation on the phone variable as well, unless you're certain that it won't be viewed by anyone except people in your own company.
  8. PHP Parse error: syntax error, unexpected '<script', expecting '<?php' in /usr/home/stradmadhu/original_post on line 1
  9. If you're sure that products *should* be found on a second page, have the script echo the values of $start and $perpage to you just before the query ... it may be that these values are not what you expect. Also, please consider using the [ code ] BB tags for your code
  10. Just a wild, wild guess ... scope issues. Are you really only loading it that way for the sake of brevity in the top-level document? What does your debugger tell you?
  • 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.