Ah see, you want them to absorb the charges, the $1.50 throws the equation I know off :/ ... if they applied it before, then it would have been ok.

I'm going to go on the basis I have the right idea for what you want, the calculation is as follows:

You want the fee (referred to as $outcome, what you get) to equal a certain amount, lets take your example for $2, so...

(($gross x 0.065) + 1.5) must equal $2 ... and you want to know what $gross is? so you would do the following:

(2 - 1.5) / 0.065 = 7.6923... - That's what you have to charge your customer, in order for you to receive $2 in fees.

Now, for that to work on any calculation with pluggable values in PHP:

$outcome = 2;
$charge = 1.5;
$processing_fee = 0.065;

$gross = ($outcome - $charge) / $processing_fee;

// Gross is now 7.6923...

Oh my god, there is something for everything out there!

A simpler solution would be to export from Excel as a CSV and then use PHP's buitlin functions to parse a CSV file : http://php.net/manual/en/function.fgetcsv.php

Do you get any output, the 'dead' statement, or none at all?

What's in include("connect.php"); ?

If you don't get any output at all, then perhaps something in there causes the script to finish.

if(isset($_POST['submit']))
{ ... }

... needs to be ...

if($_SERVER['REQUEST_METHOD'] == 'POST')
{ ... }

Also answered your other thread, same reason and solution.

With the looks of it, you would expect to see the $_POST['submit'] variable set in your example above, but perhaps the 'type="submit"' causes it to be unset or unregistered by the browser (it doesn't send it), but I'm not 100% sure on that...

Wrong use of if(isset($_POST['submit'])) here, what you're looking for is:

<?php

    if($_SERVER['REQUEST_METHOD'] == 'POST') {

        // Validate and Execute Password Change Code ...

    } else {

        // Display Form

    }

?>

http://php.net/manual/en/reserved.variables.server.php

blocblue's showing off :P it would be simpler to use ...
[CODE]return mysql_result($query, 0);[/CODE]
... providing the caller can handle FALSE if it's returned.

I'm hoping you've used [ICODE]if(category_exists('blahblah'))[/ICODE] ...

The scope of $dbc is local to connect() so displayFunction() cannot "see" it.

The best way would be to have connect() return either the connection ID or FALSE.

Then swap ...

[CODE]if(!connect()) {[/CODE]

for ...

[CODE]$dbc = connect();

if($dbc == FALSE) {[/CODE]

although, personally I would put the TRUE statement first, it flows better to me.

We never worked out what was wrong with the original :(

[QUOTE=geneh23;1677030]@momo: Nothing appeared when I echoed both $connection and $db without the previous text.[/QUOTE]

I would have expected to see 'Connection ID #1' and 'TRUE' or something similar if the original db.php had worked.

[QUOTE=momo219;1677001]@Smeagel13, not stepping on your toes here, just trying to help too[/QUOTE]

don't worry, 2 minds are better than 1 ...

If nothing appears on screen then it should be OK (the connect and select) which the echoes will confirm, but if the echoes are duff and the error messages aren't being displayed that's another issue.

at the bottom of db.php, echo out $connection and $db - let's see what's in them...

[QUOTE=geneh23;1676915]@Smeagel13: No, the user table does not have a password associated with it and no, there is no default password for PHPMyAdmin..what do you mean by "make sure to close the connection?" and everything is in the same directory, no sub-folders.[/QUOTE]

You're creating a persistent connection, which will remain open until you explicitly close it ... Unlike mysql_connect which will lose it's connection at the end of the script.

I don't use EasyPHP or PHPMyAdmin so I can't help you on that.

Thing I would look at:

Check the user table to see if the user does have a password even if you did not choose one - does PHPMyAdmin default to one?

I'd also make sure you close the connection (yes, I know we don't have one at the minute hehe) at the end of the script with using persistent connections, forgive me if I missed that line but I didn't see it.

Check file security on db.php, can you access it? is it in the same directory as the main script?

Oops, missed that bit ...

[QUOTE]...it shows these errors now: "Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP-5.3.8.1\www\register.php on line 53[/QUOTE]

In my experience of this error, the cause is usually always a dodgy query returning FALSE or no connection to the DB.

This works:

[CODE]while ($row = mysql_fetch_array($result)) {

$word = strpos($row['Content'], $var);
$period = strripos(substr($row['Content'], 0, $word), ".");

if($word && $period) {

$content = substr($row['Content'], $period+2, 500);

} else {

// Didn't find the keyword, or there was no period before the word, what do you want to do, output everything?
$content = $row['Content'];

}

echo "Title: $title<br>Content: $content";

}[/CODE]

Hang on a tick, i'm thinking ... so far I have :

[CODE]while ($row = mysql_fetch_array($result)) {

$begin = strpos($row['Content'], $var);
$period = stripos($content, "."); // Swap for finding the right period?

if($begin && $period) {

$content = substr($row['Content'], $period+2, 500);

} else {

$content = $row['Content'];

}

echo "Title: $title<br>Content: $content";

}[/CODE]

Your algorithm needs changing, 2 things I can think of that would break it:

Searching for "brown" in "The quick brown fox."

Searching for anything in a string without a period.

Where is this code? If it's at the top of the HTML page then when you request the page (GET) you insert blank values into the database and then when the user submits the form (POST) the real values get inserted.

If this is the case then do the following:

[CODE]
<?php

if($_SERVER['REQUEST_METHOD'] == 'POST') {

// Do PHP Code (Form Insert)

}

// If the IF is false, no PHP code gets executed -- no blank submit.

?>[/CODE]

Can you insert this at line 19 and post the result:

[CODE]echo $sql;[/CODE]

I second the mysql_real_escape_string() ...

Not had much time to look but one thing that pops out is you're inserting a blank ID, just remove the ID field from the query and make sure it's set to auto_increment in the DB.

And I think from what you're asking, is you need to create additional age groups in the DB, Age_Group_Opt_1, Age_Group_Opt_2, Age_Group_Opt_3 and insert the values into those and if the user didn't give a value, then insert a NULL

Oh look at that! They've suddenly appeared!

Any new news on this? I've been waiting overnight for some to appear!