Jump to content

bugcoder

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by bugcoder

  1. Hi everyone, dont know its possible or not but can we transfer mysql database in microsoft visio by exporting its schema or data. Is there any way around?
  2. <?php class myclass { // constructor function myclass() { return(true); } // method 1 function myfunc1() { return(true); } // method 2 function myfunc2() { return(true); } } $class_methods = get_class_methods('myclass'); // or $class_methods = get_class_methods(new myclass()); foreach ($class_methods as $method_name) { echo "$method_name\n"; } ?> The above example will output: myclass myfunc1 myfunc2
  3. before foreach loop on every varialbe add extra check of isset and !empty like if( isset($variable) && !empty($variable)){ foreach loops }
  4. might be you have to use array_key_exists instead of in_array.
  5. i will give you outline but cant give exact code due to lack of programing in structured php as i use cakephp $result = mysql_query("select * from completion"); $item_list = $_POST['item']; //then loop on its result like for(.......){ // get id here of record if(in_array($id,$item_list) ){ //its 1 here }else{ //its 0 here } }
  6. Instead of looping on $_POST data first bring record from table and loop on it and inside that loop check $_POST by in_array and if returns true consider it one else zero.
  7. The reason of this that i am getting is that you have hardcoded value=1. I think you should remove this attribute of value=1 and you will be able to get values of checkboxes either checked or not checked.
  8. try to change the name of drop down name from "name" to something else, works?
  9. an array is always consists of key value pair e.g $numericArray = array(1=>'apple',2=>'orange'); or $associativeArray = array('shoe'=>'abc','cloaths'=>'xyz') when we loop throw both then in $numericArray $key will be 1,2 and values will be apple and orange and in $associativArray $key will be shoe, cloaths and values will be abc and xyz you can do so foreach($anyArray as $key=>$value){ echo $key . ' = ' . $value; }
  10. try like this $discount2 = '12,000'; $discount3 = '1.00'; $discount4 = '10,000.01'; $result = str_replace(',','',$discount2)+str_replace(',','',$discount3)+str_replace(',','',$discount4); $result = number_format($result, 2);
  11. though its a html question but here is the solution use divs for this purpose. wrap code of table in one div and of footer in another div and use style = "float:left" or "style=float:right" in divs to handle alignments
  12. remove etc space before <?php and write session_start() right after <?php with only one space. there should be no spaces on session page before its start.
  13. I would suggest that you use id instead of name and you can handle www.xyz.com/productName by .htaccess file and that will be good too from search engine optimisation point of view. For .htaccess usage search "url rewriting tutorials" and you will find many.
  14. $con = mysql_connect("localhost","username","password"); instead of it give the username and password of your localhost database username password by default it should be like $con = mysql_connect("localhost","root","");
  15. cant get exactly what can be the issue but will like to know that what you will get after adding following line on both pages. error_reporting(E_ALL);
  16. try this line "UPDATE table SET field='$new' WHERE id=$loop[id]"
  17. probably there is nothing in fetched array. try to see the page view source too.
  18. well its an example that might work for you.
  19. http://www.phpbuilder.com/tips/item.php?id=93
  20. try like this <?php $class = ($important == 1) ? 'mainrow1' : 'mainrow'; echo '<tr class="$class" >'; ?>
  21. $_POST[starter] should be like $_POST['starter'] and others too similarly. you assign these POST values to variables and use that variables inside query. you will have to use single quotes but only for those table fields which are non numaric.
  22. code should be like this <?php foreach($_POST['userID'] as $uID) { $productaccess1 = isset($_POST[$uID.'_PA1']) ? '1' : '0'; $productaccess2 = isset($_POST[$uID.'_PA2']) ? '1' : '0'; $productaccess3= isset($_POST[$uID.'_PA3']) ? '1' : '0'; $productaccess4 = isset($_POST[$uID.'_PA4']) ? '1' : '0'; $deleterecord = isset($_POST[$uID.'_DEL']) ? '1' : '0'; $productaccess1a = "No"; $productaccess2a = "No"; $productaccess3a = "No"; $productaccess4a = "No"; $theirpassword = random_password($password); // encrypts the randomly generated 8 digit password into 32 digit hash $their_password = md5($theirpassword); } function random_password($password) { $vowels = 'aeuy'; $consonants = 'bdghjmnpqrstvz'; $length = 8; $strength = 4; if ($strength & 4) { $vowels .= "AEIOU"; $consonants .= 'BDGHJLMNPQRSTVWXYZ23456789'; } if ($strength & { $consonants .= '@#$%'; } $password = ''; $alt = time() % 2; for ($i = 0; $i < $length; $i++) { if ($alt == 1) { $password .= $consonants[(rand() % strlen($consonants))]; $alt = 0; } else { $password .= $vowels[(rand() % strlen($vowels))]; $alt = 1; } } return $password; } ?>
×
×
  • 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.