chrishea 182 Nearly a Posting Virtuoso

It isn't just whitespace, it is anything that generate output to the browser. That could be an echo or a session statement or other things. Please post the first 5 or 6 lines of head.php

chrishea 182 Nearly a Posting Virtuoso

Have a look at this:
http://html2pdf.fr/

It makes it pretty easy to take a html screen display and produce a PDF output. It does requires valid / complete html (e.g. closing tags) that your browser can live without.

chrishea 182 Nearly a Posting Virtuoso

Since you are downloading, you are trying to get the file size of a file on the server. This should work just fine on any browser because it is happening on the server not locally. If you give it a valid file system address (relative, c:/... home/ etc) then you should get the size.

chrishea 182 Nearly a Posting Virtuoso

From some further reading, it seems that application/x-zip-compressed is the mime type to use rather than application/zip. You might want to give that a try.

chrishea 182 Nearly a Posting Virtuoso

There is no mystery to this. The info is available in the MySQL manual and partially in the PHP manual.

To get the number of rows use the php mysql_num_rows command.
For the info on the date and time of last update do a mysq_query with the "show table status" command

chrishea 182 Nearly a Posting Virtuoso

I found an example that used different headers than yours. You may want to give these a try:

header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"'); 
header('Content-Transfer-Encoding: binary');
chrishea 182 Nearly a Posting Virtuoso

The division by zero error is only a warning so it doesn't stop execution. You can prevent the warning from printing (if necessary) using error_reporting (E_ERROR);

It looks as if the division by zero returns false rather than a numeric value. Thus, your code could be changed as follows:

$result = $row['PTS0910']/$row['GP0910'];
if ($result == false) {
   $result = 0.00;
}

echo  number_format($result,2);
chrishea 182 Nearly a Posting Virtuoso

See my response to the post below. I think that it can deal with your need.

http://www.daniweb.com/forums/thread301615.html

chrishea 182 Nearly a Posting Virtuoso

To get from SMS to your server you will need to use an SMS gateway service (and you will need to pay for it). That will allow you to go in both directions.
One example: ClickaTell

At no cost, you can go from the server to SMS if you have the phone number and know the cell phone provider (and the SMS email address format for that specific provider).

chrishea 182 Nearly a Posting Virtuoso

I think that it is just as important to know where and how to find the information you need when you need it. As I learn things I keep notes and then when I want to do something that I haven't done for a while, I go back to the notes and look it up. If it's something that I haven't done before, then I'll go and find it on the web and probably add it to the notes. Avoiding the re-learning has saved me quite a bit of time.

One of the ways to learn is to look at other people's code (mostly good examples) and then try making changes to it. We are lucky with PHP that there is huge amount of open-source code out there along with lots of tutorials and help forums. You can see more advanced techniques like functions, classes, mvc structures and oop. You can start with more basic stuff but all levels of examples are easily available. It's a lot more fun to work on things that interest you so you should just pick a topic and jump in.

chrishea 182 Nearly a Posting Virtuoso

With respect to CMS systems, this site will give you an idea of how many CMS's are available out there.
http://www.cmsmatrix.org/

The most popular ones are Joomla, Drupla, Mambo and Wordpress (that has morphed from a blog system into a quasi-CMS). I have used a system called Website Baker for years because I find it easier to setup, maintain and modify than some of the better known ones (but you will find people who will make the same case for each of the options out there). They are all based on PHP and MySQL and they are all open source / free.

Most of the CMS's have the ability to include a forum as an add-on. If you want to go for a stand-alone version see the link below for a list: Many / most of these are also open source PHP-MySQL.
Forum List

If you go with a package, then the most PHP you will probably need is to modify the config module with the parms for the database and few other things. This will give you a lot of bang for the buck right out of the box. The setup of the pages is generally done through an editor (somewhat like a Word interface for text and graphics pages) so you don't need to be writing code.

chrishea 182 Nearly a Posting Virtuoso

Have a look at this as an example:
http://www.siteground.com/tutorials/php-mysql/display_table_data.htm

There are lots of other tutorials out there if you do a search.

chrishea 182 Nearly a Posting Virtuoso

A few comments:

1. It would be helpful if you could clearly identify what you need this site to do. If it is an information site with forums and so forth, then you should be looking at implementing a Content Management System (CMS) and/or a pre-packaged forum system. There are lots of these available as open source systems. They require some technical knowledge in order to implement them but it a whole lot faster and easier than trying to build something yourself. If you are aiming for something very flashy or if you are thinking of actually coding some sort of online game yourself, then you will need a level of expertise that you don't seem to have at this point (and takes quite some time to develop even if you have adequate natural talent). Your needs might go beyond what PHP can do on its own (as a server-based system). In that case you might need to look at javascript / Ajax, possibly in combination with PHP.

2. I don't understand your references to VB. The two most common script languages for online development are PHP and ASP. Maybe I haven't been paying attention but my experience with VB was as a PC desktop application development system.

3. PHP isn't too difficult to use but you do need an understanding of programming basics, the language syntax and the environment that it runs in. I had many years of programming in other languages when I first got …

chrishea 182 Nearly a Posting Virtuoso

The option to be selected needs the word 'selected' after the value=xxx. In order to make this dynamic, you need a variable as part of each option as follows:

<select name="attend">
  <option value="No"<?PHP echo $selected_no; ?> >No</option>
  <option value="Yes" <?PHP echo $selected_yes; ?> >Yes</option>
</select>

Before you get to this point, you will decide if it is to be yes or no and set one variable to empty and the other one to 'selected'.

chrishea 182 Nearly a Posting Virtuoso

You can lots of info and examples through a google search:

http://www.tizag.com/phpT/examples/formex.php

chrishea 182 Nearly a Posting Virtuoso

Your session_start on line 2 and the header on line 13 are probably conflicting as they both cause output to the browser (session_start creates a cookie). You may get some resolution by putting the session_start on the first line with the <?PHP (that's what I've read but I don't know the reason). If that doesn't help using ob_start and ob_end_clean before and after the session_start may let you work around it.

chrishea 182 Nearly a Posting Virtuoso

I don't see anything obvious from your code. If I was going to debug this, I would be looking for answers to the following questions:

1. Which insert is failing? We have to presume that it isn't the first one since the order id in the first table should be an auto-increment field.

2. If there was a duplicate order id already on file (in one of the other two tables), where did it come from?

If the answer to the second question isn't obvious, then you may need some debug code at appropriate points in your code to get more info. This module is pretty straightforward and it probably isn't the source of your problem (on its own).

chrishea 182 Nearly a Posting Virtuoso

As far as the headers are concerned, I already have a program of my own that does downloads so I compared what I had with what you had and started experimenting. You had more header statements than I did so I tried it with and without some of the others to see if they had any impact. Once I had your returnMimeType routine working, I found that it would display the file but didn't give a chance to save it. By replacing your Pragma: Public with Pragma: no-cache it gave me the option to save it. I used no-cache in my own program. I didn't have a Content-Length: in my program so when I found that I couldn't open the downloaded file, I started trimming back your headers to see if that was the cause. After I removed Content-Length, the program worked. When I looked at that statement again it seemed likely that $file_path would not actually contain the file length.

So in conclusion:
1. Use your own work and others as a guide because most of us can't remember everything or do the full research on how every PHP command works. Do keep a copy of the PHP documentation handy and use it when your aren't sure of the command format, input or output.

2. Take advantage of the fact that there are many thousands of examples of php code on the internet. It's often easier to figure out how a piece of code that is …

chrishea 182 Nearly a Posting Virtuoso

I made a few changes as shown below and the download worked in IE (and Chrome):

1. In returnMIMEType on line 21 you used $fileSuffix[1]. That is not defined. I changed that to $ext.

2. In getDownLoadData, on line 15 I changed header("Pragma: public"); to header("Pragma: no-cache");

3. In getDownLoadData, I deleted line 23 because it isn't needed and it isn't being given the right data and makes the downloaded file unusable.

When I checked, I found that the file I was able to download previously was not actually usable.

It is important and a lot less frustrating if you know how to debug these things for yourself. A few well placed echo's (or some actual debug function calls if you want to get a bit fancier) will tell you if you are getting the data that you expected. For the mime-type, it would have worked for most types but I happened to use a .png file and the code for that wasn't quite right. I did a separate call to the returnMIMEType function (before all the headers) and echo'd what came back. When I saw that I was getting 'image/' with no type I went and looked closer at the code and found the problem. In this case, I could have just looked at the code but if it was more complicated, using a bit of debug code will probably save time. For the header statements, I used a program of my own as …

chrishea 182 Nearly a Posting Virtuoso

On line 21 you use a command returnMIMEType. I can't find any documentation on that so unless you have your own function with that name, I don't believe that it is valid. I get an error on that line when I tried your code. According to the documentation you can use a PECL extension (finfo_file) to get the MIME type but it didn't work for me (missing PECL?). When I changed line 21 to use image/png (because I tried it with a PNG file), it worked fine under IE8 and Chrome.

chrishea 182 Nearly a Posting Virtuoso

You might want to try a different version of IE (e.g. from a different machine) to see if the problem is consistent. There are bugs and limitations that occur only in specific versions of IE. It won't really be a solution if it works in a different version but it might help to find out what's wrong.

chrishea 182 Nearly a Posting Virtuoso

Read the info from the db into a form where each item each has a checkbox. You will give each item a standard name plus an index number (i.e. name=aaaa$i). In the module that processes the form data, you process the items one at a time in a loop treating them as variable variables and then copying them to a standard variable name that the rest of the processing uses. You could add each of the chosen items to a string and when you're done, insert that string into an email that you send to him and to yourself. All of this is pretty straightforward PHP. If you haven't used variable variables you might find it a bit confusing but the actual code to do it is quite simple.

With respect to "pure PHP and MYSQL" the only considerations come in if the list of items is to be paginated because it is too long for one page; or, if you want to be able to limit him to 5 items as they are being chosen. In both cases, you might want some javascript but it could be handled in a less elegant way with PHP.

chrishea 182 Nearly a Posting Virtuoso

This is a class that makes it pretty easy to use PayPal with IPN:
PayPal Interface

If you try it an have any problem figuring out how to use it, let me know and I can give you a sample.

chrishea 182 Nearly a Posting Virtuoso

If I understand your question correctly, you might need something like:

if (condition A  AND condition B) {
  some action
}
elseif (condition A) {
  some other action
}
chrishea 182 Nearly a Posting Virtuoso

For starters, you have an error on line 25. You used $POST instead of $_POST. That probably explains the insert not working correctly but maybe not everything. Suggest that you fix that, run it again and see what errors are left.

chrishea 182 Nearly a Posting Virtuoso

There have been problems with losing sessions after a redirect but some of them are specific to the browser and other variables in the environment. In most cases, the session is lost as a result of the redirect but you seem to be saying that it is working initially because the secure page is correctly printing their account name. You may need to put in some debug code and print the session id just to know where it is being lost.

A couple of the problems that others have had resulted from not closing the session before redirecting (session_write_close() ) or in going from a non-secure page to a secure page (making them both secure solved it). Again, since you say that the login page works the first time, neither of those possible problems would seem to affect you. If you land on the login page and immediately refresh and the session is then lost, that would be pretty strange. You didn't post any code but I would check that carefully before assuming that it is something else. If you aren't doing a session_start in every situation (for example) then that might explain your inconsistent results.

chrishea 182 Nearly a Posting Virtuoso

The message shows two different modules: view.php and constants.php. You have only shown code for one of them (presumably constants.php). You are probably doing an include for view.php and it appears that you are generating some kind of output from that module. Any kind of output prior to using a header statement will create an error. This can be as simple as a blank line. Anything at all will do it.

chrishea 182 Nearly a Posting Virtuoso

I think that you should try to create some code and if you have a problem making it work then post the code along with some info on what isn't working and what you have done to try to get it to work.

chrishea 182 Nearly a Posting Virtuoso

Get the current time as a timestamp [ $wk = strtotime("$my_date $my_time"); ]

Subtract your 5 minutes / 300 seconds from it [ $wk2 = $wk - 300; ].

Then you can do whatever you need to do with it:
e.g. display it: [ echo date("Y-m-d H:i:s",$wk2); ]

chrishea 182 Nearly a Posting Virtuoso

I take it that you want to dynamically create the personal pages. Even if you want the page to have a personalized name, the content can be standard. Then all you have to do is have the standard version and copy it to the new personalized name (php copy command). It can be passed a parameter for the name or extract it from the url.

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso
theighost commented: very helpful :) +0
chrishea 182 Nearly a Posting Virtuoso

Sorry, I didn't read your question carefully enough. There will be some processing for the functions on every page that is executed. It is probably better to be consistent and include it everywhere unless it is really big. Even if that is the case, the performance difference probably won't be significant. If you have some pages that are executed very frequently and don't need any of the Functions, you could possible exclude the functions from that one and possibly put a note in the code as a reminder that they have been excluded.

chrishea 182 Nearly a Posting Virtuoso

If you have a function (definition) in the executable path of your code more than once you will get an error. If you will potentially have that situation and want to avoid the problem rather than re-engineer your code, use:

if (!function_exists(xxx) {
   function xxx( ) {
     ...
   }
}

wherever you have the definition of the Function. This will avoid the potential problem.

chrishea 182 Nearly a Posting Virtuoso

It's pretty simple and you don't need to pay for a gateway.

You can send an SMS message just like an email. The wrinkle is that the email format differs between cell phone providers. When you want to do an SMS authentication, you must ask the person (on the website) for their cell number and provider name (best to use a drop-down list). Then, you must create the right email address format and send the message like a normal email. On the website, you will have a 'Continue' button and it will provide a form where they can enter the code. To get the formats for the various providers you can do a web search for something like 'PHP SMS send' and you'll probably find some sample code and as starting list of providers and formats. Any others that you need can be found by going to the web sites for the providers that you need.

Questions on working with SMS come up often enough I guess I'll have to create a tutorial but right now, this is what you get.

iWalletMobile commented: Great Help +1
chrishea 182 Nearly a Posting Virtuoso

If you use a relative address like include "inc/xxxx.php" or one that points to the root like $_SERVER... I don't see why you would need to change it. I don't understand why you would anticipate a need to totally change the structure. Once you define a need to have $_SERVER."/inc/top.inc.php" then that becomes a requirement for your site. Unless I am misunderstanding your question, it seems that you are trying to be unnecessarily flexible.

chrishea 182 Nearly a Posting Virtuoso

You created the query statements but you didn't actually call MySQL to take action on them. You need a mysql_query statement to execute each query.

chrishea 182 Nearly a Posting Virtuoso

You could separate your fields with a comma or some other unique character (when the file is written) and then use explode when you read the line to separate the fields.

chrishea 182 Nearly a Posting Virtuoso

To export to Word, Excel and other formats see:
Desktop Write

To create a file as a PDF, you can use built in support and open-source classes to construct your file OR, you can create the output as HTML and then convert to PDF. I have used this latter approach successfully using the HTML2PDF utility. FOr info on this see:
HTML2PDF

chrishea 182 Nearly a Posting Virtuoso

You cannot have any output prior to the session start. Thus, you can't echo anything or have any text coming from any html. If you haven't done this intentionally, it can sometimes be the result of a blank line (e.g. an empty line before the intial <?PHP)

chrishea 182 Nearly a Posting Virtuoso

The first thing to check is how you saved the module. If it doesn't have a .php suffix (xxxx.php) then it won't be recognized as a php module and your php code won't be executed.

chrishea 182 Nearly a Posting Virtuoso

You won't see the php when you view the source. The php executes on the server and all you see in the browser is the html and javascript if there is any. In this case, the "Hello World" string should appear after the <Body> statement.

There are lots of things that could be wrong but for starters, your module has to be recognized as a PHP module by the (WAMP) server. Thus, it has to have a .php suffix. If that is correct, I would verify that the content of the module is what you have shown above. If not, I would take Eclipse out of the equation initially and just use a text editor to save the module and try to run it in WAMP. If that works, then WAMP is ok and you have some sort of problem in what you are doing with Eclipse. If WAMP has a problem, then I'd fix that first and then sort out Eclipse.

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

Your If statements should be in the form:

if(isset($id) && $id == benelli){

Notice the == to test for equality. A single = in an IF will act the same as a statement like $a = $b;

chrishea 182 Nearly a Posting Virtuoso

You need a program that will do a PHP error check for you. There are many of them, Netbeans is one example.

When you get a blank screen it usually means that you have a PHP error (assuming the program is supposed to display something). In this case, when you error check it, you find that there is an error on Line 44. That is because you are using IF and ELSE without curly brackets. You can only put one statement between an IF and an ELSE if you don't use curly brackets. I think that it also makes the code harder to follow when you don't use the brackets.

chrishea 182 Nearly a Posting Virtuoso

It sounds as if you need to do some screen-scraping. See this previous post for some references.

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

Looking at your code, I would expect that it would put the last $ipath that you read in the while loop into the text field. The user chooses a link from the list to put the image into the iframe but you don't have the same dynamic action happening for the path.

chrishea 182 Nearly a Posting Virtuoso

The easiest starting point is to echo your select statement, copy it and try it in PHPMyAdmin. You may find that it needs a change and you can experiment in PHPMyAdmin then make the appropriate changes in your program.

chrishea 182 Nearly a Posting Virtuoso

You don't have a loop so it makes sense that it would only execute once when $dice is equal to 6. If your intent is to keep generating random values and showing what was rolled, you need a While loop and you will need to change your code to put any one-time actions (like the mysqli) before you start the loop.