danIT Posted February 8, 2009 Posted February 8, 2009 Very simple php script: $result = mysql_query("SELECT id, fullname FROM mdl_course"); while($row = mysql_fetch_array($result)) { echo $row['id'] . " " . $row['fullname']; echo ""; } ?> But I want to change it so that I can write 'id' and 'fullname' into Something like: $row['fullname'] Can anyone help?
webman Posted February 8, 2009 Posted February 8, 2009 Either use single quotes and drop out of the string to pull in the variables; or use double quotes, escape the ones you want echo'd out, and use curly braces to pull in the variables. Method 1 echo '' . $row['fullname'] . ''; Method 2 echo "{$row['fullname']}"; 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now