这段代码的问题.. ?? [英] problem with this code..??

查看:67
本文介绍了这段代码的问题.. ??的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对某些代码有点问题....有人可以给我

一些建议吗?


解析错误:语法错误,意外的''{''在C:\ xampp \\\\\\\\\\\\\\\\\\\\这一行:

while($ row = mysql_fetch_array(mysql_query($ sql)){


这是第一次......

这里是代码:

生成并通过电子邮件发送报告:

<?php

$ today = date(" M j) ,Y,");

今天回复$;


$ host =" localhost";

$ user = " root";

$ pass ="" ;;

$ db =" productiondb";

$ con = mysql_connect( $ host,$ user,$ pass);


if(!$ con)

{

die('''Unable连接:''。mysql_error());

}

mysql_select_db($ db,$ con)或死(''无法连接:''。。br />
mysql_error());


//从第一张桌子获得结果

$ sql =" SELECT * FROM editorial WHERE editorialdate LIKE''$ today%''

" ;;

$ sql2 =" SELECT * FROM prepress WHERE prepressdate LIKE''$ today%''" ;;


//开始我们的电子邮件正文

$ messageBody ="所有部门的生产报告如下:/ r /

n" ;;

// if( mysql_num_rows($ result)){//如果有结果

//将第一个查询的结果添加到电子邮件

while($ row = mysql_fetch_array(mysql_query($ sql)) ){

$ messageBody。="编辑日期:" 。 $ row [''editorialdate''];

$ messageBody。=" / r / n" ;;

$ messageBody。="编辑名称:" 。 $ row [''editorialname''];

$ messageBody。=" / r / n" ;;

$ messageBody。="编辑评论:" 。 $ row [''editorialcomments''];

$ messageBody。=" / r / n" ;;

}


//将第二个查询的结果添加到电子邮件中

while($ row = mysql_fetch_array(mysql_query($ sql2)){

$ messageBody。=" PrePress Date:" ;。$ row [''prepressdate''];

$ messageBody。=" / r / n" ;;

$ messageBody。=" Prepress Name:" ;。$ row [''prepressname''];

$ messageBody。=" / r / n" ;;

$ messageBody。=" Prepress Comments:" ;。$ row [''prepresscomments''];

$ messageBody。=" / r / n" ;;

}


//发送电子邮件

ini_set(" SMTP"," texchange.company.com");

ini_set(" smtp_port"," 25" ;);

mail(" pa ** @ company.com"," Production Report",$ messageBody);


mysql_close($ con ); //关闭与DB的连接

?>


感谢您的帮助

I am having a bit of a problem with some code....can someone give me
some suggestions?

Parse error: syntax error, unexpected ''{'' in C:\xampp\htdocs\production
\date2.php on line 28

line 28 is this line:
while($row = mysql_fetch_array(mysql_query($sql)) {

It is the first while..
HERE IS THE CODE:
Generating and emailing report for:
<?php
$today = date("M j, Y,");
echo $today;

$host="localhost";
$user="root";
$pass="";
$db="productiondb";
$con = mysql_connect($host, $user, $pass);

if (!$con)
{
die(''Unable to connect: '' . mysql_error());
}
mysql_select_db($db, $con) or die(''Unable to connect: '' .
mysql_error());

// Get results from first table
$sql = "SELECT * FROM editorial WHERE editorialdate LIKE ''$today%''
";
$sql2 = "SELECT * FROM prepress WHERE prepressdate LIKE ''$today%'' ";

// Begin our email body
$messageBody = "Production Report follows for all departments: /r/
n";
//if (mysql_num_rows($result)) { // if there are results
// Add results from first query to email
while($row = mysql_fetch_array(mysql_query($sql)){
$messageBody .= "Editorial Date: " . $row[''editorialdate''];
$messageBody .= "/r/n";
$messageBody .= "Editorial Name: " . $row[''editorialname''];
$messageBody .= "/r/n";
$messageBody .= "Editorial Comments: " . $row[''editorialcomments''];
$messageBody .= "/r/n";
}

// Add results from second query to email
while($row = mysql_fetch_array(mysql_query($sql2)) {
$messageBody .= "PrePress Date: " . $row[''prepressdate''];
$messageBody .= "/r/n";
$messageBody .= "Prepress Name: " . $row[''prepressname''];
$messageBody .= "/r/n";
$messageBody .= "Prepress Comments: " . $row[''prepresscomments''];
$messageBody .= "/r/n";
}

// Send email
ini_set("SMTP", "texchange.company.com");
ini_set("smtp_port", "25");
mail("pa**@company.com","Production Report",$messageBody);

mysql_close($con); //closes the connection to the DB
?>

thanks for any help

推荐答案

row = mysql_fetch_array(mysql_query(
row = mysql_fetch_array(mysql_query(


sql)){


这是第一次......

这里是代码:

生成并通过电子邮件发送报告:

<?php
sql)) {

It is the first while..
HERE IS THE CODE:
Generating and emailing report for:
<?php


today = date(" M j,Y,");

echo
today = date("M j, Y,");
echo


这篇关于这段代码的问题.. ??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆