Jump to content

sayedsohail

Members
  • Posts

    468
  • Joined

  • Last visited

    Never

Everything posted by sayedsohail

  1. As you have noticed, the insert command is nested its just performing the insert wihtout doing the validation, the problem is at the validation, which i changed, still the same problem. if(isset($_POST['submit'])) { if ((!empty($_POST['cname'])) && (!is_string($_POST['cname'])) && (!strlen(trim($_POST['cname'])>30))) { print 'Please Enter a valid company name'; exit; } else { $q1 = "insert into clients (member_id, name, address_1, p_code, city, l_line, mobile) VALUES ('".$_SESSION['SESS_MEMID']."', '$_POST[cname]','$_POST[address]','$_POST[postcode]', '$_POST[city]','$_POST[phone]', '$_POST[mobile]')"; mysql_query($q1) or die(mysql_error()); print '<script>self.close()</script>'; } }
  2. Hi, I am trying to validate post variable (cname) but function doesn't do anything just insert the records in my table. Any advise. if(isset($_POST[submit])) { if ((!empty($_POST[cname])) && (!is_string($_POST[cname])) && (!strlen(trim($_POST[cname])>30))) { print 'Please Enter a valid company name'; exit; } else { $q1 = "insert into clients (member_id, name, address_1, p_code, city, l_line, mobile) VALUES ('".$_SESSION['SESS_MEMID']."', '$_POST[cname]','$_POST[address]','$_POST[postcode]', '$_POST[city]','$_POST[phone]', '$_POST[mobile]')"; mysql_query($q1) or die(mysql_error()); print '<script>self.close()</script>'; } }
  3. I wish to validate phone number, address with numbers, letters, whitespaces and commas. That's all i wanted to validate. thanks
  4. Hi, I don't know where i am wrong, but this functions are not at all verifying the value function checkNumeric( strng ) { var error = ""; var passPattern = new RegExp("/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/"); if(!passPattern.test(strng)) { if(strng == "") { error += "Pleae neter the Phone and Mobile numbers.\n"; } else if((strng.length < 11) || (strng.length > 12)) { error += "The phone number is wrong lenght, it should be 01332600090.\n"; } else { error += "The phone number contains illegal characters.\n"; } } return error; } function checkEmpty(strng) { var error = ""; var strTemp = strng; strTemp = trimAll(strTemp); if(strTemp.length < 1){ error += "Please enter company name.\n"; } return error; }
  5. I am not sure this is the problem in your while loop you use $aql do you think it should be $sql. while($aql = mysql_fetch_array($rql)) Any errors, can you please describe your problem, what is happening any error code etc. regards
  6. Can i suggest you something like this Just create a test.php file and do a small query and see what it does; A) $DBSERVER = "127.0.0.1"; $DATABASENAME = "somedb"; $USERNAME = "root"; $PASSWORD = "password"; $slq=query.... b) can you able to see your local server when you type http:\\localhost\anyhtmlfile.
  7. $dbhost = "localhost"; $dbuser = "name"; $dbpass = "password"; $dbname = "bathdata"; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error Connecting to mysql'); mysql_select_db($dbname); $query = "SELECT * FROM table"; $result = mysql_query($query) or die(mysql_error()); $numrows = mysql_num_rows($result); if ($numrows == 1) {$row = mysql_fetch_assoc($result);} echo "$row[fieldname]"; see if returns any rows
  8. In my opinion, your password is not stored in md5 format, if you are using phpmyadmin than edit the record and select the function column to md5, this way it will convert your stored password value to md5 format. Any also try adding this into your code and see what it does. if ($num == 1) { echo "No records found";} goodluck
  9. use the if and switch condition to verify your link value and than set your navigaton. If hope this helps. a valuable website is www.dynamicdrive.com for dynamic menus.
  10. <?php $str ="0.1.1"; if (strlen($str) ==5) { echo "0$str";} // 6 ?>
  11. please guys add your code, so we can look at it. thanks
  12. is your application on webserver or localwebserver? if you change the location than your sql connect variable need to be changed.
  13. yes you can use functions like strpos strlen http://www.phpbuilder.com/manual/en/function.strlen.php
  14. You mean installed dns server on my webserver? By the way my incoming broadband is assigning a dynamic ip everytime i connect. Do i need to have a static ip from my isp to configure on dns. please advise?
  15. How do i host my application/website on my server. I got a very high spec server and a registered domain. Can someone advise the next step to set up my own webserver for external users.
  16. Hi, Recently I built a php application and wish to publish this on my server. (Yes offcourse I have a registered domain and a very high spec server). Can someone advise how to make my application available to internet users using my server. I don't wish to use any hosting company. any information is highly appreciated.
  17. I would suggest you to just create separate php file and test the connection and print the error. I agree with the above comment, it has more to do with your database connectivity issue.
  18. I was just wondering, if I am missing something for not using PEAR in my application.
  19. Hi, I am a newbee to Php AND wish to know what PEAR is and how does it works, what sort of configuration we need to do in our php.ini etc. By the way i am using php 5.1 and the latest version of mysql. What do i need to know to incorporate PEAR in my development.
×
×
  • 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.