Jump to content

jwwceo

Members
  • Posts

    212
  • Joined

  • Last visited

Posts posted by jwwceo

  1. Hey all. Last night, something on my server happened, and now my scripts aren't working like they should.

     

    It looks like my $_SERVER array is broken. When I echo $_SERVER['PHP_SELF'] I get the following:

     

    [php_SELF] => /cgi-bin/php5.cgi

     

    same thing for

     

    [sCRIPT_NAME] => /cgi-bin/php5.cgi

     

    I use the SELF variable in some script, so I need it to be working,

     

    any ideas?? is this possibly a virus??

     

    James

  2. ah..here's the problem...

     

    not all the frequencies are in days...

     

    an event that repeats monthly will sometimes be 30 days later, and sometimes 31..and rarely 28..

     

    an annual event will usually be 365 days later..but not always..because of leap years and such...

     

    thats why the strtotime seemed useful...in a that it can accept normal language like +1 month without knowing how many days exactly it might be.

     

    James

     

  3. I am writing an application where the admin can assign an event, and then can also say how often the event is repeated, for example, annually, monthly, weekly, every 3 weeks, every 2 weeks, daily, etc. They can also assign how many days in advance of the event to trigger a reminder for the event.

     

    I am then using a calendar display I wrote to display events on the calendar. The calendar is displayed one month at a time, and loops through all the days in that month. For every day in the month, say "01-01-08", it then loops through all the events and looks for matching dates and displays an event which occurs on that particular day. This part is working fine.

     

    The part that makes me scratch my head is the repeating events. If an even is "01-01-08" and set to repeat every 2 weeks in perpetuity, then there is this huge list of future dates which fit that criteria. How would I take a date in the future, say "12-15-2015" and see if it falls on one of those days. So I am thinking I need to write a function which will take 3 parameters:

     

    1. The original date.

    2. The repeating frequency

    3. The current date

     

    which will compare if the current date applies. Seems pretty hairy. Then I will have to modify it, and make another function that takes into consideration how many days in advance to set the notice. So that funciton would compare the current date to the "notification date", and see if that applies, and if so...set the notification.

     

    I hope this makes sense. I'd be happy to clarify if it does not. I also think (maybe) I can solve this as long as the dates are not too far in the future. I could limit it to like 10 years and check the re-occurring dates, and as a long as they are less than the 10 year limit, the loop would continue finding future dates, add them to an array of future repeating dates, and then check the current date against that. For example, if an event is occuring every 2 weeks, I could use the strtotime function a bunch of times.  But I am curious about writing the function which would work for any future date.

     

    I would love thoughts on this.

     

    james

  4. two cells directly on top of each other will always be the same width. The shorter on will always stretch to the length of the one on top of it. This is just how tables work.

     

    I didn't want to register so I cant see your exact problem, but a few ideas would be to:

     

    -divide the bottom cell in two and then add a 'colspan =' on the above cell.

    -use align right/left to align the pulldowns in the cell where you want them.

    -use style attributes like padding or margin to move the pulldown.

    -Simply make the pulldowns and the cells the same width so there is no problem at all. You can adjust the width of a select box pretty easilly using "size=25" or whatever length you want them both to be.

     

    I hope this helps.

     

    James

  5. Hello All,

     

    I have a flash ad on a website that does not want to act as a link in IE, no matter what I do.  Right now the link is set to work as an onclick even on the container div for this ad. I have tried this code in FF and chrome and it works fine. It also works in IE if I just get rid of the object, and click on the empty DIV that is supposed to hold the video. So something about the object inside the DIV is not working in IE. Any ideas???

     

     

    <div style="width:300px; height: 250px; cursor: pointer;" onClick="window.location.href='content.htm'">
    
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
    width="300"
    height="250"
    id="bl1414_easton_ads_300x250_01"
    align="middle">
    
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="false" />
    <param name="movie" value="http://mysite.net/flash_ads/easton/bl1414_easton_ads_300x250_01.swf" />
    <param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />
    
    <embed src="http://mysite.net/flash_ads/easton/bl1414_easton_ads_300x250_01.swf"
    quality="high"
    bgcolor="#ffffff"
    width="300"
    height="250"
    name="bl1414_easton_ads_300x250_01"
    align="middle"
    allowScriptAccess="sameDomain"
    allowFullScreen="false"
    type="application/x-shockwave-flash"
    pluginspage="http://www.macromedia.com/go/getflashplayer"
    wmode="transparent"/>
    </object>
    
    
    </div>

     

    James

     

  6. Hello,

     

    I am trying to write a report query to find all the sales for all past months. I have the query almost working. I have the timestamp stuff working, but the problem is, there is an additional criteria I am trying to sort by, called PROVIDER. And the PROVIDER field is in another table I am joining to. However, this is a one-to-many relationship, where each orderid has many entries in the second table. This occurs when the person orders more than one item. So I have added a DISTINCT clause,

    SELECT DISTINCT xcart_order_details.orderid, FROM_UNIXTIME( xcart_orders.date,  '%M %Y' ) AS yearmonth, xcart_orders.total
    FROM xcart_orders
    JOIN xcart_order_details ON xcart_orders.orderid = xcart_order_details.orderid
    WHERE xcart_order_details.provider =  'XXX'
    AND xcart_orders.status =  'C'
    GROUP BY xcart_order_details.orderid

    ]

    and this gets me the data you see below.

     

    orderid	yearmonth	total
    181560	July 2008	838.08
    181789	July 2008	256.32
    181795	July 2008	0.00
    181796	July 2008	648.60
    181912	August 2008	1666.75
    181957	August 2008	1503.45
    181998	August 2008	1104.18
    182015	August 2008	667.25
    182017	August 2008	1212.00
    182018	August 2008	983.52
    182019	August 2008	4774.50
    182021	August 2008	666.00
    182115	August 2008	3096.77
    182252	September 2008	3031.50
    182253	September 2008	780.00
    182280	September 2008	1889.84
    182300	September 2008	1362.50
    182325	September 2008	4857.50
    182387	September 2008	1468.50
    182489	September 2008	988.14
    184603	October 2008	730.34

     

    This SUM of these orders should add to 32525.74

     

    Yet, when I change the query to SUM that column,

    SUM(xcart_orders.total) as TOTAL

     

    I get this: 

    orderid	yearmonth	TOTAL
    181560	July 2008	838.08
    181789	July 2008	256.32
    181795	July 2008	0.00
    181796	July 2008	1297.20
    181912	August 2008	5000.25
    181957	August 2008	1503.45
    181998	August 2008	1104.18
    182015	August 2008	667.25
    182017	August 2008	1212.00
    182018	August 2008	983.52
    182019	August 2008	19098.00
    182021	August 2008	666.00
    182115	August 2008	12387.08
    182252	September 2008	6063.00
    182253	September 2008	780.00
    182280	September 2008	5669.52
    182300	September 2008	1362.50
    182325	September 2008	4857.50
    182387	September 2008	1468.50
    182489	September 2008	988.14
    184603	October 2008	730.34

     

    Which is aggregating ALL THE MATCHES FROM THE JOIN ( still grouped by ORDER_ID), and not just the ones displaying in the query results. I have been playing with this for hours, and I cant seem to find a way to make it only ADD THE RESULTS which are shown in the query results.

     

    Its like I want to group them by two methods, first by ORDER_ID, and then by YEARMONTH, but passing multiple group by arguments doesnt work either.

    Best,

     

    James

     

     

     

  7. I've got this query worked up...but its not working...can anyone see something wrong with this syntax?? Ive never used these extract functions before...might have a typo...

     

    Im getting this error..

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM_UNIXTIME(date)) as yearmonth,
    SUM(total) AS Total FROM x_cart_orders WHER' at line 1 

     

    Query

     

    SELECT EXTRACT(YEAR_MONTH FROM_UNIXTIME('date')) as yearmonth,
    SUM(total) AS Total FROM x_cart_orders WHERE status = 'C' GROUP BY yearmonth

  8. Hello,

     

    My script records order date/time in UNIX timestamp. I want to write some reporting tools to show sales for every month since our store began. So basically, I need to write a function that will find the current month, say October 2008, and then all the previous months BEGINNING and END timestamps, going back to a start date. Then, I can use those BEGINNING and END timestamps in my mysql query to generate the reports.

     

    Seems like a tricky endeavor, so I am wondering if there are any php tricks to make this easier.

     

    James

  9. Hello,

     

    I would like to write a script that I can put on a cron job to auto place an order on my online store, so I can test it everyday and make sure its working, and if it's not, an alert comes up in my dashboard. I Ive had times in the past when it goes down, and we dont know for a few days and we lose all the orders.

     

    How do I write a script to simulate a user adding an item to my cart, and checking out. Specifically, how do I simulate the form data passing from one page to another?

     

    James

  10. Hello,

     

    I have a function written pageSwitch() with I use to show and hide DIV's on my page based on what people select. It works great.

     

    What i want to do now, is be able to link to this page, and pass a variable in the that link, so that a specific DIV is shown. I'm not sure how to do this.

     

    Any ideas???

     

    James

     

     

  11. Hello,

     

    I need some server lessons over the phone. I have Apache, Php, Mysql, FTP, all set up. I have Webmin installed as well.

     

    I need someone to log onto my server with me and answer my questions and walk me through setting up sites on BIND, setting up IP's, SSL, email addresses. I am thinking it will take 2-3 hours total, and I will pay good, between $25 and $50 per hour, based on how good you are!!!

     

    Please call me direct at 805.426.9563

     

    Best,

     

    James

  12. I have a site that uses transparent png's. These dont work in IE. I have tried a bunch of plugins and none work. Does anyone have a simple fix for this which they know works??

     

    Best,

     

    James

  13. Hello,

     

    I finally got Apache, Php, Mysql all up and running. I then rebooted my server, and the test pages I made, index.html, and test.php are no longer showing up. I get the test Apache page.

     

    It seems the document root was somehow changed, or possibly one of the install scripts made some kind of symlink or alias or something. My httpd.conf has the following:

     

    DocumentRoot "/usr/local/apache2/htdocs"

     

    Yet, the server is looking for my docs in:

     

    /var/www/html/

     

    I know I can just move my source files there, but it seems weird that it would change. Any ideas???

     

    JW

  14. I read the instructions better, and see that this version does not need to be compiled...so I have MySQL installed, I am pretty sure...but I have some very basic questions...

     

    in order to run any of the test commands like:

     

    bin/mysqlshow

     

    I need to add this to the code

     

    bin/mysqlshow --user=mysql

     

    I am assuming I am operating as root, and don't have access to the files, but how do I operate as mysql?? The only logon I have on my server is root. I guess I am a little confused as to the different types of users. From what I can tell, there are linux users, and then separate mysql users, one of which is also called root???

     

    The documentation is a little ambiguous to me. Any tips would be great!!

     

    James

     

     

  15. Hello,

     

    I am installing mysql on my first dedicated server, and I am having some problems. I hope it's something simple...

     

    I have downloaded the sourceballs, unzipped them, and ran the compile command, only to get this error:

     

    Any idears???

     

    [root@localhost mysql-5.0.51a-linux-i686]# ./configure --prefix=/usr/local/mysql
    NOTE: This is a MySQL binary distribution. It's ready to run, you don't
    need to configure it!
    
    To help you a bit, I am now going to create the needed MySQL databases
    and start the MySQL server for you.  If you run into any trouble, please
    consult the MySQL manual, that you can find in the Docs directory.
    
    Installing MySQL system tables...
    OK
    Filling help tables...
    OK
    
    To start mysqld at boot time you have to copy
    support-files/mysql.server to the right place for your system
    
    PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:
    ./bin/mysqladmin -u root password 'new-password'
    ./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
    
    Alternatively you can run:
    ./bin/mysql_secure_installation
    
    which will also give you the option of removing the test
    databases and anonymous user created by default.  This is
    strongly recommended for production servers.
    
    See the manual for more instructions.
    
    You can start the MySQL daemon with:
    cd . ; ./bin/mysqld_safe &
    
    You can test the MySQL daemon with mysql-test-run.pl
    cd mysql-test ; perl mysql-test-run.pl
    
    Please report any problems with the ./bin/mysqlbug script!
    
    The latest information about MySQL is available on the web at
    http://www.mysql.com
    Support MySQL by buying support/licenses at http://shop.mysql.com
    Starting the mysqld server.  You can test that it is up and running
    with the command:
    ./bin/mysqladmin version
    [root@localhost mysql-5.0.51a-linux-i686]# nohup: redirecting stderr to stdout
    chown: `mysql': invalid user
    Starting mysqld daemon with databases from /usr/src/mysql-5.0.51a-linux-i686/data
    STOPPING server from pid file /usr/src/mysql-5.0.51a-linux-i686/data/localhost.localdomain.pid
    080418 19:51:13  mysqld ended
    
    

  16. Hello,

     

    I've installed Apache, PHP, and mysql on my local laptop before...but never on a remote server and I have no clue where to start.

     

    All the tutorials seem to assume I already know how to do certain things. For example, they say, unzip the source code from the directory where you downloaded the files. But I have no clue how to download the files onto my server. I've got the zipped files on my desktop..but Im not sure how to get them onto my server...

     

    is there a tutorial anyone knows of, that is ultra step by step from a totally new server standpoint.??

     

    James

  17. Hey All,

     

    I have a site where I am running a few simple queries, such as find by color, find by keyword, etc.

     

    I am trying to implement a "search by anything" where a user can enter a term into a text box and get results from any number of fields.

     

    It works, but it takes forever to run...like maybe 1-3 minutes. And then after that query is run, the site runs slow unless I close the browser window and open it again. Then all is fine. Its like the query eats all the memory....

     

    Has anyone ever heard of this???

     

    Here is the query.

     

    $dataP = mysql_query("SELECT *
    FROM shirts
    INNER JOIN shirtcolors on shirtcolors.shirt_id = shirts.shirt_id
    INNER JOIN colors ON colors.color_id = shirtcolors.color_id
    INNER JOIN shirtkeywords ON shirtkeywords.shirt_id = shirts.shirt_id
    INNER JOIN keywords ON shirtkeywords.keyword_id = keywords.keyword_id
    WHERE(
    colors.color = '$search'
    OR keywords.keyword like '%$search%'
    OR shirts.name like '%$search%'
    OR shirts.keywordlist like '%$search%')
    AND active='true' AND approved='1'
    GROUP BY shirts.shirt_id ORDER BY shirts.$field $direction
    LIMIT $from, $max_results");

     

    James

×
×
  • 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.