RE: [PHP] using mysql in php problem
> -Original Message- > From: Garth Hapgood - Strickland [mailto:[EMAIL PROTECTED] > Sent: 09 November 2004 11:27 > To: [EMAIL PROTECTED] > Subject: [PHP] using mysql in php problem > > > I have created a registration page > http://www26a.your-server.co.za/matchm/registration4.php > > On this page I have many fields, some of them pulling data out from my > database. I have a javascript validation scipt thats checks on > submission of > the form to see if all required fields are filled in correctly. > IF thats the case it should submit the form. Which it isnt doing! No need to go any further at this stage then. If your Javascript is not doing/allowing the form submission then you need to check that code, no point looking at the PHP code if it's never being called. [snip] > > I am not sure where exactly I am going so wrong, and it really is starting > to drive me crazy! Have you tried commenting out the Javascript validation and submitting the form? If the form then gets processed (by the PHP code) post your problem to a Javascript list/forum for advice. Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] using mysql in php problem
> I am not sure where exactly I am going so wrong, and it really is starting > to drive me crazy! > Regards > Garth Hi Garth, Looks like it's time to do some fairly standard debugging. Try putting error_reporting(E_ALL) at the top of the page in question. It may be that you're currently missing out on helpful error messages because E_NOTICE messages are suppressed by default. Also, try assigning your SQL statements to a variable and echoing them and them copying and pasting them directly either into the MySQL command line client or via the PHPMyAdmin SQL tab, if you have the package available (or via any other client that allows you to run SQL against your server which might report more verbose errors than your installation of PHP has been set to do). Ie something like: $sql = "INSERT INTO business_communication > (BusinessID,CommunicationType,Destination) VALUES ( '" . $id . "', 1, '". > $HTTP_POST_VARS['telnumber1'] . "')"; echo $sql; mysql_query($sql); ...and so on, for each of your SQL statements. Essentially, you're trying to make certain that the variables you've populated from your form actually contain the data you expect. It's entirely possible that one or more of your variables isn't populated correctly, and this is causing your statement(s) to fail, without an error being reported. Much warmth, Murray http://www.planetthoughtful.org Building a thoughtful planet, One quirky comment at a time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using mysql in php problem
Garth Hapgood - Strickland wrote: I have created a registration page http://www26a.your-server.co.za/matchm/registration4.php On this page I have many fields, some of them pulling data out from my database. I have a javascript validation scipt thats checks on submission of the form to see if all required fields are filled in correctly. IF thats the case it should submit the form. Which it isnt doing! It should start with submission after the validation check is passed. This part of the questions should be posted on a js list. Then I check to see whether the BusinessName & BusinessOwner already exist, if not then I am trying to to an insert (which it doesnt do either). Here is the php code: $errmsg = ""; $business_query = "SELECT BusinessName, BusinessOwner from business WHERE BusinessName = '$BusinessName' AND BusinessOwner = '$BusinessOwner'" ; $result = mysql_query($business_query); if (mysql_num_rows($result) > 0) {$errmsg .= "You are already registered at Match Makers";} You will do yourself a great service by punctuating indenting your code properly. If you read the code of some open source php scripts you will find that they are so much easier to read. else { if (isset($submit) == "Register Now"){mysql_query("INSERT INTO business (BusinessName, BusinessOwner, StreetAdress, Suburb, CityTown, ProvinceID, StreetCode, PostalAddress, PostalCode, WebsiteAddress, IndustryID, IndustryOther, ProductService, BusinessAge, AnnualTurnoverID, EmpowermentProfileID, BEEScoreCardID, PreferredLocationID, PreferredProductService, PreferredMatchPartner, PreferredIndustryID, PreferredIndustryOther, PreferredAgeID, PreferredTurnoverID, PreferredEmpowermentProfileID, DateRegistered, MarketSourceID) VALUES ('" . $HTTP_POST_VARS['business_name'] . "', '" . $HTTP_POST_VARS['street_address'] . "', '" . $HTTP_POST_VARS['suburb'] . "', $city_town, $province_desc, $street_code, $postal_address, $postal_code, $website_address, $industry_desc, $industry_other, $product_service, $business_age, '', '', '', '', '', '', '', '', '', '',)"); See what i mean :-) $id = mysql_insert_id(); ..snipped .. I am not sure where exactly I am going so wrong, and it really is starting to drive me crazy! The best thing to do is to liberally douse your code with error_log(mysql_error()) statement you will then start seeing error messages in your log (or your browser depending on your config) about what's going wrong. As has often been pointed out echoing out the queries produced by your php script and running them through the mysql client usually helps too. Regards Garth -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using mysql in php problem
I have created a registration page http://www26a.your-server.co.za/matchm/registration4.php On this page I have many fields, some of them pulling data out from my database. I have a javascript validation scipt thats checks on submission of the form to see if all required fields are filled in correctly. IF thats the case it should submit the form. Which it isnt doing! It should start with submission after the validation check is passed. Then I check to see whether the BusinessName & BusinessOwner already exist, if not then I am trying to to an insert (which it doesnt do either). Here is the php code: $errmsg = ""; $business_query = "SELECT BusinessName, BusinessOwner from business WHERE BusinessName = '$BusinessName' AND BusinessOwner = '$BusinessOwner'" ; $result = mysql_query($business_query); if (mysql_num_rows($result) > 0) {$errmsg .= "You are already registered at Match Makers";} else { if (isset($submit) == "Register Now"){mysql_query("INSERT INTO business (BusinessName, BusinessOwner, StreetAdress, Suburb, CityTown, ProvinceID, StreetCode, PostalAddress, PostalCode, WebsiteAddress, IndustryID, IndustryOther, ProductService, BusinessAge, AnnualTurnoverID, EmpowermentProfileID, BEEScoreCardID, PreferredLocationID, PreferredProductService, PreferredMatchPartner, PreferredIndustryID, PreferredIndustryOther, PreferredAgeID, PreferredTurnoverID, PreferredEmpowermentProfileID, DateRegistered, MarketSourceID) VALUES ('" . $HTTP_POST_VARS['business_name'] . "', '" . $HTTP_POST_VARS['street_address'] . "', '" . $HTTP_POST_VARS['suburb'] . "', $city_town, $province_desc, $street_code, $postal_address, $postal_code, $website_address, $industry_desc, $industry_other, $product_service, $business_age, '', '', '', '', '', '', '', '', '', '',)"); $id = mysql_insert_id(); if ($telnumber1 <> '') {mysql_query("INSERT INTO business_communication (BusinessID,CommunicationType,Destination) VALUES ( '" . $id . "', 1, '". $HTTP_POST_VARS['telnumber1'] . "')");} if ($faxnumber1 <> '') {mysql_query("INSERT INTO business_communication (BusinessID,CommunicationType,Destination) VALUES ( '" . $id . "', 2, '". $HTTP_POST_VARS['faxnumber1'] . "')");} if ($cellnumber1 <> '') {mysql_query("INSERT INTO business_communication (BusinessID,CommunicationType,Destination) VALUES ( '" . $id . "', 3, '". $HTTP_POST_VARS['cellnumber1'] . "')");} if ($emailaddress1 <> '') {mysql_query("INSERT INTO business_communication (BusinessID,CommunicationType,Destination) VALUES ( '" . $id . "', 4, '". $HTTP_POST_VARS['emailaddress1'] . "')");} echo "Your registration has been submitted"; } } I am not sure where exactly I am going so wrong, and it really is starting to drive me crazy! Regards Garth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php