Jump to content

bulrush

Members
  • Posts

    185
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Grand Rapids, MI

bulrush's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Anyone know how to send a Javascript string and store it in a php variable?
  2. In IE 8.0, in the top row of the toolbar, there is the back button, forward button, the URL box, 3 more buttons, and a Google search box. The URL box is too short to show the whole address of my URL and I need to view the whole address sometimes. How do I get rid of the Google search box? I have looked in Internet Options, and tried to drag it but I can't seem to get rid of it. I will never use it. I also tried to remove search engines from Internet Options with no luck. Thanks.
  3. Because with a tool, it will save me 2 minutes of typing each time I do this, and I do this a lot while developing. So I am saving 20 minutes, then 200 minutes, etc. The time saved adds up. I made my own tool to do this for MS Access but I don't have it anymore. EDIT: I did not realize I could do a multi-line query assigned to a PHP variable. Thanks!
  4. Your options are: 1) Get read-only access directly into the site database. Talk to the site owners and state you just want READ ONLY access, which will prevent you (or a hacker who hacks your program) from messing with their db. 2) Ask the site owners to provide data you need in a tab-delimited text file. Update the file each day. The site owners can automate this process using unix cron and use SQL to dump the data you need from a query into a text file. (Is once a day enough for your purposes?) 3) Write your own screen scraper.
  5. This is not quite working. A bullet is a line of descriptive text. Each part has one or more bullets associated with it. However, each part can appear under one or more brands. The user needs to be able to copy all bullet text from one brand to another, and change the bullet text as they desire. My task: if the current brand for a given part has no bullets, allow the user to copy bullet text from another brand. List in a SELECT box only brands which are not the current brand, and which have more than zero bullets. This SELECT box contains the brand to copy bullets from. The SELECT box contents is based on the query below. Here is my current query: $query2="SELECT brands.brand, brands.partid, bullets.bullid, ". "bullets.bullettext, bullets.buorder, ". "count(bullets.partid) as bucnt, bullets.partid as bupartid ". "FROM brands ". "JOIN bullets ON (brands.partid=bullets.partid) ". "WHERE (brands.partid=".$partid.") ". "AND (brands.brand<>'".$brand."') ". "GROUP BY brand ". "HAVING bucnt > 0 ". "ORDER BY brand, partid ". ";"; It correctly excludes the current brand, but it incorrectly lists a brand with zero bullets, which I will call brand "C". Anyone know how to fix this? I double checked my bullets table and there are no bullets for brand "C", but brand "C" appears in my <SELECT> box.
  6. I'm looking for a Windows utility to convert this: SELECT brands.brand, brands.partid, bullets.bullid, bullets.bullettext, bullets.buorder, count(bullets.partid) as bucnt, bullets.partid as bupartid FROM brands JOIN bullets ON (brands.partid=bullets.partid) WHERE (brands.partid=".$partid.") AND (brands.brand<>'".$brand."') GROUP BY brand HAVING bucnt > 0 ORDER BY brand, partid; to this: $query2="SELECT brands.brand, brands.partid, bullets.bullid, ". "bullets.bullettext, bullets.buorder, ". "count(bullets.partid) as bucnt, bullets.partid as bupartid ". "FROM brands ". "JOIN bullets ON (brands.partid=bullets.partid) ". "WHERE (brands.partid=".$partid.") ". "AND (brands.brand<>'".$brand."') ". "GROUP BY brand ". "HAVING bucnt > 0 ". "ORDER BY brand, partid ". ";";
  7. Are you trying to grab data from a generated web page, like from the link you gave? I would call that "screen scraping". Basically, you put the whole webpage into a string and parse the string, one line at a time. Or, make it an array, each entry in the array is a line in the html file. HTML is just text, after all. I did this once using MS Access and the Yahoo stock quote page.
  8. $source=preg_replace('/\.$/', '', $source); param1=regex to search for, must be enclosed in 2 slashes, one at each end. param2=string to replace with param3=string to search and replace on If (preg_match('/\+([\d\.])+k/', $change, $matches)) { //Full match of whole regex is in $matches[0]. //First parenthesis match in $matches[1]. $amt=$matches[1]; $fullamt=$amt*1000; } //If k is 1000, then m must mean a million. If (preg_match('/\+([\d\.])+m/', $change, $matches)) { $amt=$matches[1]; //Full match of whole regex is in $matches[0]. $fullamt=$amt*1000000; } In your case: $change=preg_replace('/^\+/', '', $change); //Drop + at beginning of string, + must be escaped with backslash. $change=preg_replace('/[km]$/', '', $change); //Drop k or m at end of string ^ represents beginning of string $ represents end of string That will get you started.
  9. So, in PHP would it look like this? echo 'Date: '.<script>document.write(new Date().toString());</script>.'<br/>'; Or, how would I assign this string to a PHP variable? Thanks. I learn by asking questions.
  10. Begin new to Javascript, how would I output that JS string to the browser? Instead of via a JS window? The browser is viewing a page which will be printed on paper, and the paper must have the local date and time on it.
  11. I just double checked the LIKE docs and SQL does support Abdbuet's [0-9] syntax. His way is less typing. OTOH, if you want to show all items that DON'T begin with letters, you can also do this: SELECT * FROM mytable WHERE myfield like '[!a-zA-Z]%'; ! is a negator.
  12. SELECT * FROM mytable WHERE mytextfield like 'a%'; % is a wildcard representing zero or more characters, just like * in unix. For a single character wildcard in SQL, use underscore (_). Ooops, I see your question now. SELECT * FROM mytable WHERE (myfield like '0%') or (myfield like '1%') or (myfield like '2%') or (myfield like '3%') or (myfield like '4%') ... Get the idea?
  13. PHP 5.2.6 We rent PHP server space on a server in California. Several of my pages generated by PHP show the current date and time, so when the page is printed, the user knows when the data was printed. Our users could be anywhere in the US, I am in Michigan. How do I convert the server time (PDT) into local time, regardless of where the user is? 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.