Jump to content

php to rtf


beezza

Recommended Posts

I am making a website for a client using PHP and mySQL. I am new to these languages but so far havent had a hard time at all learning. The website i have been asked to make is a resume builder site. I have created forms that get information such as contact info, education history, work expierence, key strengths and skills, etc. This information is stored in a sql database. I want the info from the sql database to be put onto 1 of 4 resume templates i have. The final product should be a rtf file, which i have used in wordpad to create the resume markup code. I guess im having issues with how to code the create_rtf php script to account for the fact that the user may add multiple education histories, and multiple skills. Im just a total block as to account for this. Any help is appreciated.

 

 

this is what i have so far:

 

<?php

$connection = mysql_connect('localhost', 'user', 'pass') or die('unable to connect');

 

mysql_select_db('dbhosts_downloadmyresume') or die('unable to select database') ;

 

$query = 'SELECT * FROM test_contact' ;

$result = mysql_query($query) or die('error in query: %query. ' . mysql_error()) ;

 

 

 

if (mysql_num_rows($result) > 0)

{

$file = '/home/dbhosts/public_html/resume/rtf.rtf' ;

 

$fh = fopen($file, 'w') or die('could not open file!') ;

 

while($row = mysql_fetch_object($result))

{

        $first_name = $row->contactFname ;

$last_name = $row->contactLname ;

$street = $row->contactStreet ;

$city = $row->contactCity ;

$state = $row->contactState ;

$zip = $row->contactZip ;

$phone = $row->contactPhone ;

 

//This is where i need to enter the rtf mark up (this is where i need help)

$contactinfo = '{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}{\*\generator        Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\qc\b\f0\fs24 '.$first_name.' '.$last_name.'\b0\par'.$street.'\par'

      .$city.', '.$state.' '.$zip.'\par Phone:'.$phone.' Mobile:'.$cell_phone.' Email: '.$email.'\par \pard\fs20\par}'       ;

 

fwrite($fh, $contactinfo) or die('could not write to file!');

 

fclose($fh);

 

}

 

}

else

{

echo 'no rows found' ;

}

 

mysql_free_result($result) ;

 

mysql_close($connection) ;

 

?>

 

Link to comment
https://forums.phpfreaks.com/topic/110485-php-to-rtf/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.