Jump to content

gally

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by gally

  1. gally

    PHP CLI

    Hi guys, First of all... HAPPY NEW YEAR TO EVERYONE Well, Ive some scripts which works as they are expected to do when used with the browser. Now I would like to use them within a terminal (rxvt). I made some modifications and everything is ok but Im acing a "big" problem with the forms. Dont know how to handle the action tag. Im sure that the code will explain everything. echo "1 - AA 2 - BB 3 - CC 4 - DD\n\n"; $handle = fopen ("php://stdin","r"); $inp = fgets($handle); switch ($inp){ case 1: exec('php /foo/foo1/foo2/myfile.php'); break; ..... default: echo "\033[1;31m \n\n\n\n WRONG INPUT\n\n\n\033[00m"; die(); } I correctly read the input ($inp) but when its timie to execute the option1 I get the prompt. Any idea? Thank you in advance
  2. Hold on. The query is ok if I display the result on the "normal screen", it fails if I want to see the result into the popup window. The code of the quesry is the same. In the code below if I remove "onSubmit="return popitup('printer1.php')"" from the <form.... it works very well
  3. Hi all, Ive a php script which reads and outputs some data. It works very well when data are displayed, let me call this way, in the browser but get following error if I try to display them in a popup window. This is the error message I get Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /hdb1/foo/Gestione/dati/printer1.php on line 103 What I know about mysql, not too much to be honest) is that the error is shown when mysql cant read the DB, but this happens only if I use the popup window This is the script which opens the popup <script language="javascript" type="text/javascript"> <!-- function popitup(url) { newwindow=window.open(url,'name','height=300,width=400'); if (window.focus) {newwindow.focus()} return false; } // --> </script> and this is the command to activate it. <form method='post' name='alfa' action='printer1.php' onSubmit="return popitup('printer1.php')" > <input type = 'hidden' name = 'opzione' value = "<?php echo $option; ?>" /> <input type = 'hidden' name = 'testo' value = "<?php echo $cerca; ?>" /> <input class = 'input' value = 'Print' type = 'submit'/> </form> and finally the php code which calls mysql $db = mysqli_connect($db_host,$db_user, $db_password) or die('Connessione a MySql fallita. Controllare i dati di configurazione: ' . mysqli_connect_error($db)); mysqli_select_db($db,$db_name) or die('Selezione del DB fallita. Controllare il nome del DataBase: ' . mysqli_error($db)); $result = mysqli_query($db,"SELECT * FROM $db_table WHERE $option LIKE \"%$cerca%\" ORDER BY $sort LIMIT 0,1000"); $num_rows = mysqli_num_rows($result); any hint?
  4. previous answer: I wasnt clear. My script can mount the device but cant umount it :-) last answer: Can you help me? I really dont know how to do this
  5. it has permissions to mount since the mount command works correctly
  6. I wrote a scrit which mounts an external device, makes some backups then umount the device. Everything works ok when I run the script under Eclipse PHP debugger but fails to unmount the device if I run it as localhost. this is the code $umount = '/bin/umount -f '.$drive; .... u_mount($umount, $error=512); .... This is the called function function u_mount($cmd, $error) { $output = array(); $return_var = 0; $return_var = exec($cmd, $output, $return_var); $return_var = $return_var + $error; .... some checks } In both cases (Eclipse and localhost) $return_var is always 0 but in localhost the umount is not executed and the device is still mounted Any idea? Thanks in advance Gally
  7. OK!!! Its perfect. THANK YOU VEY MUCH AGAIN. I dont know the procedure, but someone should add "SOLVED"
  8. Thank you very much, Ill try it immediately and let you know
  9. if Im not wrong your code makes a check to see if the form is sent or not. If so, is not my whish. Be patient. I try to explain it in another way. This is the situation: file main.php usual stuff here <form method="POST" name="onename" action="foo.php"> .... other stuff here .... <input align = "center" type="submit" value="Scegli"> </form> file foo.php <html> <body> <?php .... elaboration here .... ?> [color=red]<form method="get" name="whatyouwant" action="main.php"> <input value="Again" type="submit"> </form> [/color] <----- the red should be removed [color=green]go [b]imeediately[/b] to "main.php" without asking[/color] this is what I vould like </body> </html> Hope this time the example is clear
  10. Im sorry but english is not my mother tongue so its difficult for me to explain what I want. I have a "main" file (A) with a form. The "action" command of this form is to call another file (B) which processes the data received from the previous form. When elaboartion is over, following code ask the user if he wants to return to the "main" form to introduce new data. <p align = "center"><form method="get" name="bidibodibu" action="main.php"> <input align="center" value="Again" type="submit"></p> </form> Well, what I would like is a piece of code which allows the user to return to the "main" form without having to click on "Again". I mean: as soon as the process is over the user is presented with the "main" form. Again... the script on file (B) must return control to file (A) instead of waiting the choice of the user If the user (me .-) ) doesnt want to introduce new data leaves the script in other ways.
  11. Hi guys, I have a form in a php file which calls another file for the elaboration. When job ends a submit command returns to the main form in the first file. How can I return "immediately" to the main form without the submit command? Thank you in advance
  12. It seems to wok. Thank you very much
  13. Hi guys, I've found a tool which transforms my MySql data in a .png graph image. I use it inside a script and everything seems work nice. The problem is that only the first created graph is shown. I' try to explain. I've some Db tables, I select one to create the graph and it's shown, then I select another Db table, but it's shown always the first. Looking inside the directory where the 2nd .png is created, I see data from the 2nd table, while from inside the script I see the 1st .png I tried to remove the 2nd file from the dir, but nothing changes, so I think the 1st file is read fron the firefox cache. Is there a way to clear the cache from inside a php script? Following is part of the code actually I use ... $graph->Stroke("pippo.png"); //creates the image echo "<img src = 'pippo.png' alt='grafico 1' />"; //shows the above image if(is_file('pippo.png')) //remove the image from the dir for next processing unlink('pippo.png'); Thank you in advance
  14. gally

    printing

    Hi guys, I'm new to this forum and with PHP, be patient, pls. :-) I'm using PHP to manipulate some MySql data. All the operations are sent to the browser. I'ld like to send data to a printer. I didn't find any information about this, can you help me?
×
×
  • 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.