Jump to content

june_c21

Members
  • Posts

    280
  • Joined

  • Last visited

    Never

Everything posted by june_c21

  1. here is my code <?php include './includes/header.php'; $id = $_GET ['id']; $names = $_POST ['names']; $section = $_POST ['section']; $wo = $_POST ['wo']; $printer_name = $_POST ['printer_name']; $toner_code = $_POST ['toner_code']; $quantity = $_POST ['quantity']; $remarks = $_POST ['remarks']; $technician = $_POST ['technician']; $trainee = $_POST ['trainee']; $query= "INSERT INTO out( names , section , wo , printer_name , toner_code , quantity , remarks , technician , trainee ) VALUES ('$names','$section','$wo','$printer_name','$toner_code','$quantity', '$remarks','$technician','$trainee') "; $result = mysql_query($query,$dblink); $query= "UPDATE master SET qty= qty - $quantity WHERE id= $id"; $result = mysql_query($query,$dblink ); echo "Inventory Successfully Saved. "; ?> the error i get is #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'out( names , section , wo , printer_name , toner_code , quantity , remarks , tec' at line 1
  2. june_c21

    Query

    hi , can someone tell me what 's wrong with this query ? INSERT INTO out( name , section , wo , printer_name , toner_code , quantity , remarks , technician , trainee ) VALUES ('$name','$section','$wo','$printer_name','$toner_code','$quantity', '$remarks','$technician','$trainee') thanks
  3. hi , i want to select qty from master where id=$id , then i want to minus the qty = qty -1 and update in the query . here is my code . can tell me what went wrong ? $query= "SELECT qty FROM master where id=$id"; $result = mysql_query($query,$dblink); while($myrow = mysql_fetch_row($result)) { qty -= 1; $query = "UPDATE master SET qty='$qty' WHERE id= $id"; $result = mysql_query($query,$dblink); } thanks
  4. i try this code but still failed to login . Authorization Required. <?php //extract data from the post $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://135.27.130.204/stat123_01/nerc_1.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS.array ('username'=>'produce','password'=>'perform')); curl_exec ($ch); curl_close ($ch); ?>
  5. yes , i try this code <?php //$redirect = 'http://135.27.130.204/stat123_01/nerc_1.php'; //header ("location: $redirect"); class mycurl { protected $_useragent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1'; protected $_url; protected $_followlocation; protected $_timeout; protected $_maxRedirects; protected $_cookieFileLocation = './cookie.txt'; protected $_post; protected $_postFields; protected $_referer ="http://135.27.130.204/stat123_01/nerc_1.php';"; protected $_session; protected $_webpage; protected $_includeHeader; protected $_noBody; protected $_status; protected $_binaryTransfer; public $authentication = 0; public $auth_name = 'produce'; public $auth_pass = 'perform'; public function useAuth($use){ $this->authentication = 0; if($use == true) $this->authentication = 1; } public function setName($name){ $this->auth_name = $name; } public function setPass($pass){ $this->auth_pass = $pass; } public function __construct($url,$followlocation = true,$timeOut = 30,$maxRedirecs = 4,$binaryTransfer = false,$includeHeader = false,$noBody = false) { $this->_url = $url; $this->_followlocation = $followlocation; $this->_timeout = $timeOut; $this->_maxRedirects = $maxRedirecs; $this->_noBody = $noBody; $this->_includeHeader = $includeHeader; $this->_binaryTransfer = $binaryTransfer; $this->_cookieFileLocation = dirname(__FILE__).'/cookie.txt'; } public function setReferer($referer){ $this->_referer = $referer; } public function setCookiFileLocation($path) { $this->_cookieFileLocation = $path; } public function setPost ($postFields) { $this->_post = true; $this->_postFields = $postFields; } public function setUserAgent($userAgent) { $this->_useragent = $userAgent; } public function createCurl($url = 'nul') { if($url != 'nul'){ $this->_url = $url; } $s = curl_init(); curl_setopt($s,CURLOPT_URL,$this->_url); curl_setopt($s,CURLOPT_HTTPHEADER,array('Expect:')); curl_setopt($s,CURLOPT_TIMEOUT,$this->_timeout); curl_setopt($s,CURLOPT_MAXREDIRS,$this->_maxRedirects); curl_setopt($s,CURLOPT_RETURNTRANSFER,true); curl_setopt($s,CURLOPT_FOLLOWLOCATION,$this->_followlocation); curl_setopt($s,CURLOPT_COOKIEJAR,$this->_cookieFileLocation); curl_setopt($s,CURLOPT_COOKIEFILE,$this->_cookieFileLocation); if($this->authentication == 1){ curl_setopt($s, CURLOPT_USERPWD, $this->auth_name.':'.$this->auth_pass); } if($this->_post) { curl_setopt($s,CURLOPT_POST,true); curl_setopt($s,CURLOPT_POSTFIELDS,$this->_postFields); } if($this->_includeHeader) { curl_setopt($s,CURLOPT_HEADER,true); } if($this->_noBody) { curl_setopt($s,CURLOPT_NOBODY,true); } curl_setopt($s,CURLOPT_USERAGENT,$this->_useragent); curl_setopt($s,CURLOPT_REFERER,$this->_referer); $this->_webpage = curl_exec($s); $this->_status = curl_getinfo($s,CURLINFO_HTTP_CODE); curl_close($s); } public function getHttpStatus() { return $this->_status; } public function __tostring(){ return $this->_webpage; } } $cc = new mycurl(); ?> but got error Missing argument 1 for mycurl::__construct(), called in C:\wamp\www\test.php on line 134 and defined in C:\wamp\www\test.php on line 40
  6. how to write with curl () ? i not familiar with curl ()
  7. this is what nerc_1.php contain <?php include './includes/header.php'; $id = $_GET ['id']; $nerc = $_POST ['nerc']; $query1= "UPDATE event SET nerc= '$nerc' where id=$id "; $result1 = mysql_query($query1,$dblink); ?>
  8. Kindly look at my attachment and let me know how to auto input the username and password and redirect to the desire page. [attachment deleted by admin]
  9. still cannot . when i click on submit , it will still prompt me for username and password .
  10. in my website i create a link to a web page, but when click it will prompt for username and password . how to use session to embedded the username and password ? so that when other user click on the link , it will automatically redirect them to the page without prompt for username and password ? <p><strong>RCA DATABASE</strong></p> <p> <?php include './includes/header.php'; $id = $_GET['id']; ?> </p> <form enctype="multipart/form-data" method="post" action="nerc1.php?id=<?php echo $id ?>"> <p>NERC CODE <label> <input name="nerc" type="text" id="nerc" /> </label> <a href="http://135.27.130.204/stat123_01/nerc_1.php">Lookup</a></p> <p> </p> <label> <input type="submit" name="Submit" value="Submit"> </label> </p> </form> session_start(); # $_SESSION['username'] = 'produce'; $_SESSION['password'] = 'perform';
  11. oh, can i know how to exact the value ? any information given ? i don't really know how to read it .... the actual code is <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header><ECPAh:login xmlns:ECPAh="203.115.214.63">pnroll</ECPAh:login><ECPAh:password xmlns:ECPAh="203.115.214.63">pnroll</ECPAh:password></SOAP-ENV:Header><SOAP-ENV:Body><RSM:ReceiveSM xmlns:RSM="203.115.214.63"><message_type>1</message_type><application_id>1200</application_id><timestamp>29062010173314</timestamp><message_id>HgsMMOK1TJYSNHDSPzEg</message_id><language>0</language><message_text>STOP ALL</message_text><originating_address>60197029976</originating_address><destination_address>36099</destination_address><telco>CEL</telco></RSM:ReceiveSM></SOAP-ENV:Body></SOAP-ENV:Envelope>
  12. hi , anyone can help me to decode this message ? <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Header> <ECPAh:login xmlns:ECPAh="203.115.214.63">pnroll</ECPAh:login> <ECPAh:Password xmlns:ECPAh="203.115.214.63">pnroll</ECPAh:Password> </SOAP-ENV:Header> <SOAP-ENV:Body> < inside the body got: <RSM:ReceiveSM xmlns:RSM="203.115.214.63">
  13. when i echo $target it only display upload/ any idea what i miss out in that line $target = "upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ;
  14. HI , When i try to upload file , it said "Sorry, there was a problem uploading your file." Can someone let me know what is the problem ? <?php include './includes/header.php'; for ($i=1;$i<11;$i++) { $id = $_GET ['id']; $causes = $_POST ['causes'][$i]; if(empty($causes)) break; $corrective_action = $_POST ['corrective_action'][$i]; $name = $_POST ['name'][$i]; $date = $_POST ['date'][$i]; $completedate = $_POST ['completedate'][$i]; $remarks = $_POST ['remarks'][$i]; $status = $_POST ['status']; $query= "INSERT INTO corrective_action( id, causes, corrective_action, name, date, completedate, remarks ) VALUES ('$id','$causes','$corrective_action','$name','$date','$completedate','$remarks') "; $result = mysql_query($query,$dblink); $query1= "UPDATE event SET status= '$status' where id=$id "; $result1 = mysql_query($query1,$dblink); $target = "upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; //This is our size condition if ($uploaded_size > 350000) { echo "Your file is too large.<br>"; $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0) { Echo "Sorry your file was not uploaded"; } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } } $file_id = 3 ; $query = "UPDATE corrective_action SET file_name = '$target' WHERE file_id=$file_id"; $result = mysql_query($query,$dblink); $file_id ++ ; } ?>
  15. Hi , I got a question . How to stop enter the data into database when the $causes == NULL ? Here is my code <?php include './includes/header.php'; for ($i=1;$i<11;$i++) { $id = $_GET ['id']; $causes = $_POST ['causes'][$i]; $corrective_action = $_POST ['corrective_action'][$i]; $name = $_POST ['name'][$i]; $date = $_POST ['date'][$i]; $completedate = $_POST ['completedate'][$i]; $remarks = $_POST ['remarks'][$i]; $status = $_POST ['status']; $query= "INSERT INTO corrective_action( id, causes, corrective_action, name, date, completedate, remarks ) VALUES ('$id','$causes','$corrective_action','$name','$date','$completedate','$remarks') "; $result = mysql_query($query,$dblink); } $query1= "UPDATE event SET status= '$status' where id=$id "; $result1 = mysql_query($query1,$dblink); ?>
  16. Hi , I try to pass these array value to another php script but no data in the database except for 'status' and 'id'. can someone tell me what's wrong with my code ? <?php include './includes/header.php'; for ($i=1;$i<11;$i++) { $id = $_GET ['id']; $causes = $_POST ['causes'][$i]; $corrective_action = $_POST ['corrective_action'][$i]; $name = $_POST ['name'][$i]; $date = $_POST ['date'][$i]; $remarks = $_POST ['remarks'][$i]; $status = $_POST ['status']; echo $causes; //$query= "INSERT INTO corrective_action( id, causes, corrective_action, name, date, remarks ) VALUES ('$id','$causes','$corrective_action','$name','$date','$remarks') "; //$result = mysql_query($query,$dblink); } $query1= "UPDATE event SET status= '$status' where id=$id "; $result1 = mysql_query($query1,$dblink); ?>
  17. hi, i getting error when i try to execute this code for (i=1 ; i<11 ; i++) { echo "<tr>"; echo"<td><p><strong>[i]</strong></p></td> "; echo"<td><textarea name='causes[i]' cols='30' id='causes' value='$causes[i]'></textarea></td>"; echo"<td><textarea name='corrective_action[i]' cols='50' id='corrective_action' value='$corrective_action[i]'></textarea></td>"; echo"<td><input name='name[i]' type='text' id='name' value='$name[i]' /></td>"; echo "<td><input name='date[i]' type='text' id='date' value='$date[i]' /></td>"; echo "<td><textarea name='remarks[i]' cols='50' id='remarks' value='$remarks[i]'></textarea></td>"; echo"</tr>"; } anyone can tell me what's wrong ?? thanks a lot
  18. i not asking you to write the whole code for me . just guide me . for example, where to write the while loop ?
  19. how to do so ? i don't really get what you mean .
  20. hi , 1) why it only insert 1 line of data into the database only ? 2) how to make it input all the lines that user input and ignore the blank if user didn't input anything ? here is my html code <p><strong>RCA DATABASE</strong></p> <p> </p> <?php include './includes/header.php'; $id = $_GET['id']; $query = "SELECT * FROM corrective_action WHERE id=$id "; $result = mysql_query($query, $dblink); while($myrow = mysql_fetch_row($result)) { $id = $myrow [0]; $causes = $myrow [1]; $corrective_action = $myrow[2]; $name = $myrow[3]; $date= $myrow[4]; $remarks = $myrow[5]; } ?> <form name="form1" method="post" action="view_all1.php?id=<?php echo $id ?>"> <table width="1133" border="0" cellspacing="3" cellpadding="0"> <tr> <td width="20"><div align="center"><strong>No</strong></div></td> <td width="200"><div align="center"><strong>Causes</strong></div></td> <td width="317"><div align="center"><strong>Corrective Action </strong></div></td> <td width="146"><div align="center"><strong>Name Assigned </strong></div></td> <td width="133"><div align="center"><strong>Start Date (YYYY/MM/DD) </strong></div></td> <td width="296"><div align="center"><strong>Remarks</strong></div></td> </tr> <tr> <td><p><strong>1</strong></p> </td> <td><textarea name="causes" cols="30" id="causes" value="<?php echo $causes ?>"></textarea> </td> <td><textarea name="corrective_action" cols="50" id="corrective_action" value="<?php echo $corrective_action ?>"></textarea></td> <td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td> <td><input name="date" type="text" id="date" value="<?php echo $date ?>" /></td> <td><textarea name="remarks" cols="50" id="remarks" value="<?php echo $remarks ?>"></textarea></td> </tr> <tr> <td><strong>2</strong></td> <td><textarea name="causes" cols="30" id="causes" value="<?php echo $causes ?>"></textarea></td> <td><textarea name="corrective_action" cols="50" id="corrective_action" value="<?php echo $corrective_action ?>"></textarea></td> <td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td> <td><input name="date" type="text" id="date" value="<?php echo $date ?>" /></td> <td><textarea name="remarks" cols="50" id="remarks" value="<?php echo $remarks ?>"></textarea></td> </tr> <tr> <td><strong>3</strong></td> <td><textarea name="causes" cols="30" id="causes" value="<?php echo $causes ?>"></textarea></td> <td><textarea name="corrective_action" cols="50" id="corrective_action" value="<?php echo $corrective_action ?>"></textarea></td> <td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td> <td><input name="date" type="text" id="date" value="<?php echo $date ?>" /></td> <td><textarea name="remarks" cols="50" id="remarks" value="<?php echo $remarks ?>"></textarea></td> </tr> <tr> <td><strong>4</strong></td> <td><textarea name="causes" cols="30" id="causes" value="<?php echo $causes ?>"></textarea></td> <td><textarea name="corrective_action" cols="50" id="corrective_action" value="<?php echo $corrective_action ?>"></textarea></td> <td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td> <td><input name="date" type="text" id="date" value="<?php echo $date ?>" /></td> <td><textarea name="remarks" cols="50" id="remarks" value="<?php echo $remarks ?>"></textarea></td> </tr> <tr> <td><strong>5</strong></td> <td><textarea name="causes" cols="30" id="causes" value="<?php echo $causes ?>"></textarea></td> <td><textarea name="corrective_action" cols="50" id="corrective_action" value="<?php echo $corrective_action ?>"></textarea></td> <td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td> <td><input name="date" type="text" id="date" value="<?php echo $date ?>" /></td> <td><textarea name="remarks" cols="50" id="remarks" value="<?php echo $remarks ?>"></textarea></td> </tr> <tr> <td><strong>6</strong></td> <td><textarea name="causes" cols="30" id="causes" value="<?php echo $causes ?>"></textarea></td> <td><textarea name="corrective_action" cols="50" id="corrective_action" value="<?php echo $corrective_action ?>"></textarea></td> <td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td> <td><input name="date" type="text" id="date" value="<?php echo $date ?>" /></td> <td><textarea name="remarks" cols="50" id="remarks" value="<?php echo $remarks ?>"></textarea></td> </tr> <tr> <td><strong>7</strong></td> <td><textarea name="causes" cols="30" id="causes" value="<?php echo $causes ?>"></textarea></td> <td><textarea name="corrective_action" cols="50" id="corrective_action" value="<?php echo $corrective_action ?>"></textarea></td> <td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td> <td><input name="date" type="text" id="date" value="<?php echo $date ?>" /></td> <td><textarea name="remarks" cols="50" id="remarks" value="<?php echo $remarks ?>"></textarea></td> </tr> <tr> <td><strong>8</strong></td> <td><textarea name="causes" cols="30" id="causes" value="<?php echo $causes ?>"></textarea></td> <td><textarea name="corrective_action" cols="50" id="corrective_action" value="<?php echo $corrective_action ?>"></textarea></td> <td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td> <td><input name="date" type="text" id="date" value="<?php echo $date ?>" /></td> <td><textarea name="remarks" cols="50" id="remarks" value="<?php echo $remarks ?>"></textarea></td> </tr> <tr> <td><strong>9</strong></td> <td><textarea name="causes" cols="30" id="causes" value="<?php echo $causes ?>"></textarea></td> <td><textarea name="corrective_action" cols="50" id="corrective_action" value="<?php echo $corrective_action ?>"></textarea></td> <td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td> <td><input name="date" type="text" id="date" value="<?php echo $date ?>" /></td> <td><textarea name="remarks" cols="50" id="remarks" value="<?php echo $remarks ?>"></textarea></td> </tr> <tr> <td><strong>10</strong></td> <td><textarea name="causes" cols="30" id="causes" value="<?php echo $causes ?>"></textarea></td> <td><textarea name="corrective_action" cols="50" id="corrective_action" value="<?php echo $corrective_action ?>"></textarea></td> <td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td> <td><input name="date" type="text" id="date" value="<?php echo $date ?>" /></td> <td><textarea name="remarks" cols="50" id="remarks" value="<?php echo $remarks ?>"></textarea></td> </tr> </table> <p>Status : </p> <p><select name="status" id="status"> <option value="complete">complete</option> <option value="pending" selected="selected">pending</option> </select> </p> <p> </p> <label> <input type="submit" name="Submit" value="Submit"> </label> </p> </form> my php code <?php include './includes/header.php'; $id = $_GET ['id']; $causes = $_POST ['causes']; $corrective_action = $_POST ['corrective_action']; $name = $_POST ['name']; $date = $_POST ['date']; $remarks = $_POST ['remarks']; $status = $_POST ['status']; $query= "INSERT INTO corrective_action( id, causes, corrective_action, name, date, remarks ) VALUES ('$id','$causes','$corrective_action','$name','$date','$remarks') "; $result = mysql_query($query,$dblink); $query1= "UPDATE event SET status= '$status' where id=$id "; $result1 = mysql_query($query1,$dblink); ?>
  21. hi , i would like to write a bat script using PHP to close another .bat file and reopen the .bat again . Kindly guide me with it . Thanks
  22. sorry, i miss out something ... problem solved. thanks
×
×
  • 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.