Forum Moderators: coopster

Message Too Old, No Replies

parse error on "echo" please help..

         

Flolondon

7:53 am on Jun 19, 2005 (gmt 0)

10+ Year Member



it says parse error on echo.. please help.. what have i done wrong..

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<?
if (!isset($_POST['submit'])){$submit = '';}else{$submit = $_POST['submit'];} // SUBMIT
if (!isset($_POST['emailaddress'])){$emailaddress = '';}else{$emailaddress = $_POST['emailaddress'];} // emailaddress

?>
<?
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'fb';
mysql_select_db($dbname);

$sql = "select * from emailvalidate where email ='';

echo $sql;

$query = mysql_query($sql);

While ( $row = mysql_fetch_array ( $query, )) {
echo "<p>", $row ['email'] } <br>";
}
?>

</body>
</html>

grandpa

7:58 am on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It looks like a missing quote on the preceeding line. See if this fixes the problem.

$sql = "select * from emailvalidate where email = '' ";

Flolondon

8:11 am on Jun 19, 2005 (gmt 0)

10+ Year Member



<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<?
if (!isset($_POST['submit'])){$submit = '';}else{$submit = $_POST['submit'];} // SUBMIT
if (!isset($_POST['emailaddress'])){$emailaddress = '';}else{$emailaddress = $_POST['emailaddress'];} // emailaddress

?>
<?
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'fb';
mysql_select_db($dbname);
$sql = "select * from emailvalidate where email = " ";

echo $sql;

$query = mysql_query($sql);

While ($row = mysql_fetch_array ( $query, )) {
echo "<p>", $row ['email'] } <br>";
}
?>

</body>
</html>

apparently it still does not work... please help.

dreamcatcher

8:18 am on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think this is your problem:

While ($row = mysql_fetch_array ( $query, )) {
echo "<p>", $row ['email'] } <br>";
}

Firstly, remove the comma after $query. Secondly you appear to have a rogue brace in there, not to mention a comma where there should be a period. Concatenation is not with comma`s.

Try this:

While ($row = mysql_fetch_array ( $query )) {
echo "<p>". $row ['email'] ."<br>";
}

dc

Flolondon

8:47 am on Jun 19, 2005 (gmt 0)

10+ Year Member



<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<?
if (!isset($_POST['submit'])){$submit = '';}else{$submit = $_POST['submit'];} // SUBMIT
if (!isset($_POST['emailaddress'])){$emailaddress = '';}else{$emailaddress = $_POST['emailaddress'];} // emailaddress

?>
<?
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = "fb";
mysql_select_db($dbname);
$sql = SELECT * FROM `emailvalidate` WHERE email = " "";

echo $sql;

$query = mysql_query($sql);

While ($row = mysql_fetch_array ( $query )) {
echo "<p>". $row ['email'] ."<br>";
}

?>

</body>
</html>

thanks i have implemented that one.. but i seem to have a problem with my select queries..

Flolondon

9:05 am on Jun 19, 2005 (gmt 0)

10+ Year Member



<html>
<head>
<title>register</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>
<?
if (!isset($_POST['submit'])){$submit = '';}else{$submit = $_POST['submit'];} // SUBMIT
if (!isset($_POST['emailaddress'])){$emailaddress = '';}else{$emailaddress = $_POST['emailaddress'];} // emailaddress

?>
<?
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = "fb";
mysql_select_db($dbname);
$sql = "SELECT email FROM `emailvalidate` WHERE email = " "";

echo $sql;

$query = mysql_query($sql);

While ($row = mysql_fetch_array ( $query )) {
echo "<p>". $row ['email'] ."<br>";
}

?>

</body>
</html>

PLEASE HELP...it does not work.. dont know what i have done wrong.

Flolondon

9:14 am on Jun 19, 2005 (gmt 0)

10+ Year Member



please note that i am using phpmyadmin (mysql)

dreamcatcher

9:52 am on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Change this line:

$sql = "SELECT email FROM `emailvalidate` WHERE email = " "";

to this:

$sql = "SELECT email FROM `emailvalidate` WHERE email = ''";