Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Replace list of strings with database table values

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Replace list of strings with database table values

Postby okoa » Wed May 08, 2013 9:46 am

Hi everyone!
I am stuck and I need some fixing. I am creating a certificate generating system. the certicate contains subjects which should be replaced with grades per each student stored in mysql table. The student details, subject and the grade per each subject is stored in table results. I have writen the following code:
$query_getResults="select grade from results where studentnumber='$studentnumber'";
I want to replace subject1 with corresponding subject name from th database , then subject2 and so forth. I also want once the <<subject>> place holder is replaced, should be assigned the relevant grade from the database.

I want the string above to look like the one below after replacement with database values:
Maths A
English B
Computer studies B+
I wrote the code below but cannot not work, can only replace with a single value. The array seem not to work for me.
@header("content-Disposition:inline, filename=cert.rtf");

//open template file
//read the template into a varriable
//replace the place holders in the template with new data


//generate output
echo $output;
Any assistance please?
New php-forum User
New php-forum User
Posts: 8
Joined: Wed May 08, 2013 9:18 am

Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.