- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试执行以下 MySQL 查询:
SELECT event.event_id, venue.venue_name, venue.alt_venue_name, venue.venue_address1, venue.cross_street, dictionary_city.city_name, venue.zip, dictionary_filter.filter_name, venue.capacity, event.start_date, event.end_date, dictionary_barType.is_ob, dictionary_barType.barType_name, event.barType_time, event.is_food, event.food_type, event.food_time, dictionary_age.age_name, dictionary_age.age_description, event.ticketCo_id, event.ticket_locator, event.ticket_left, event_description.description, event_highlight.highlight, event.event_tag, event.image_flyer, event.image_flyer_310x425, event.image_2, event.image_2_310x208, event.image_3, event.image_3_310x208
FROM event
LEFT JOIN venue
ON venue.venue_id=event.venue_id
LEFT JOIN dictionary_city
ON venue.city_id=dictionary_city.city_id
LEFT JOIN dictionary_filter
ON venue.venueType_id=dictionary_filter.filter_id
LEFT JOIN dictionary_barType
ON event.barType_id=dictionary_barType.barType_id
LEFT JOIN dictionary_age
ON event.event_age_id=dictionary_age.age_id
LEFT JOIN event_highlight
ON event_highlight.event_id=event.event_id
LEFT JOIN event_description
ON event_description.event_id=event.event_id
WHERE event.event_id="".$event_id."";
当我在 PhP Admin 中运行查询时,它工作正常,但是当我将代码添加到我的网站时,出现以下错误
"Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/nye/public_html/theballdrop.com/templates/template.event.php on line 29 - See more at: http://theballdrop.com/new-years-eve-madame-tussauds/#sthash.880jgbaa.dpuf"
它引用的查询是“if ($row = mysql_fetch_array($result)){”
我不知道从这里该去哪里。这应该在单个页面上显示来自多个表的信息。 $event_id 是变量,特定事件 ID 将确定要为该特定事件页面显示的信息。
请帮忙。
============================
以下是该页面的完整代码:
<?php
// FUNCTION: CONVERT DATE
include (PATH . DIR_INCLUDE . "convert-time.php");
// CONNECT TO NYE DATABASE
include (PATH . DIR_TEMPLATE . "mysql-connect.php");
$sql = "SELECT event.event_id, venue.venue_name, venue.alt_venue_name, venue.venue_address1, venue.cross_street, dictionary_city.city_name, venue.zip, dictionary_filter.filter_name, venue.capacity, event.start_date, event.end_date, dictionary_barType.is_ob, dictionary_barType.barType_name, event.barType_time, event.is_food, event.food_type, event.food_time, dictionary_age.age_name, dictionary_age.age_description, event.ticketCo_id, event.ticket_locator, event.ticket_left, event_description.description, event_highlight.highlight, event.event_tag, event.image_flyer, event.image_flyer_310x425, event.image_2, event.image_2_310x208, event.image_3, event.image_3_310x208 FROM nye_newyears.event LEFT JOIN venue ON venue.venue_id=event.venue_id LEFT JOIN dictionary_city ON venue.city_id=dictionary_city.city_id LEFT JOIN dictionary_filter ON venue.venueType_id=dictionary_filter.filter_id LEFT JOIN dictionary_barType ON event.barType_id=dictionary_barType.barType_id LEFT JOIN dictionary_age ON event.event_age_id=dictionary_age.age_id LEFT JOIN event_highlight ON event_highlight.event_id=event.event_id LEFT JOIN event_description ON event_description.event_id=event.event_id WHERE event.event_id=".$event_id."";
$result = mysql_query($sql, $con);
// START MYSQL QUERY
if ($row = mysql_fetch_array($result)){
// VENUE INFORMATION
$venueName = $row['venue_name']; // OFFICIAL VENUE NAME
$venueName2 = $row['alt_venue_name']; // NAME YOU WANT TO DISPLAY AT TOP OF EVENT PAGE
$venueAddress = $row['venue_address1']; // ADDRESS OF VENUE
$venueCrossStreet = $row['cross_street']; // CROSS STREETS
$venueCity = $row['city_name']; // VENUE CITY
$venueState = $row['state_abb']; // VENUE STATE
$venueZip = $row['zip']; // VENUE ZIP
$venueType = $row['filter_name']; // TYPE OF VENUE
$venueCapacity = $row['capacity']; // CAPACITY OF VENUE
// EVENT INFORMATION
$start = $row['start_date'];
$startDate = convertDate ($start); // START DATE OF EVENT
$startTime = convertTime ($start); // START TIME OF EVENT
$end = $row['end_date'];
$endDate = convertDate ($end); // END DATE OF EVENT
$endTime = convertTime ($end); // END TIME OF EVENT
$ob = $row['is_ob']; // IS THERE OPEN BAR? "YES" OR "NO"
$obType = $row['barType_name']; // TYPE OF OPEN BAR
$obTimes = $row['barType_time']; // OPEN BAR TIMES (START AND END)
$food = $row['is_food']; // IS THERE FOOD? "YES" OR "NO"
$foodType = $row['food_type']; // TYPE OF FOOD SERVED
$foodTimes = $row['food_time']; // TIMES FOOD BEING SERVED (START AND END)
$eventAge = $row['age_name']; // AGE RESTRICTION (IF ANY)
$eventAge_descrip = $row['age_description'];
$ticketCompany = $row['ticketCo_id'];
$ticketID = $row['ticket_locator']; // WIDGET ID
$ticketsLeft = $row['ticket_left']; // TOTAL TICKETS LEFT
$eventDescription = $row['description']; // EVENT DESCRIPTION
$eventHighlight = $row['highlight']; // EVENT HIGHLIGHT
$eventTag = $row['event_tag']; // EVENT LISTING DESCRIPTION
// EVENT IMAGES
$flyer = $row['image_flyer']; // FULL SIZE EVENT FLYER IMAGE
$flyer_310x425 = $row['image_flyer_310x425']; // FLYER IMAGE - 310x425
$image2 = $row['image_2']; // FULL SIZE IMAGE 2
$image2_310x208 = $row['image_2_310x208']; // IMAGE 2 - 310x208
$image3 = $row['image_3']; // FULL SIZE IMAGE 3
$image3_310x208 = $row['image_3_310x208']; // IMAGE 3 - 310x208
}
// VENUE MAP
$venueMap ="$venueAddress+$venueCity+$venueState+$venueZip" ;
// CLOSE DATABASE
mysql_close($con);
// INCLUDE GLOBAL HEADER
include (PATH . DIR_INCLUDE . "site-header.php");
?>
<body>
<?php include_once(PATH . "analyticstracking.php") ?>
<div id="wrapper">
<?php include (PATH . DIR_INCLUDE . "header.php"); ?>
<div class="row">
<div class="middle">
<div class="wrapper event-header">
<div class="left twoThird slogan"> <br />
<h1>
<?=$venueName2?>
</h1>
<h5>
<?=$eventTag?>
</h5>
</div>
<div class="left oneThird last"> <a class="buy-now" href="#tickets" ><span>Buy Now</span></a> <a href="#" class="greybutton">Ask a Question</a> </div>
<!-- End: button -->
</div>
</div>
<!--End .middle -->
<div class="wrapper">
<div class="twoThird left columns">
<div class="roundCorner">
<div class="widget data flier-section">
<div class="flier left"> <a href="<?=DIR_IMAGES?><?=$flyer?>" class="flyerzoom"><img src="<?=DIR_IMAGES?><?=$flyer_310x425?>" alt="<?=$venueName2?> New Years Eve 2014" width="310" height="425" /></a> </div>
<!-- End @ left-->
<div class="photos right"> <a href="<?=DIR_IMAGES?><?=$image2?>" class="flyerzoom"><img src="<?=DIR_IMAGES?><?=$image2_310x208?>" alt="<?=$venueName?> Times Square New Years Eve 2014" /></a> <a href="<?=DIR_IMAGES?><?=$image3?>" class="flyerzoom fit"><img src="<?=DIR_IMAGES?><?=$image3_310x208?>" alt="<?=$venueName?> Times Square New Years Eve" /></a> </div>
<!-- End @ right slider-->
</div>
<!-- End @ widget-->
<div class="center detail">
<div class="widget lightgray-base">
<h3 class="widget-heading">Why We Recommend</h3>
<ul class="blist">
<?=$eventHighlight?>
</ul>
</div>
<div class="widget">
<h3 class="headingbar">Overview</h3>
<?=$eventDescription?>
<p><strong>About your Tickets: </strong> (1) Show up early and help reduce the wait time, (2) Make sure to have your physical ticket on hand because you will need to show it to NYPD and security upon request, (3) You accept the risks and agree to adhere to the NYPD rules and regulations for the evening, (4) If you select shipping as your delivery method, tickets will not be sent out until December, (5) A LIVE VIEW of The Ball Drop is not guaranteed. Large crowds should be expected</p>
</div>
</div>
</div>
<!-- End of main-->
<div class="roundCorner"> <a name="tickets" ></a>
<h3 class="widget-heading">Purchase Tickets
<div class="info">Have a Question? Call <a href="tel:2122010735">212.201.0735</a> or email <a href="mailto:info@balldrop.com">info@balldrop.com</a> </div>
</h3>
<div class="widget data">
<p>
<?php
if ($ticketCompany == 1){
// START: CRAVE TICKETS WIDGET -->
echo "<iframe scrolling='auto' frameborder='0' width='99.5%' height='600' src='http://cravetickets.com/widgets/iframe/qU4owWdNmYt/".$ticketID."' ></iframe>";
// END: CRAVE TICKETS WIDGET -->
} else if ($ticketCompany == 2){
// START: LAUGHSTUB TICKET WIDGET -->
echo "<script type='text/javascript' src='http://www.laughstub.com/embed/cart/index.cfm?showTimingID=".$ticketID."&bgcolor=E53D23&fontcolor=ffffff&&brand=ticketmob&displayTitle=no&affiliate=1087&checkout=pmtix'></script>";
// END: LAUGHSTUB TICKET WIDGET -->
}
?>
</p>
<p><strong> Price increase warning:</strong> New Year's Eve ticket prices often go up significantly (100% +) the closer you get to New Years Eve. Also note that many NYE Events will sell out well in advance of New Years Eve. </p>
</div>
</div>
</div>
<!-- End @ twoThird-->
<div class="oneThird sidebar last">
<div class="roundCorner lightgray-base">
<h3 class="widget-heading">What to know</h3>
<div class="box data">
<h4>Share This Event</h4>
<p> <span class='st_facebook_large' displayText='Facebook'></span> <span class='st_twitter_large' displayText='Tweet'></span> <span class='st_plusone_large' displayText='Google +1'></span> <span class='st_linkedin_large' displayText='LinkedIn'></span> <span class='st_pinterest_large' displayText='Pinterest'></span> <span class='st_email_large' displayText='Email'></span> </p>
<ul class="know-list">
<li>
<h5>START TIME</h5>
<h4>
<?=$startDate?>
at
<?=$startTime?>
</h4>
</li>
<li>
<h5>END TIME</h5>
<h4>
<?=$endDate?>
at
<?=$endTime?>
</h4>
</li>
<li>
<h5>ADDRESS</h5>
<h4>
<?=$venueAddress?>
<br>
<?=$venueCrossStreet?>
</h4>
</li>
<li>
<h5>VENUE TYPE</h5>
<h4>
<?=$venueType?>
</h4>
</li>
<li>
<h5>AGE REQUIREMENT</h5>
<h4>
<?=$eventAge?>
<br />
<?=$eventAge_descrip?>
</h4>
</li>
<li>
<h5>CAPACITY</h5>
<h4>
<?=$venueCapacity?>
</h4>
</li>
<li>
<h5>OPEN BAR</h5>
<h4>
<?=$ob?>
|
<?=$obType?>
<br />
from
<?=$obTimes?>
</h4>
</li>
<li>
<h5>FOOD SERVED</h5>
<h4>
<?=$food?>
|
<?=$foodType?>
<br />
from
<?=$foodTimes?>
</h4>
</li>
</ul>
</div>
</div>
<!-- End of roundCorner -->
<div class="roundCorner lightgray-base">
<h3 class="widget-heading">Map</h3>
<div class="box"> <img src="http://maps.googleapis.com/maps/api/staticmap?center=<?=$venueMap?>&zoom=16&size=295x245&markers=size:mid%7Ccolor:red%7C<?=$venueMap?>&sensor=false">
<div class="address"> <br />
<h3>
<?=$venueName?>
</h3>
<h5>
<?=$venueAddress?>
<br />
<?=$venueCrossStreet?>
<br />
<?=$venueCity?>
,
<?=$venueState?>
<?=$venueZip?>
</h5>
</div>
</div>
</div>
<!-- End of roundCorner -->
<div class="banner-300"> <img class="fullWidth" src="<?=DIR_IMAGES?>banner-300.jpg"> </div>
<!-- End @ Banner-->
</div>
<!-- End of onethird-->
</div>
<!-- End @ wrapper-->
<div id="footer-top">
<!-- START: SIMILAR PARTIES -->
<div class="listing-wrapper">
<h2 class="subHeading">We Recommend <a href="#" class="right view-all">More NYE Parties <strong>›</strong></a> </h2>
<ul class="columns">
<?php include (PATH . DIR_INCLUDE . "similar-parties.php"); ?>
</ul>
</div>
<!-- END: SIMILAR PARTIES -->
</div>
<!-- End @ footer-top -->
<?php include (PATH . DIR_INCLUDE . "footer.php"); ?>
</div>
<!-- End @ row-->
</div>
<!-- End @ wrapper-->
</body>
</html>
最佳答案
将数据库选择添加到连接脚本中,如下所示:
<?php
$hostname = "localhost";
$username = "{username]";
$password = "[pass]";
$dbname = "nye_newyears";
$con = mysql_connect("$hostname", "$username", "$password");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
if(!mysql_select_db($dbname)) {
die('Could not find or access database ' . $dbname);
}
?>
关于php - 多个表的左连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18711175/
这个问题已经有答案了: Declaring multiple object pointers on one line causes compiler error (5 个回答) 已关闭 6 年前。 l
我目前正在学习语言处理器,经常出现的一个话题是语法中元素的使用方向。从左到右或从右到左。 我理解这个概念,但似乎有很多方法可以编写这些规则,我不确定它们是否都相同。到目前为止我看到的是: 右/左递归,
我有一个很长的线性(分支不多)流程图,在 graphviz 中显示为要么太高而无法放在单个页面上,要么太宽(如果方向是从左到右) 是否有一种简单的方法可以让 graphviz 以从左到右,然后向下,然
我一直摸不着头脑,但运气不好。设计器有一个包含 3 栏的站点、两个侧边栏和一个主要内容区域。 专为桌面设计,左栏、主要内容、右栏。但是,在较小的设备上,我们希望首先堆叠主要内容。 所以通常情况下,你可
我想要从上到下和从左到右组织的 css block 。 为了更好地解释这是一张图片,其中包含我到目前为止所获得的内容以及我希望使用 CSS 实现的内容: 代码如下: HTML: 1 2 3 4 5
当我问this question时,答案之一(现已删除)建议Either类型对应Curry-Howard correspondence中的XOR而不是OR,因为它不能同时是Left和Right。 真相
我有一个程序,如果用户按住向左或向右箭头键, Angular 色会逐渐朝那个方向加速,并最终达到最大速度。松开按键后, Angular 色逐渐减速,直至完全停止。 我的右方向键没问题,但左方向键坏了。
今天很简单的一个。我有一个专栏,我们称之为标题,有一堆项目标题。我需要从“:”的左侧拉出所有内容并进行左/右修剪(稍后我将在连接中使用它,但我现在只需要一个包含新数据的列) .下面是当前列的示例: 这
我正在尝试将图表中的列与左侧对齐。默认情况下,它们位于中间。 我在 API 文档中找不到任何关于此的信息。 Here是一个 jsFiddle 测试。 最佳答案 在 highcharts api 中,您
左旋转进位和右旋转进位指令有哪些实际用途? 在我的汇编课上,我们无法想出一个有用的好例子。 最佳答案 如果您想将位从一个操作数移出并移入另一个操作数: SHL EAX, 1 ; mov
我有一个查询,它使用 eqjoin 从两个不同的表返回以下数据。我想将 left 和 right 结合起来,而不是执行 zip() (重写 name > 和 joined_at),我想将右侧对象的属性
我使用 firebase API。发送和检索消息。但是,我在尝试为发送者/检索者设置布局时遇到麻烦,以便消息将左/右对齐。目前我只有发送者/检索者都使用的一种布局,但不确定如何设置不同的布局。 pub
我的菜单基本上是一个水平项目滑动条。所有菜单项都有特定的默认 CSS 属性。我希望这些项目在到达主容器的中心时更改其大小和左/右边距,并在离开主容器(或位于主容器之外)时重置为默认值。请参阅我的原理图
我有一个引用表,在这个表中有 3 个字段(Id、User1、User2)。 User2 字段可以为空,但我们在不使用时使用 0。 当我执行下面的 Linq 查询时,User2 == 0 的记录不是结果
不知道如何解决这个问题。 我有两个表结果和受访者 我需要查明受访者表中是否有任何行具有completion =“Complete”,但它们的respondent_id(在结果表和受访者表中)不在结果表
我正在尝试访问三个表以获得类似这样的内容: +------+------+------+ | ITEM | PCS | CSS | +------+------+------+ | 1099 |
left 和 right join 有区别吗,下面的sql 语句结果一样,但是两者的性能是一样的吗? SELECT count(*) FROM writers RIGHT JOIN blogs O
当我使用 LEFT() 使用以下代码从数据库中获取值时 $select="SELECT LEFT(description,500) FROM tbl_news where id='$id'"; $qu
当我将鼠标悬停在水平导航菜单上的页面名称上时,相关子页面会 float 在下方。 目前这些显示居中,我如何对齐它们以便它们向左对齐(与导航菜单标题名称一致)。 你可以去看到这个 http://79.1
在下面的引导网格示例中,它使用 col-sm 和 col-sm-push/pull。col-sm-push 指定了左/右值(偏移量)。 我不太清楚它是如何工作的。 第二个 float 元素来到第一个
我是一名优秀的程序员,十分优秀!