crochk Posted July 22, 2009 Share Posted July 22, 2009 I am making a site to allow a swim school to generate the comments for report cards from a list from a MySQL database. The instructor enters the students name and then the database displays all the comment lines from the database with the name filled in. I have the name set to the variable $first and in the database everywhere I want it to display the name I wrote $first. Here is the line from the php page: while($row = mysql_fetch_array($select)) { echo "<h1>POSITIVE INTRO COMMENTS</h1>"; echo $row['sentence']; } Then in the database the sentence is: It has been a very productive session for $first Any help will be much appreciated Link to comment https://forums.phpfreaks.com/topic/167041-php-variables-in-mysql/ Share on other sites More sharing options...
crochk Posted July 22, 2009 Author Share Posted July 22, 2009 It is not working and any assistance would be much appreciated. Link to comment https://forums.phpfreaks.com/topic/167041-php-variables-in-mysql/#findComment-880751 Share on other sites More sharing options...
bruce080 Posted July 22, 2009 Share Posted July 22, 2009 why don't you remove the variable $first from the database and then add the variable later? So the sentence should be: It has been a very productive session for and the code should be: while($row = mysql_fetch_array($select)) { echo "<h1>POSITIVE INTRO COMMENTS</h1>"; echo $row['sentence'] . "$first"; } Link to comment https://forums.phpfreaks.com/topic/167041-php-variables-in-mysql/#findComment-880774 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.