?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


?
?master-detail relationship between two scripts, passing hidden field values, pagination etc



}
?>



?


?





######################################################
require_once "dbase.php";

$dbcon=new db();
$dbcon->getConnection();

$ID = $_REQUEST['ID'];

$event_details = $dbcon->getResultOf("select event_name, event_venue, DATE_FORMAT(event_start_date,'%D,%M,%Y') as startdate,
DATE_FORMAT(event_end_date,'%D,%M,%Y') as enddate,
TIME_FORMAT(event_start_time,'%r') as starttime,
TIME_FORMAT(event_end_time,'%r') as endtime,
event_comments, event_organiser_name, event_organiser_email, event_organiser_telephone
from tblevents
where eventID = '".$ID."'");
$row_event_details = mysql_fetch_assoc($event_details);

$ticket_details = $dbcon->getResultOf("select ticket_type, price
from tbltickets
where eventID = '".$ID."'");
$row_ticket_details = mysql_fetch_assoc($ticket_details);


?>
Author:??(213.78.171.---)
Date:???04-25-04 10:25

Here's a difficult two scripts to fix, hope somebody can rise to the challenge !
firstly, there is a master-detail relationship between two scripts namely "Event.php" and "eventDetails.php".

I have three problems with these scripts:

1. The pagination script "Events.php" calculates the correct amount of pages etc and used to work, however now it does not allow me to navigate between pages ! I may have changed something in the code or the php.ini file or something, I just don't know how to get it working again.

2. "eventDetails.php" is supposed to work by running an SQL query using the 'eventID' which is passed from a hidden field field on the "Event.php" script. Basically, there is no value
being passed between the two pages. This is also happening on some other scripts I have that do SQL inserts into the database. End result, nothing is posted to the database. In a nutshell I am having problems passing values between scripts !
Assigning values to hidden fields or something.

3. There are two 'if statements' in "eventDetails.php" (lines 45 and 46) that do not work ?

I hope someone can help me with these problems because they are driving me crazy.

Scripts below, they are lengthy so you might need to cut and paste into Dreamweaver to work on.

#######################################################
require "dbase.php";

$dbcon=new db();
$dbcon->getConnection();

if (!($limit)){
$limit = 6;}
if (!($page)){
$page = 0;}
$numresults = $dbcon->getResultOf("SELECT event_tickets_booked, event_max_booking, eventID, event_name, event_start_date, event_venue, event_comments, event_town
FROM tblevents
WHERE event_expired = 'N'"); //and county = ''
$numrows = mysql_num_rows($numresults);
if ($numrows == 0){
echo("No results found matching your query - $query");
exit();}

$pages = $numrows/$limit;

// $pages now contains int of pages, unless there is a remainder from division.

if ($numrows%$limit) {
$pages++;} // has remainder so add one page

$current = intval($page/$limit) + 1; // Current page number.

if (($pages < 1) || ($pages == 0)) {
$total = 1;} // If $pages is less than one or equal to 0, total pages is 1.

else {
$total = $pages;} // Else total pages is $pages value.

$first = $page + 1; // The first result.

if (!((($page + $limit) / $limit) >= $pages) && $pages != 1) {
$last = $page + $limit;} //If not last results page, last result equals $page plus $limit.

else{
$last = $numrows;} // If last results page, last result equals total number of results.


?>


Search Results for <?=$query?>










if ($page != 0) { // Don't show back link if current page is first page.
$back_page = $page - $limit;
echo("back \n");}

for ($i=1; $i <= $pages; $i++) // loop through each page and give link to it.
{
$ppage = $limit*($i - 1);
if ($ppage == $page){
echo("$i \n");} // If current page don't give link, just text.
else{
echo("$i \n");}
}

if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { // If last page don't give next link.
$next_page = $page + $limit;
echo("next\n");}
?>

Events for











Results

-

of



Page of
?



// Now we can display results.
$results = $dbcon->getResultOf("SELECT event_tickets_booked, event_max_booking, eventID, event_name, event_start_date, event_venue, event_comments, event_town
FROM tblevents
WHERE event_expired = 'N'
ORDER BY eventID ASC
LIMIT $page, $limit"); //and event_county = %s



// //{
//echo trim($data['event_name']);
//echo " This show is fully booked";
//echo "\"This\n";
// }
//else
// {
while ($data = mysql_fetch_array($results))
{
?>










Venue

Address



Comments










Event Details




Venue

Start Date
End Date

Start Time

Comments



Organiser Details




Phone ?


E-Mail












?


















Ticket Prices


Adult cost per ticket ?


Child cost per ticket ?

I would like to book

Adult tickets
I would like to book

Child tickets










?

?Topics Author? Date
?master-detail relationship between two scripts, passing hidden field values, pagination etc??new
Kevin 04-25-04 10:25?
?Re: master-detail relationship between two scripts, passing hidden field values, pagination etc??new
bastien 04-27-04 06:31?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message ?Your Name: ?Your Email: ?Subject:
Email replies to this thread, to the address above. ??wrote: > > Here's a difficult two scripts to fix, hope somebody can rise > to the challenge ! > firstly, there is a master-detail relationship between two > scripts namely "Event.php" and "eventDetails.php". > > I have three problems with these scripts: > > 1. The pagination script "Events.php" calculates the correct > amount of pages etc and used to work, however now it does not > allow me to navigate between pages ! I may have changed > something in the code or the php.ini file or something, I > just don't know how to get it working again. > > 2. "eventDetails.php" is supposed to work by running an SQL > query using the 'eventID' which is passed from a hidden field > field on the "Event.php" script. Basically, there is no value > being passed between the two pages. This is also happening > on some other scripts I have that do SQL inserts into the > database. End result, nothing is posted to the database. In > a nutshell I am having problems passing values between > scripts ! > Assigning values to hidden fields or something. > > 3. There are two 'if statements' in "eventDetails.php" (lines > 45 and 46) that do not work ? > > I hope someone can help me with these problems because they > are driving me crazy. > > Scripts below, they are lengthy so you might need to cut and > paste into Dreamweaver to work on. > > ####################################################### > require "dbase.php"; > > $dbcon=new db(); > $dbcon->getConnection(); > > if (!($limit)){ > $limit = 6;} > if (!($page)){ > $page = 0;} > $numresults = $dbcon->getResultOf("SELECT > event_tickets_booked, event_max_booking, eventID, event_name, > event_start_date, event_venue, event_comments, event_town > FROM tblevents > WHERE > event_expired = 'N'"); //and county = '' > $numrows = mysql_num_rows($numresults); > if ($numrows == 0){ > echo("No results found matching your query - $query"); > exit();} > > $pages = $numrows/$limit; > > // $pages now contains int of pages, unless there is a > remainder from division. > > if ($numrows%$limit) { > $pages++;} // has remainder so add one page > > $current = intval($page/$limit) + 1; // Current page number. > > if (($pages < 1) || ($pages == 0)) { > $total = 1;} // If $pages is less than one or equal to 0, > total pages is 1. > > else { > $total = $pages;} // Else total pages is $pages value. > > $first = $page + 1; // The first result. > > if (!((($page + $limit) / $limit) >= $pages) && $pages != 1) { > $last = $page + $limit;} //If not last results page, last > result equals $page plus $limit. > > else{ > $last = $numrows;} // If last results page, last result > equals total number of results. > > > ?> > > > Search Results for <?=$query?> > > > >
> cellpadding="0"> > > > > >
> if ($page != 0) { // Don't show back link if current page is > first page. > $back_page = $page - $limit; > echo(" href=\"$PHP_SELF?query=$query&page=$back_page&limit=$limit\">back \n");} > > for ($i=1; $i <= $pages; $i++) // loop through each page and > give link to it. > { > $ppage = $limit*($i - 1); > if ($ppage == $page){ > echo("$i \n");} // If current page don't give link, > just text. > else{ > echo(" href=\"$PHP_SELF?query=$query&page=$ppage&limit=$limit\">$i \n");} > } > > if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { > // If last page don't give next link. > $next_page = $page + $limit; > echo(" href=\"$PHP_SELF?query=$query&page=$next_page&limit=$limit\">next\n");} > ?> > > Events for >
>
> > > > > > > > > >
Results > > - > > of > > > > Page of >
  >
> > > // Now we can display results. > $results = $dbcon->getResultOf("SELECT event_tickets_booked, > event_max_booking, eventID, event_name, event_start_date, > event_venue, event_comments, event_town > FROM tblevents > WHERE > event_expired = 'N' > ORDER BY eventID > ASC > LIMIT $page, > $limit"); //and event_county = %s > > > > // if($data['event_tickets_booked']==$data['event_max_booking']) > //{ > //echo trim($data['event_name']); > //echo " This show is fully booked"; > //echo "\"This booked\" width=\"20\" height=\"20\">\n"; > // } > //else > // { > while ($data = mysql_fetch_array($results)) > { > ?> > >
> >

trim($data['event_name']); ?> > >
> > > ?>
> Venue > > stripslashes($data['event_venue']); ?> color='#0066CC'> Address > > stripslashes($data['event_town']); ?>
> Comments > >

>
action="../frmEventDetails.php"> > >
> >
> > } > ?> >

>

>

 

>

 

> > > > ###################################################### > require_once "dbase.php"; > > $dbcon=new db(); > $dbcon->getConnection(); > > $ID = $_REQUEST['ID']; > > $event_details = $dbcon->getResultOf("select event_name, > event_venue, DATE_FORMAT(event_start_date,'%D,%M,%Y') as > startdate, > > DATE_FORMAT(event_end_date,'%D,%M,%Y') as enddate, > > TIME_FORMAT(event_start_time,'%r') as starttime, > > TIME_FORMAT(event_end_time,'%r') as endtime, > > event_comments, event_organiser_name, event_organiser_email, > event_organiser_telephone > from > tblevents > where eventID > = '".$ID."'"); > $row_event_details = mysql_fetch_assoc($event_details); > > $ticket_details = $dbcon->getResultOf("select ticket_type, > price > from > tbltickets > where > eventID = '".$ID."'"); > $row_ticket_details = mysql_fetch_assoc($ticket_details); > > > ?> > > > > >

face="Arial" color="#FF9900">Event Details >

>

echo $row_event_details['event_name']; ?>
> Venue $row_event_details['event_venue']; ?>
> Start Date echo stripslashes($row_event_details['startdate']); > ?>
color='#0066CC'>End Date stripslashes($row_event_details['enddate']); ?>
> Start Time echo stripslashes($row_event_details['starttime']); > ?>
>

color='#0066CC'>Comments stripslashes($row_event_details['event_comments']); ?>
> >
>

color="#FF9900">Organiser > Details

>

stripslashes($row_event_details['event_organiser_name']); > ?>
> Phone stripslashes($row_event_details['event_organiser_telephone']); ?> 

> E-Mail stripslashes($row_event_details['event_organiser_email']); > ?>

> >
action="../frmBooking.php"> > value=" stripslashes($row_event_details['event_name']); ?>"> > value=" stripslashes($row_event_details['event_venue']); ?>"> > id="startdate" value=" stripslashes($row_event_details['startdate']); ?>"> > id="starttime" value=" stripslashes($row_event_details['starttime']); ?>"> > id="totalcost" value=" stripslashes($row_ticket_details['price']); ?>"> > value=""> > value=""> >
>

 

> > > > > > > > > > > > > > > > >

align="center">Ticket > Prices

>

Adult cost per ticket > £ >

>

Child cost per ticket > £ 'Child' */ echo stripslashes($row_ticket_details['price']); > ?>

I > would like to book > > Adult tickets
I > would like to book > > Child tickets
>
action="../frmBooking.php"> > value="Submit"> >
>
>
action="file:///C|/Program%20Files/Apache%20Group/Apache2/Scripts/Booking.php"> >
> > >
>

 

">??

Provided By
Phorum