Jump to content

immunity

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

immunity's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hm yes i dont need but i need to remove last :00 to put it inside my drop list thx!
  2. Hello i have a html that send times to php page (21:00) to make it valid time() i add string:00 right? so $string = 21:00; $string = $string.":00"; now how i make this string time ? how i add in that time 140 mins ?
  3. implode = add OR inside the values right ? (because i will have to put WHERE ... AND) ... Thank you very much sasa
  4. sorry about that :/ ok hear it is i have an html with input texts and i use this page to display member (from Mysql) via javascript i send the "returnvalues.php?account="+document.....value+"... so i get the page for example "returnvalues.php?account=immunity&password=000000&email=&city=" Now inside returnvalues.php I want to make query "Select * from account Where account ='immunity' AND password='000000'"; I dont know when account or password or email or city will be empty I have to use array (i think) so if ( $_GET['account'] !="" ) { add inside array "account='".$_GET['account']."' " } if ( $_GET['password'] !="") {add inside array "password='".$_GET['password']."' "} ...... So the array will be filled only from values those isnt "" No i create a string $sQuery "Select * from account "; and I want to add all the strings of array; (if array is empty = all variables was "" so we let the sQuery as it is and we get all the table member) (if array has values then we add if it's the index 0 "Where ".$a(in the index) if it's the index >0 " ".$a(in that index)
  5. Hello i am confused on php array :/ (no only C++ and Java arrays) so i have $1 $2 and $3 i want to add all inside an array $a then with a for ( int i=0 ; i<x ; i++) $string = $string." ".$a how i write in php code that i want ?
  6. for 2) code Explorer broswer (echoed sQuery) => Insert into account Values('δασδα' ,'α','asdad@in.gr','ασδζχψ','ασδασδ','ασδασδ','ασδς;ε','2222222222',0) Mysql Database (with putty) => | Ξ±Οδ΢ΟΟ | Ξ± | asdas@in.gr | Ξ±Οδ΢ΟΟ | Ξ±Οδαδ | Ξ±ΟΞ΄ | Ξ±ΟΡ΢ΟΟ | 2222222222 | 0 |
  7. Hello i try to pass greek words(f.ex Γιάννης ) from a input text of a form (in a html) via Javascript (document.form.sumbit()) i have as attitude of form acceptCharset="UTF-8"; if i type myself the greek words in variable at .php (not in html form) mysql update corrected if i type myself the greek words in .php?value1=...&value2=... and use $_GET['value1'] Mysql udate correct 1)when i try to pass with post there is the problem it appear me Ξ$*#Ξ%#Ξ$Ξ#Ξ$Ξ%Ξ while the word is "ογαμιαςογιαννης" (i put to echo the $sQuery that send to server and its wrong) 2) if i put in the .php header(...UTF-; While the sQuery printed on Browser CORRECTED , with my putty i see that Mysql Database updated INCORRECTED Anyone knows how i can send correct the UTF-8 values to the Mysql database? code of 1) and 2) //header('Content-type: text/html; charset=utf-8'); (these exist only in code of 2) ) $sInfo = ""; $sDBServer = "localhost"; $sDBName = "SSSSSS"; $sDBUsername = "SSSSSS"; $sDBPassword = "SSSSSS"; //create the SQL query string $sQuery = "Insert into account Values('$_POST[account]' ,'$_POST[password]','$_POST[email]','$_POST[location]','$_POST[name]','$_POST[lname]','$_POST[address]','$_POST[phone]',0)"; $oLink = mysql_connect($sDBServer,$sDBUsername,$sDBPassword); @mysql_select_db($sDBName) or $sInfo = "Unable to open database"; if($sInfo == '') { if($oResult = mysql_query($sQuery) ) { $sInfo= "correct.html"; } else{ $sInfo="wrong.html"; } } $sQuery2= "Select * from account"; //make the database connection $oLink = mysql_connect($sDBServer,$sDBUsername,$sDBPassword); @mysql_select_db($sDBName) or $sInfo = "Unable to open database"; if($sInfo == '') { if($oResult = mysql_query($sQuery) and mysql_num_rows($oResult) > 0) { $aValues = mysql_fetch_array($oResult,MYSQL_ASSOC); $sInfo = $aValues['name']."<br />".$aValues['address']."<br />". $aValues['e_mail']."<br />".$aValues['Password']."<br />". $aValues['location']."<br /><br />Phone: ".$aValues['account']."<br />"; } } mysql_close($oLink); echo $sInfo; echo $sQuery; ?>
  8. when i try to put : var text = document.getElementById("account").value; it popup me this error :/ Also this error pop up when i try if(IsNumeric()){....} function IsNumeric() { var ValidChars = "0123456789."; var IsNumber=true; var Char; for (i = 0; i < document.getElementById("phone").value.length && IsNumber == true; i++) { if (ValidChars.indexOf(document.getElementById("phone").value.charAt(i)) == -1) { IsNumber = false; } } return IsNumber; }
  9. function postForm() { var url2 = "register2.php"; var params = "account=testisok&email=yeah"; http.open("POST", url2, true); //Send the proper header information along with the request http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.send(params); http.onreadystatechange = function() { if(http.readyState == 4 && http.status == 200) { alert(http.responseText); http.abort(); } } } function getHTTPObject() { var xmlhttp; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject){ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); if (!xmlhttp){ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } } return xmlhttp; } var http = getHTTPObject(); // We create the HTTP Object
  10. Hello in my display.htm i try to check if account / email exists (via Get Ajax) and it works fine then i try to post the values and pop up an alert box (registretion completed / there was a problem) althought (with putty) i see the mysql database was fast informed 1)I have to wait ~30sec until pop up box alert (http.requestText) (from the register.php file) 2) i have to press 2 times the sumbit bottun so second http request happends (1 time press only first http object that do Get Ajax works) <html> <head> <title>Customer Account Information</title> <script type="text/javascript"> var url = "check.php?account="; var permit = 0; function check() { if ( document.getElementById("account").value !="" && document.getElementById("email").value !="" ) { if ( emailCheck() ) { checkAccount(); } } else { alert("Ξ Ξ±ΟΞ±ΞΊΞ±Ξ»Ο ΟƒΟ…ΞΌΟ€Ξ»Ξ·ΟΟστε Ολα τα στοιχεία"); } if (permit ==1) { postForm(); } } function handleHttpResponse() { if (http.readyState == 4) { if(http.status==200) { var results=http.responseText; var test = results; if (test.match("2account1")== "2account1" ) { alert("Το ΟΞ½ΞΏΞΌΞ± λογαΟιασμου (account)υπάΟχει ήδη!\nΞ Ξ±ΟΞ±ΞΊΞ±Ξ»Ο Ξ΄ΞΉΞ±Ξ»Ξ­ΞΎΟ„Ξµ κάποιο άλλο"); document.getElementById("account").value =""; document.getElementById("account").select(); } else if ( test.match("2email1") == "2email1" ) { alert("Το e-mail που εισάγατε υπάΟχει!\nΞ Ξ±ΟΞ±ΞΊΞ±Ξ»Ο Ξ΄ΞΉΞ±Ξ»Ξ­ΞΎΟ„Ξµ κάποιο άλλο"); document.getElementById("email").value =""; document.getElementById("email").select(); } else if (test.match("2accountemail1") == "2accountemail1" ) { alert("To account ΞΊΞ±ΞΉ το e-mail που βάζετε υπάΟχουν!\nDeja-vu ?!?!?!?"); document.getElementById("email").value =""; document.getElementById("account").value =""; document.getElementById("account").select(); } else { http.abort(); permit=1; } } } } function emailCheck() { var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if(document.getElementById("email").value.length<1) { alert("dasdasdas e-mail"); return false; } else if(!regex.test(document.getElementById("email").value)) { alert("Το e-mail που εισάγεται δεν ΞµΞ―Ξ½Ξ±ΞΉ Ξ­Ξ³ΞΊΟ…ΟΞΏ(Pro site)!\nΞ Ξ±ΟΞ±ΞΊΞ±Ξ»Ο ΞµΞΉΟƒΞ¬Ξ³ΞµΟ„Ξ±ΞΉ κάτι σαν name@domainname.com"); return false; } return true; } function checkAccount() { var sId = document.getElementById("account").value; var sEm = document.getElementById("email").value; http.open("GET", url + escape(sId)+"&email=" + escape(sEm), true); http.onreadystatechange = handleHttpResponse; http.send(null); } function postForm() { //var httppost = new getHTTPObject(); var url2 = "register2.php"; var params = "account=testisok&email=yeah"; http.open("POST", url2, true); //Send the proper header information along with the request http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.send(params); http.onreadystatechange = function() { if(http.readyState == 4 && http.status == 200) { alert(http.responseText); http.abort(); } } } function getHTTPObject() { var xmlhttp; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject){ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); if (!xmlhttp){ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } } return xmlhttp; } var http = getHTTPObject(); // We create the HTTP Object </script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head> <body> <p>Enter customer ID number to retrieve information:</p> <p>Account: <input type="text" id="account" value="" /></p> <p>E-mail :<input type="text" id="email" value="" /></p> <p><input type="button" value="Register" onClick="check()"/></p> <div id="divAccountInfo"></div> </body> </html>
  11. I try to craft Ajax. I got a .php file which it gives $sInfo variable values 0 (if no rows returned ) or 1 (if one or more rows returned) with javascript i get this echo on var results. I want to create if (results ==0 ){ give element value ="not exists" } if(results ==1) {give element value ="exists"} but compiler doesnt go inside one of these 2 if I checked without if and element get value = result (display in broswer 0 or 1) how i can compare results ? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Customer Account Information</title> <script type="text/javascript"> var url = "GetCustomerData.php?id="; // The server-side script function handleHttpResponse() { if (http.readyState == 4) { if(http.status==200) { var results=http.responseText; if(results==1) { results ="exists"; document.getElementById('divCustomerInfo').innerHTML = results; } if (results==0) { results ="not exist"; document.getElementById('divCustomerInfo').innerHTML = results; } } } } function requestCustomerInfo() { var sId = document.getElementById("txtCustomerId").value; http.open("GET", url + escape(sId), true); http.onreadystatechange = handleHttpResponse; http.send(null); } function getHTTPObject() { var xmlhttp; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject){ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); if (!xmlhttp){ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } } return xmlhttp; } var http = getHTTPObject(); // We create the HTTP Object </script> </head> <body> <p>Enter customer ID number to retrieve information:</p> <p>Customer ID: <input type="text" id="txtCustomerId" value="" /></p> <p><input type="button" value="Get Customer Info" onclick="requestCustomerInfo()" /></p> <div id="divCustomerInfo"></div> </body> </html>
  12. no need to be sorry i am greatful that you even try to help
  13. same problem but i think you are wrong about brace } in your code there are 3 } and 2 { in my code its 2 } and 2 {
  14. still the same :/ error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/other/db2student/labdb219/public_html/asdf.php on line 20
×
×
  • 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.