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;
			}}

	?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.