Jump to content

mglover88

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mglover88's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Done it. Must have spent way too long trying to fix the problem without a break. Didn't need to connect remotely . Just had to export sql files from local database, import them to remote database and update the 'connections' file manually. Amazing how much clearer you think after a break. Thanks for your reply though.
  2. Hi, thanks for your reply. I don't really understand too much about php and mysql databases. I'm kind of learning as I go in order to build my own website and could possibly be doing something wrong if it's not very common that people need to connect to the mysql databases through their host. Basically, I have a blog area to my site which I have developed a CMS area for so I can easily update/delete/manage posts and display and archive and recent post list in the sidebar. I have done this using my wamp testing server and used the mysql database link included in that to build a database for storing posts to my blog. This all works fine locally and I can login to the CMS and add/delete/manage posts as needed. Now, to be able to make this work live on the web I was under the impression that I would have to do exactly what I have done locally but use the mysql database provided as part of my ipage account instead of the wamp one. But I feel like what I'm trying to do is quite basic and if not many people need to connect remotely then I should probably be doing it another way.
  3. Hi, I'm creating a website for myself that involves a blog so I created a pretty simple CMS area that connects to a mysql database to retrieve blog posts and enables me to add, update, delete as and when. I've tested this using the testing server and everything is working absolutely spot on. However, when trying to establish a connection to my remote database server (hosted by ipage) in Dreamweaver it returns an error that says: MySQL Error#:2002 No connection could be made because the target machine actively refused it. I have been led to understand this means iPage do not allow their customers to connect remotely to databases. However, I just wanted to know if there is anyway round this problem that does not involve me moving to another web host and paying more money. For example, being able to use a separate database server to connect to via Dreamweaver while still hosting the website on iPage. Thanks in advance.
  4. Ah ok , that's definitely working fine now. Thanks a lot, really appreciate it.
  5. Actually, no that's not working. The notice that the variable is undefined goes away when I first open the page, but the calculator doesn't work now as it is taking the value to always be $bmi = '' so it displays 0 whatever information I put into the calculator.
  6. Awesome. Thanks very much, it's always something simple that I miss.
  7. Hi all, I need to add a BMI (Body Mass Index) calculator to my site. The calculator works but when the page is first opened (before any info has been put into the calculator) the page displays the message "Notice: Undefined variable: bmi in C:\wamp\www\bmiCalculator.php on line 242" where the final calculation will be displayed. I was just wondering if anyone knows how to fix this or if it's anything at all to do with the fact I am using it on a testing server at the moment? The code I am using to power the equation is as follows: <?php if ((isset($_POST["done"])) && ($_POST["done"] =="y")){ $height = ((12 * $_POST["feet"])); if ((isset($_POST["inches"])) && ($_POST["inches"] > 0)){ $height = $height + $_POST["inches"]; } $bmi = ($_POST["lbs"]) / ($height * $height) * 703; } ?> And the actual calculator is in a table as follows: <form method="post" name="bmiForm" action="<?php echo $_SERVER['PHP_SELF']; ?>" > ... <tr> <td><label> <input type="submit" name="Submit" value="Calculate" tabindex="40" /> <input name="done" type="hidden" value="y" /> ... <tr> <td>your BMI is:</td> <td class="bold"><?php echo round($bmi,1); ?></td> <td> </td> </tr> </table> </form> Thanks in advance for any help.
  8. Hi, I was just wondering if it were possible (and if so how) to open a page in a new window when submitting a form via php? E.g. I have a poll on my website that is directed to the reults page by $insertGoTo = "results.php";. This all works but what I want to happen is for when the user clicks submit that the results page displays in a new window (or at the very least a new tab), similar to what would happen when you put a target=_blank on a html link. Any help would be very appreciated. Thanks.
  9. Hi, I have a registration form built in dreamweaver designed to insert data into my database through PHP, with some of the fields in my form optional to the user. My understanding is that I should set these 'optional fields' to NULL in mysql in order to be able to proceed with the registration should the user choose not to enter any data. This appears to work fine and the website moves on as required upon the form being submitted. However, should the user choose to enter something into one of these fields marked NULL in mysql the data is lost and when I look at the inserted row it simply says NULL, regardless of what data the user has entered in the form. If I go the other way and mark the field NOT NULL then the data appears correctly, only for the user to get an error message saying 'column cannot be null' should they decide to leave it blank. I am a newbie to the world of PHP and mysql so am probably missing something simple, but have been told that the problem is probably in my PHP coding by someone on a different forum. Any help would be much appreciated, I think the problem could lie in the following coding: <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } Thanks in advance.
×
×
  • 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.