Jump to content

aliento

Members
  • Posts

    169
  • Joined

  • Last visited

Everything posted by aliento

  1. Hello, I want to reduce the height of the rows of my table. Can this be done and how? Thank you
  2. Its simple. You wrote at the $strCart not one space but a lot between Name Price etc . PHP cant replace an unknown number of character set so you should go back to code and correct the $strCart to have one space. A stupid idea is : for($i=0;$i<count($strCart);$i++) $strCart[$i]; // the $strCart[$i] contains each character of the string with an if for every character and a counter you can delete the unwonted characters and replace them with one : I am too lazy and i cant write the all code Maybe somebody have a better idea ! ...
  3. replace the space with : $strCart = str_replace(" "," : ",$strCart); if i understood well!
  4. function request_data($database,$table) { include 'settings.php'; $fields = request_fields($database,$table); // another function $db = mysql_connect($db_host,$db_user, $db_pass); mysql_select_db($database,$db) or die("Cannot select the database.<br>" . mysql_error()); $sql="SELECT * FROM $table"; $result = mysql_query($sql,$db); while ($row = mysql_fetch_array($result)) for($i=0;$i<count($fields);$i++) { $field_s = $fields[$i]; $data[$field_s][]=$row[$field_s]; } mysql_close; return $data; } Is this possible? (to return an array?)
  5. I am trying to build an database application. I use the array $fields[] to store the fields of the table, when i use the function into the main content it is ok but into function it doesnt return the fields! The same with the data which i use a multy dimension array $data[$field][$num] . Is it wrong to return an array from a function?
  6. For the archive and better understudying i write the code below : php file : for($i=0;$i<count($fields);$i++) echo '<td>'.$fields[$i].'<input type="checkbox" name="field_check[]" id="c'.$i.'" /></td>'; //and for the onclick : for($iii=0;$iii<count($fields);$iii++) echo '<td onclick="check(\'c'.$iii.'\',\'c'.$ii.'\')">'; the javascript is : function check(n1,n2) { document.getElementById('n1').checked=true; document.getElementById('n2').checked=true; } I cant find any mistake. Can you?
  7. Ok i will make it simple . lets say i got this js function function check(n1) { n1 = "c" + n1; document.getElementById('n1').checked=true; } or function check() { chu = "checke"; document.getElementById('something').chud=true; } // the chu is the variable. and with the d makes checked? The question is how the javascript recognize the variable. I know php and html, i can read javascript and 'write' but i dont know the basics.
  8. I am trying to parse to the js function 2 variables. Each will be the id of the checkboxes.A want to check those 2 checkboxes.I use the variables into document.getElementById('n1').checked=true which the variable is the n1 but it doesnt recognize it as variable!
  9. hello. i am using this code to call the javascript function and change the attribute . The code to call the js function is (with php) onclick="check('.$ii.','.$iii.')" and the check function is function check(n1,n2) { document.getElementById('n1').checked=true document.getElementById('n2').checked=true } but it doesnt work.
  10. With the new Firefox everything works ok!
  11. Hello. I am using a script which loads into a div info by select html object. When i change selection it loads into the div and the previous content and the new one. How can i correct this?
  12. Hello. I am using a script which loads into a div info by select html object. When i change selection it loads into the div and the previous content and the new one. How can i correct this?
  13. Your question is very general. Post the code you want help and not all the script, no one will download the script to help you! :life is an human invention . They told us about life to afraid to death the death
  14. Hello. I am using ajax and php to communicate with mysql. I am using select box with onchange attribute to load the content into a div some info from a PHP script. It works grate for one time but when i change the select option for second time it returns the two contents into the same div. Why? Below is the code of the ajax which in is the problem! var xmlHttp function loadtables(str) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="tables.php" url=url+"?database="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("tables").innerHTML=xmlHttp.responseText } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } Thank you in advanced.
×
×
  • 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.