Jump to content

wolfan

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wolfan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you for the suggestions, but I tried running rml2pdf on a number of different places on my server and it ran just fine. Also, I searched the server for the file which was generated and it's no where to be found.
  2. You do not need strip_slashes when pulling from a $_POST because it automatically happens. As per this page in the PHP manual: http://php.net/manual/en/function.stripslashes.php But as far as your error is concerned. The error you described Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in x on line x means that that which was passed to mysql_num_rows is not actually data from a SQL query. Which means an error happened in your query. Usually in your SQL. Change the line $result=mysql_query($sql); to $result=mysql_query($sql) or die(mysql_error()."<br/>".$sql); What this will do is force the system to die if there is an error in your sql query and then output what was passed to the query and what the error was.
  3. Hi There, I have a problem with this piece of code and I'm hoping someone can help me. The code actually does execute as I expect, the problem is with the line which executes a shell script. What it does is generate a PDF file on the server after calling that command which is a python script to generate PDFs. I then download the PDF from the server. The problem is that the command takes more a few seconds to work, so it gets to the end before the PDF actually has time to generate and when I check the server the text file ($filename) is created but not the PDF. When I run the exact same command that is run in "$result = `rml2pdf $filename`;" it works just fine but just after a second. As you can see I thought trowing a pause in there would help that, but it didn't. die($result) returns nothing. Can anyone help? ***SNIP*** $fieldList = array('Telephone'=>array('Telephone','text'), 'Fax'=>array('Fax','text'), 'FName'=>array('Full Name','text'), 'Title'=>array('Title','text'), 'Email'=>array('Email','text')); $pdfFileName = 'buscard'.$id.'.pdf'; $filename = 'temprml'.$id.'.rml'; if(isset($_POST['btnSubmit'])) { foreach($fieldList as $k=>$v);{ $rml = str_replace("!".$k."!",$_POST[$k],$rml); } $oFile = fopen($filename,'w') or die("Can't open file"); fwrite($oFile, $rml); fclose($oFile); $result = `rml2pdf $filename`; echo $result; sleep(15); $result = trim($result); header('Content-Type: application/octet-stream'); header("Content-Disposition: attachment; filename=$pdfFileName"); header('Content-Transfer-Encoding: binary'); readfile($pdfFileName); } ***SNIP***
×
×
  • 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.