Jump to content

Can't show value


Xtremer360

Recommended Posts

What isn't showing is the status name. Inside the table efed_content_booking in my database has a field called status_id. The value inside of that field is equal to the field called id inside of efed_list_eventstatus. I'm not sure how to get it to show the value.

 

<h2 class="backstage">Weekly Events :: <a href="#" onclick="ajaxpage('backstage_libs/resultscompilation.php?option=2', 'content'); return false;">Book Lineup</a></h2><br />
		<table width="100%" class="table1">
			<tr class="rowheading">
				<td align="center" border="0" width="1"> </td>
				<td>Show Name</td>
				<td width="80" align="center">Airs</td>
				<td width="50" align="center">Matches</td>
				<td width="100" align="center">Status</td>
			</tr>
			<?php
			 $result = mysql_query("SELECT * FROM `efed_content_booking`");			
			if ($result) {
			$i = 0;
			while ( $row = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {
				$check_this = $row['event_id'];				
				$checker = mysql_query("SELECT * FROM `efed_list_shownames` WHERE `id` = '$check_this'");
				$check = mysql_fetch_assoc($checker);
				if($check['type'] == 'Weekly Event'){
					$sClass = 'row2';
					if ($i++ % 2) $sClass = 'row1';
					printf ( "<tr class=\"%s\">", $sClass );
					print "<td valign=\"top\" align=\"center\" width=\"30\"><a href=\"#\" onclick=\"ajaxpage('backstage_libs/resultscompilation.php?option=1&id=$row[id].', 'content'); return false;\">Edit</a></td>";
					printf ( "<td valign=\"top\">%s</td>", $check['name'] );
					printf ( "<td align=\"center\" width=\"80\">%s</td>", $row ['bookingdate'] );
					printf ( "<td align=\"center\" width=\"50\">%s</td>", $row ['matches'] );
					printf ( "<td align=\"center\" width=\"100\">%s</td>", $row ['statusname'] );
					echo '</tr>';
				}
			}	
			echo '</table><br>';

Link to comment
Share on other sites

In your initial query of efed_content_booking, you should make that an inner join to the efed_list_eventstatus table.  This will allow you to access the status value.

 

There are various left inner join syntaxes  that can be used with Mysql.  This one is probably preferred at present.  Note, that you didn't tell us what the name of the "status name" column is from the efed_list_eventstatus table, so I guessed it might be named status_name.  Obviously this needs to match what the actual column name is in the table.

 

SELECT efb.*,   ele.status_name
FROM `efed_content_booking` efb
LEFT JOIN `efed_list_eventstatus` ele
ON  efb.status_id = ele.id

 

 

 

Link to comment
Share on other sites

That worked however I want to take this one step further. Inside of that eventstatus table there are two options Pre-Booking and Booking. 1=Pre-Booking 2=Booking. I've seen a script before that say for example you click on whatever value is inside of eventstatus cell it will change to the opposite so say it currently says Pre-Booking. If you click on it then it will say Booking. Does that involve scriptaculous? Or something else? Or how is this accomplished so I can do some research on the subject?

Link to comment
Share on other sites

I don't understand your database enough to comment on this effectively. 

 

However, what you're basically asking for seems to be a non-post change.  The generic term for this type of thing is AJAX.  These days, the most heavily used javascript library for implementing ajax calls is jquery.  Do some reading on the jquery site on this.  In essence you will tie an event to whatever widget, and have that issue the ajax call back to your website, which will update the appropriate column. 

 

You should be able to write a simple script that takes the required parameters and does the update -- then it's simply a matter of calling it through jquery.  Start a seperate thread in the Ajax Help section if you get stuck, but please don't do that until you've written the update script and unit test it, AND read the jquery docs, AND coded a simple proof of concept which uses jquery.

 

I took this simple example right out of the jquery manual:

 

$.ajax({
   type: "POST",
   url: "some.php",
   data: "name=John&location=Boston",
   success: function(msg){
     alert( "Data Saved: " + msg );
   }
});

 

 

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.