Help with PHP syntax

I am just starting with mysql, and I was testing displaying table info. I now get an “Unexpected T_WHILE” error when I try it. Please look at the code and try to help me out! Thank you so much!
[php]

<?php $connect = mysql_connect("localhost","root",""); mysql_select_db("mytest"); $query = mysql_query("SELECT * FROM mytest1 WHERE name= 'Chris Weber' ") WHILE($rows = mysql_fetch_array($query)): $name = $rows['name']; $email = $rows['email']; $message = $rows['message']; echo "$name
$email

$messsage


"; endwhile; ?>

[/php]

hello metzfan33, Replace below code (remove below code) [php] WHILE($rows = mysql_fetch_array($query)): $name = $rows['name']; $email = $rows['email']; $message = $rows['message'];

echo “$name
$email

$messsage


”;
endwhile;
[/php]
use below code
[php]
while($rows = mysql_fetch_array($query))
{

echo $rows[‘name’]."
". $rows[‘email’]."

". $rows[‘message’];
echo “

”;
}
[/php]
i hope this will helpful for you.
Reply your feedback
SR

Oh wow thank you so much! I really can’t thank you enough, I spent all last night trying to figure this out (pathetic, I know). I got that code structure from a tutorial website, I guess the variables are unneeded! I started to get real frustrated and gave up, but then I saw this e-mail, tried again, and it works flawlessly! THANK YOU!!

hello metzfan33, it's really nice to hear that your problem is resolve. Post other issues and query. have nice day.. :) :D

SR

Sponsor our Newsletter | Privacy Policy | Terms of Service