Jump to content

Issues with switch and retrieving info from data base


Guber-X

Recommended Posts

This is for band website for its event listings. The main event page list everything fine, but once selecting the "Details" link which activates the switch event. Its no longer showing anything. When I had one event in the data base it worked fine, but now I have 3 events in the database and now its not working.

 

Page can be viewed here: http://184.66.66.169/ffy/event.php

 

<?php
	 //Event Code Here

	$eventid = (isset($_GET["id"])) ? intval($_GET["id"]) : 0;

	switch($_GET["list"]=='true')
			{
			case "0":
			if($_GET["id"]== $eventid)
			{

	$result = mysql_query("SELECT * FROM event ORDER by eventdate DESC");
	if (!$result) {
	   die("query failed: " . msql_error());
	}

	while ($row = mysql_fetch_array($result)) {
	list($id, $eventdate, $header, $description, $image, $location) = $row;
	$description = nl2br($description);
	$eventdate = date("M j, Y",strtotime("$eventdate"));

	print('
	<table width="680" border="0" cellpadding="14" cellspacing="0">
	 <tr>
	 <td>
	<div class="myFont"><font size="+1" color="#4e8baf">'.$eventdate.' - </font><font size="+1"><b>'.$header.'</b></font></div>
	<font size="-2" color="#CCCCCC"><a href="event.php?list=true&eventid='.$id.'">Details</a></font><br />
	<hr color="#FFFFFF" width="100" align="left" size="1">
	</td>
	</tr>
  </table>
	');

			}}
			break;
			case "true":
			if($_GET["id"]==$eventid)
			{

		$resultd = mysql_query("SELECT * FROM event WHERE id=$eventid LIMIT 1");
	if (!$resultd) {
	   die("query failed: " . msql_error());
	}

	while ($row = mysql_fetch_array($resultd)) {
	list($id, $eventdate, $header, $description, $image, $location) = $row;
	$description = nl2br($description);
	$eventdate = date("M j, Y",strtotime("$eventdate"));
				print('
	<table width="680" border="0" cellpadding="14" cellspacing="0">
	 <tr>
	 <td>
	<div class="myFont"><font size="+1" color="#4e8baf">'.$eventdate.' - </font><font size="+1"><b>'.$header.'</b></font></div>
	'.$description.'<br />
	<hr color="#FFFFFF" width="100" align="left" size="1">
	<center>
	'.$location.'
	</center>
	</td>
	</tr>
  </table>
	');

				}
			break;
			}}

	?>

well i got her figured out after a bunch of trial and error lol

 

i had to change this line for the detail area

 

<?php 
$id = $_GET["eventid"];
$result = mysql_query("SELECT * FROM event WHERE id=$id LIMIT 1");
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.