bravo14
-
Posts
296 -
Joined
-
Last visited
Posts posted by bravo14
-
-
Hi Guys
I am new to .htaccess and I am trying to shorten the URL from something like
http://79.170.44.125/platinumbrides.co.uk/page.php?page_id=about_us
to
http://79.170.44.125/platinumbrides.co.uk/about_us
Looking through tutorials out there I have the htaccess as
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ page.php?page_id=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ page.php?page_id=$1
However this is not working it still shows the original url and if I type inthe shortened URL I get an error saying the page cannot be displayed
What am I doing wrong?
-
Hi Guys
I have the following code
<?php error_reporting(E_ALL); ini_set('display_errors', 1); include('includes/connect.php'); $sql=("SELECT * FROM `tbl_pages` WHERE `page_address_identifier` = '" . mysql_real_escape_string(intval($_GET['page_id'])) . "' LIMIT 1"); echo $sql; $result=mysql_query($sql); if(mysql_num_rows($result)==0) { die("No record found"); } $row = mysql_fetch_array($result); ?>
from the following url
http://79.170.44.125/platinumbrides.co.uk/page.php?page_id=events
The following query is then perfromed,
SELECT * FROM `tbl_pages` WHERE `page_address_identifier` = '0' LIMIT 1 b
I cannot see where the 0 is coming from
Any ideas what I have done wrong?
-
The values come from a form on a previous page, but now I have turned on Error Reporting it is saying that the variables are undefined.
-
I have updated to the following code and the record is not updating even though it is saying the record has been updated
<?php include_once('includes/connect.php'); foreach ($_POST as $key => $val) { $key = mysql_real_escape_string($val); } $res = mysql_query("UPDATE fixtures SET yardley_goals = '$yardley_goals',opposition_goals ='$opposition_goals', motm = '$motm', totw= '$totw', totwreason = '$totw_reason' where match_id = '$match'"); if (!$res) { die('Error: ' . mysql_error()); } else echo ("1 record added"); $checkresult=mysql_query("SELECT *FROM fixtures where match_id='$match'"); echo('<table class="profiletext"> <tr><td>Date</td><td>'.$checkresult[match_date].'</td></tr> <tr><td>Opponent</td><td>'.$checkresult[Opposition].'</td></tr> <tr><td>Yardley Goals</td><td>'.$checkresult[yardley_goals].'</td></tr> <tr><td>Opposition Goals</td><td>'.$checkresult[opposition_goals].'</td></tr> </table>'); mysql_close($con); ?>
I have also put in an additional query to find the updated record and that is not displaying the record.
-
Hi Guys
I am trying to update an entry in a database using the folliwng code
<code>
<?php
include_once('includes/connect.php');
foreach ($_POST as $key => $val) {
$key = mysql_real_escape_string($val);
}
$res = mysql_query("UPDATE `fixtures` SET `yardley_goals` = '".$yardley_goals."',`opposition_goals` ='".$opposition_goals."', `motm` = '".$motm."'`totw`='".$totw."'`totw_reason`='".$totw_reason."' WHERE `match_id` ='".$match."'");
echo($res);
{
die('Error: ' . mysql_error());
}
echo ("1 record added");
mysql_close($con);
?>
</code>
I am getting the following error
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`totw`=''`totw_reason`='' WHERE `match_id` =''' at line 1
-
Hi guys
While I was installing Zen Cart I was using a temporary url, now that everything is ok, I am trying to change the url to be the correct address instead of the temporary address.
This is configure.php file in the includes folder
<?php /** * @package Configuration Settings circa 1.3.8 * @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 */ /*************** NOTE: This file is similar, but DIFFERENT from the "admin" version of configure.php. ***********/ /*************** The 2 files should be kept separate and not used to overwrite each other. ***********/ // Define the webserver and path parameters // HTTP_SERVER is your Main webserver: eg-http://www.your_domain.com // HTTPS_SERVER is your Secure webserver: eg-https://www.your_domain.com define('HTTP_SERVER', 'http://www.jackiesjems.co.uk'); define('HTTPS_SERVER', 'https://web110.secure-secure.co.uk'); // Use secure webserver for checkout procedure? define('ENABLE_SSL', 'false'); // NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes! // * DIR_WS_* = Webserver directories (virtual/URL) // these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder) define('DIR_WS_CATALOG', '/jackiesjems.co.uk/'); define('DIR_WS_HTTPS_CATALOG', '/jackiesjems.co.uk/'); define('DIR_WS_IMAGES', 'images/'); define('DIR_WS_INCLUDES', 'includes/'); define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/'); define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/'); define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/'); define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/'); define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/'); define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/'); define('DIR_WS_PHPBB', '/'); // * DIR_FS_* = Filesystem directories (local/physical) //the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/ define('DIR_FS_CATALOG', '/home/sites/jackiesjems.co.uk/public_html/'); define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); define('DIR_WS_UPLOADS', DIR_WS_IMAGES . 'uploads/'); define('DIR_FS_UPLOADS', DIR_FS_CATALOG . DIR_WS_UPLOADS); define('DIR_FS_EMAIL_TEMPLATES', DIR_FS_CATALOG . 'email/'); // define our database connection define('DB_TYPE', 'mysql'); define('DB_PREFIX', ''); define('DB_SERVER', 'localhost'); define('DB_SERVER_USERNAME',username'); define('DB_SERVER_PASSWORD', 'password'); define('DB_DATABASE', 'db'); define('USE_PCONNECT', 'false'); define('STORE_SESSIONS', 'db'); // for STORE_SESSIONS, use 'db' for best support, or '' for file-based storage // The next 2 "defines" are for SQL cache support. // For SQL_CACHE_METHOD, you can select from: none, database, or file // If you choose "file", then you need to set the DIR_FS_SQL_CACHE to a directory where your apache // or webserver user has write privileges (chmod 666 or 777). We recommend using the "cache" folder inside the Zen Cart folder // ie: /path/to/your/webspace/public_html/zen/cache -- leave no trailing slash define('SQL_CACHE_METHOD', 'none'); define('DIR_FS_SQL_CACHE', '/home/sites/jackiesjems.co.uk/public_html/cache'); // EOF ?>
What do I need to change?
-
Hi guys
I am new to Zen Cart, I have installed it and got it set up, I have started to add products, my default currency is £ in the Localization Menu of the Admin Panel, and when I add the product it shows £, but on the site it shows €.
Any idea what I need to do to show the prices in £
-
Hi Guys
I have got the following error message
Parse error: syntax error, unexpected T_IF in /home/sites/emmagrayphotography.co.uk/public_html/index.php on line 3
The entire code of the page is here
<?php session_start() if(!$_SESSION['uid']){ //if no session, relocate to login page header('Location: login.php'); } ?> <?php include('includes/connect.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Gallery</title> </head> <body class="body" > <div id="content"> <h1>Galleries</h1> <?php include ('includes/viewgallery.php'); ?> </div> </body> </html>
Can anybody point me in the right direction?
Cheers
-
Hi Guys I am getting the following error message from the code below
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sites/maypolejuniors.com/public_html/news.php on line 191
<?php if(!isset ($id)){ $sql=mysql_query('SELECT * FROM tbl_news sort by story_date desc'); if(mysql_num_rows($sql)<1){ //line 191 echo"All news about Maypole Juniors Under 7s will be available here"; } else{ echo"<table> <tr> <td>Date</td> <td>Headline</td> </tr>"; while($row = mysql_fetch_array($sql)){ echo"<tr> <td>".date("d-M-Y", strtotime($row['story_date']))."</td> <td>".$row['headline']."</td> </tr>"; } echo"</table>"; } } else { $story=mysql_query('SELECT * FROM tbl_news WHERE news_id="$id"'); echo("<h3>".$story['headline']."</h3>".$story['content']); } ?>
What is the problem with the code?
-
Hi
I have a form and the values are passed to page subscribe.php
If the one value is set to unsubscribe, then subscribe.php will redirect to unsubscribe.php, when I go to unsubscribe.php I have lost the variables. Below is the code for unsubscribe.php
<?php include_once('includes/connect.php'); $email=$_POST['form_email']; $name=$_POST['form_name']; $status=$_POST['form_subscribe2']; echo('Status: '.$status); $result=('SELECT * FROM `email_table` where `email`="'.$email.'"'); echo("Query: ".$result); $check=mysql_query($result); if(mysql_num_rows($check)==0) { echo('The email address '.$email.' is not subscribed to the Maypole Juniors newsletter'); } else { $sql=('DELETE from `email_table` where `email` ="'.$email.'"'); if(!mysql_query($sql,$con)) { die('Error: '.mysql_error()); } else { echo($sql.'<br/>'.$name.' who has '.$email.' as their email address has successfully subscribed to the Maypole Juniors newsletter'); } } ?>
The redirect code from subscribe.php is
<?php
if($_POST['form_subscribe2']=="unsubscribe")
{
header ("Location: unsubscribe.php");
}
?>
How can I get the values to pass to unsubscribe.php?
-
Hi Guys
The insert query works but i get the following warning son the screen
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sites/maypolejuniors.com/public_html/subscribe2.php on line 153 Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/sites/maypolejuniors.com/public_html/subscribe2.php on line 158
The code is as follows
include_once ('includes/connect.php'); //assign form entries from subscription form to variables $email = $_POST["form_email"]; $name = $_POST["form_name"]; $status = $_POST["form_subscribe2"]; echo ("status " . $status); $result="$sql='SELECT *FROM `email_table` where `email`=$email"; if(mysql_num_rows($result)>0) { echo('The email address '.$email.' is already subscribed to the Maypole Juniors newsletter'); } else if(mysql_numrows($result)==0) { $sql="INSERT INTO `email_table` (`name`,`email`) VALUES ('".$name."','".$email."')"; if(!mysql_query($sql,$con)) { die('Error: '.mysql_error()); } else { echo($name.' who has '.$email.' as their email address has successfully subscribed to the Mayple Juniors newsletter'); } } else { $sql="DELETE FROM `email_table` WHERE email='".$email."'"; if(!mysql_query($sql,$con)) { die('Error: '.mysql_error()); } else { echo($name.' who has '.$email.' as their email address has successfully unsubscribed from the Maypole Juniors newsletter'); } } ?>
-
Cheers Guys
I have got the T Else to disappear and the Insert query works but I get the following errors displayed
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sites/maypolejuniors.com/public_html/subscribe2.php on line 153 Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/sites/maypolejuniors.com/public_html/subscribe2.php on line 158
The code now lookds like this
include_once ('includes/connect.php'); //assign form entries from subscription form to variables $email = $_POST["form_email"]; $name = $_POST["form_name"]; $status = $_POST["form_subscribe2"]; echo ("status " . $status); $result="$sql='SELECT *FROM `email_table` where `email`=$email"; if(mysql_num_rows($result)>0) { echo('The email address '.$email.' is already subscribed to the Maypole Juniors newsletter'); } else if(mysql_numrows($result)==0) { $sql="INSERT INTO `email_table` (`name`,`email`) VALUES ('".$name."','".$email."')"; if(!mysql_query($sql,$con)) { die('Error: '.mysql_error()); } else { echo($name.' who has '.$email.' as their email address has successfully subscribed to the Mayple Juniors newsletter'); } } else { $sql="DELETE FROM `email_table` WHERE email='".$email."'"; if(!mysql_query($sql,$con)) { die('Error: '.mysql_error()); } else { echo($name.' who has '.$email.' as their email address has successfully unsubscribed from the Maypole Juniors newsletter'); } } ?>
-
Thanls for that, I now have the same on line 171
<?php include_once('includes/connect.php'); //assign form entries from subscription form to variables $email=$_POST["form_email"]; $name=$_POST["form_name"]; $status=$_POST["form_subscribe2"]; echo ("status ".$status); if($status=="1"){ $result="$sql = 'SELECT * FROM `email_table` where `email`=$email"; //is the email address already subsribed if(mysql_num_rows($result) > 0) { //The email address already exists in the table, output message echo('The email address '.$email.' is already subscribed to the Maypole Juniors newsletter'); } } else //if not then enter into database { $sql="INSERT INTO `email_table` (`name`,`email`) VALUES ('".$name."', '".$email."')"; if (!mysql_query($sql,$con)){ die('Error: ' . mysql_error()); } else { echo($name. ' who has '.$email.' as their email address has successfully subscribed to the Maypole Juniors newsletter'); } } else //line 171 { echo("Do something else"); $sql="DELETE FROM email_table WHERE email='".$email."'"; if (!mysql_query($sql,$con)){ die('Error: ' . mysql_error()); } else { echo($name. ' who has '.$email.' as their email address has successfully unsubscribed from the Maypole Juniors newsletter'); } } mysql_close($con); ?>
-
Hi Guys
I have the following error
Parse error: syntax error, unexpected T_ELSE in /home/sites/maypolejuniors.com/public_html/subscribe.php on line 168
from the following code
<?php include_once('includes/connect.php'); //assign form entries from subscription form to variables $email=$_POST["form_email"]; $name=$_POST["form_name"]; $status=$_POST["form_subscribe2"]; echo ("status ".$status); if($status=="1"){ $result="$sql = 'SELECT * FROM `email_table` where `email`=$email"; if(mysql_num_rows($result) > 0) { echo('The email address '.$email.' is already subscribed to the Maypole Juniors newsletter'); } else { $sql="INSERT INTO `email_table` (`name`,`email`) VALUES ('".$name."', '".$email."')"; if (!mysql_query($sql,$con)){ die('Error: ' . mysql_error()); } else { echo($name. ' who has '.$email.' as their email address has successfully subscribed to the Maypole Juniors newsletter'); } } else //line 168 { echo("Do something else"); $sql="DELETE FROM email_table WHERE email='".$email."'"; if (!mysql_query($sql,$con)){ die('Error: ' . mysql_error()); } else { echo($name. ' who has '.$email.' as their email address has successfully unsubscribed from the Maypole Juniors newsletter'); } } } mysql_close($con); ?>
Any ideas what I have wrong?
-
Hi Guys
Is it possible to set user permissions on a specific field so that certain users cannot amend the content of the field.
Cheers
Mark
-
Hi guys
I found a tutorial on webcheatsheet.com, to create a CAPTCHA, and have got the following code for the form
form id="frmCaptcha" name="frmCaptcha"> <table> <tr> <td><label for="name">Name</label></td> <td><input name="name" type="text" maxlength="20" size="32"/></td></tr> <tr> <td><label for="email">Email Address</label></td> <td><input name="email" type="text" maxlength="60" size="32"/></td></tr> <tr> <tr> <td valign="top"><label for="question">Question</label></td> <td class="textarea"><textarea name="question" cols="25" rows="10"></textarea></td></tr> <tr> <td></td> <tr> <td align="left"> <label for="captcha">Security</label> </td> <td> <input id="txtCaptcha" type="text" name="txtCaptcha" value="" maxlength="10" size="32" /> </td></tr> <tr> <td> </td> <td> <img id="imgCaptcha" src="create_image.php" /> </td> </tr> <tr> <td> </td> <td> <input id="btnCaptcha" type="button" value="Captcha Test" name="btnCaptcha" onclick="getParam(document.frmCaptcha)" /> </td> </tr> </table> <div id="result"> </div> </form>
The following is the javascript for when the form is submitted
/Called every time when form is perfomed function getParam(theForm) { //Set the URL var url = 'captcha.php'; //Set up the parameters of our AJAX call var postStr = theForm.txtCaptcha.name + "=" + encodeURIComponent( theForm.txtCaptcha.value )+ "&" + theForm.name.name + "=" + encodeURIComponent( theForm.name.value ) + "&" + theForm.email.name + "=" + encodeURIComponent( theForm.email.value ) + "&" + theForm.question.name + "=" + encodeURIComponent(theForm.question.value);
and the process captcha.php referenced in the javascript
<? /* This is the back-end PHP file for the How to Create CAPTCHA Protection using PHP and AJAX Tutorial You may use this code in your own projects as long as this copyright is left in place. All code is provided AS-IS. This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For the rest of the code visit http://www.WebCheatSheet.com Copyright 2006 WebCheatSheet.com */ //Continue the session session_start(); //Make sure that the input come from a posted form. Otherwise quit immediately if ($_SERVER["REQUEST_METHOD"] <> "POST") die("You can only reach this page by posting from the html form"); //Check if the securidy code and the session value are not blank //and if the input text matches the stored text if ( ($_REQUEST["txtCaptcha"] == $_SESSION["security_code"]) && (!empty($_REQUEST["txtCaptcha"]) && !empty($_SESSION["security_code"])) ) { $name = $_REQUEST['name']; $email = $_REQUEST['email']; $question = $_REQUEST['question']; // Validation if(2 < strlen($name) && 2 < strlen($email) && 2 < strlen($question)) { $email_message = <<< EMAIL A message was received from $name. Name: $name Email:$email Question: $question EMAIL; $headers = "from:$email\r\n"; //Set from address if(mail('mark@bravo14.co.uk','Contact from projectrenovations.co.uk', $email_message, $headers)) //Change email address accordingly { echo "Thank you $name, your email has been delivered, we will contact you shortly."; } else { echo "Sorry $name, we had a problem sending the email."; } } else { echo "You did not fill in the form properly. Please use the browser's 'back' button and update the form."; } ; } else { echo "You have entered the wrong security code, try again!"; } ?>
however when I submit the form, it doesn't do anything, any ideas?
-
I am still getting the same error message
-
Hi Guys
I have a page with the following code when I open the page I get a message saying
Notice: Undefined index: cid in C:\wamp\www\renovations\includes\viewgallery.php on line 8
<?php include("config.inc.php"); // initialization $result_array = array(); $counter = 0; $cid = (int)($_GET['cid']); $pid = (int)($_GET['pid']); // Category Listing if( empty($cid) && empty($pid) ) { $number_of_categories_in_row = 4; $result = mysql_query( "SELECT c.category_id, c.category_name, COUNT( photo_id ) FROM gallery_category AS c LEFT JOIN gallery_photos AS p ON p.photo_category = c.category_id WHERE c.category_id <>1 AND c.category_id <>2 GROUP BY c.category_id" ); while( $row = mysql_fetch_array( $result ) ) { $result_array[] = "<a href='viewgallery.php?cid=".$row[0]."'>".$row[1]."</a> "."(".$row[2].")"; } mysql_free_result( $result ); $result_final = "<tr>\n"; foreach($result_array as $category_link) { if($counter == $number_of_categories_in_row) { $counter = 1; $result_final .= "\n</tr>\n<tr>\n"; } else $counter++; $result_final .= "\t<td>".$category_link."</td>\n"; } if($counter) { if($number_of_categories_in_row-$counter) $result_final .= "\t<td colspan='".($number_of_categories_in_row-$counter)."'> </td>\n"; $result_final .= "</tr>"; } } // Thumbnail Listing else if( $cid && empty( $pid ) ) { $number_of_thumbs_in_row = 5; $result = mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM gallery_photos WHERE photo_category='".addslashes($cid)."'" ); $nr = mysql_num_rows( $result ); if( empty( $nr ) ) { $result_final = "\t<tr><td>No Category found</td></tr>\n"; } else { while( $row = mysql_fetch_array( $result ) ) { $result_array[] = "<a href='viewgallery.php?cid=$cid&pid=".$row[0]."'><img src='".$images_dir."/tb_".$row[2]."' border='0' alt='".$row[1]."' /></a>"; } mysql_free_result( $result ); $result_final = "<tr>\n"; foreach($result_array as $thumbnail_link) { if($counter == $number_of_thumbs_in_row) { $counter = 1; $result_final .= "\n</tr>\n<tr>\n"; } else $counter++; $result_final .= "\t<td>".$thumbnail_link."</td>\n"; } if($counter) { if($number_of_photos_in_row-$counter) $result_final .= "\t<td colspan='".($number_of_photos_in_row-$counter)."'> </td>\n"; $result_final .= "</tr>"; } } } // Full Size View of Photo else if( $pid ) { $result = mysql_query( "SELECT photo_caption,photo_filename FROM gallery_photos WHERE photo_id='".addslashes($pid)."'" ); list($photo_caption, $photo_filename) = mysql_fetch_array( $result ); $nr = mysql_num_rows( $result ); mysql_free_result( $result ); if( empty( $nr ) ) { $result_final = "\t<tr><td>No Photo found</td></tr>\n"; } else { $result = mysql_query( "SELECT category_name FROM gallery_category WHERE category_id='".addslashes($cid)."'" ); list($category_name) = mysql_fetch_array( $result ); mysql_free_result( $result ); $result_final .= "<tr>\n\t<td> <a href='viewgallery.php'>Categories</a> > <a href='viewgallery.php?cid=$cid'>$category_name</a></td>\n</tr>\n"; $result_final .= "<tr>\n\t<td align='center'> <br /> <img src='".$images_dir."/".$photo_filename."' border='0' alt='".$photo_caption."' /> <br /> $photo_caption </td> </tr>"; } } // Final Output echo <<<__HTML_END <html> <head> <title>Gallery View</title> </head> <body> <table width='100%' border='0' align='center' style='width: 100%;'> $result_final </table> </body> </html> __HTML_END; ?>
Any help will be much appreciated
Cheers
-
Hi guys
I am trying to create a gallery, the images are uploading ok, but I can't get them to display below is the code
<?php include("admin/config.inc.php"); // initialization $result_array = array(); $counter = 0; $cid = (int)($_GET['cid']); $pid = (int)($_GET['pid']); // Thumbnail Listing if( $cid && empty( $pid ) ) { $number_of_thumbs_in_row = 5; $result = mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM gallery_photos WHERE photo_category='1'" ); $nr = mysql_num_rows( $result ); if( empty( $nr ) ) { $result_final = "\t<tr><td>No Category found</td></tr>\n"; } else { while( $row = mysql_fetch_array( $result ) ) { $result_array[] = "<a href='gallery.php?cid=$cid&pid=".$row[0]."'><img src='http://www.projectrenovations.co.uk/admin/".$images_dir."/tb_".$row[2]."' border='0' alt='".$row[1]."' /></a>"; print_r($row); } mysql_free_result( $result ); $result_final = "<tr>\n"; foreach($result_array as $thumbnail_link) { if($counter == $number_of_thumbs_in_row) { $counter = 1; $result_final .= "\n</tr>\n<tr>\n"; } else $counter++; $result_final .= "\t<td>".$thumbnail_link."</td>\n"; } if($counter) { if($number_of_photos_in_row-$counter) $result_final .= "\t<td colspan='".($number_of_photos_in_row-$counter)."'> </td>\n"; $result_final .= "</tr>"; } } } // Full Size View of Photo else if( $pid ) { $result = mysql_query( "SELECT photo_caption,photo_filename FROM gallery_photos WHERE photo_id='".addslashes($pid)."'" ); list($photo_caption, $photo_filename) = mysql_fetch_array( $result ); $nr = mysql_num_rows( $result ); mysql_free_result( $result ); if( empty( $nr ) ) { $result_final = "\t<tr><td>No Photo found</td></tr>\n"; } else { $result = mysql_query( "SELECT category_name FROM gallery_category WHERE category_id='1'" ); list($category_name) = mysql_fetch_array( $result ); mysql_free_result( $result ); $result_final .= "<tr>\n\t<td align='center'> <br /> <img src='".$images_dir."/".$photo_filename."' border='0' alt='".$photo_caption."' /> <br /> $photo_caption </td> </tr>"; } } // Final Output echo <<<__HTML_END <table width='100%' border='0' align='center' style='width: 100%;'> $result_final </table> __HTML_END; ?> The images aren't displaying, I am seeing no content. Where have I gone wrong? Mark
-
This is the sample code that I got back from a friend and this works
<?php require_once('Connections/conn_mysql.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $maxRows_rsFixtures = 20; $pageNum_rsFixtures = 0; if (isset($_GET['pageNum_rsFixtures'])) { $pageNum_rsFixtures = $_GET['pageNum_rsFixtures']; } $startRow_rsFixtures = $pageNum_rsFixtures * $maxRows_rsFixtures; mysql_select_db($database_conn_mysql, $conn_mysql); $query_rsFixtures = "SELECT * FROM tbl_fixtures WHERE tbl_fixtures.team_id = 1"; $query_limit_rsFixtures = sprintf("%s LIMIT %d, %d", $query_rsFixtures, $startRow_rsFixtures, $maxRows_rsFixtures); $rsFixtures = mysql_query($query_limit_rsFixtures, $conn_mysql) or die(mysql_error()); $row_rsFixtures = mysql_fetch_assoc($rsFixtures); if (isset($_GET['totalRows_rsFixtures'])) { $totalRows_rsFixtures = $_GET['totalRows_rsFixtures']; } else { $all_rsFixtures = mysql_query($query_rsFixtures); $totalRows_rsFixtures = mysql_num_rows($all_rsFixtures); } $totalPages_rsFixtures = ceil($totalRows_rsFixtures/$maxRows_rsFixtures)-1; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <h1>Fixtures</h1> <?php do { echo $row_rsFixtures['Opposition']; echo "("; echo $row_rsFixtures['yardley_goals']; echo ":"; echo $row_rsFixtures['opposition_goals']; echo ")"; echo "<br/>"; if($row_rsFixtures['yardley_goals']>0) { $match_id = $row_rsFixtures['match_id']; echo "Goal Scorers - "; $maxRows_rsScorers = 10; $pageNum_rsScorers = 0; if (isset($_GET['pageNum_rsScorers'])) { $pageNum_rsScorers = $_GET['pageNum_rsScorers']; } $startRow_rsScorers = $pageNum_rsScorers * $maxRows_rsScorers; mysql_select_db($database_conn_mysql, $conn_mysql); $query_rsScorers = "SELECT tbl_scorers.scorer, tbl_scorers.goals, tbl_scorers.match_id, tbl_fixtures.match_id FROM tbl_fixtures, tbl_scorers WHERE tbl_fixtures.match_id = $match_id AND tbl_scorers.match_id = $match_id"; $query_limit_rsScorers = sprintf("%s LIMIT %d, %d", $query_rsScorers, $startRow_rsScorers, $maxRows_rsScorers); $rsScorers = mysql_query($query_limit_rsScorers, $conn_mysql) or die(mysql_error()); $row_rsScorers = mysql_fetch_assoc($rsScorers); if (isset($_GET['totalRows_rsScorers'])) { $totalRows_rsScorers = $_GET['totalRows_rsScorers']; } else { $all_rsScorers = mysql_query($query_rsScorers); $totalRows_rsScorers = mysql_num_rows($all_rsScorers); } $totalPages_rsScorers = ceil($totalRows_rsScorers/$maxRows_rsScorers)-1; do { echo $row_rsScorers['scorer'] ."("; echo $row_rsScorers['goals']; echo ")<br/>"; } while ($row_rsScorers = mysql_fetch_assoc($rsScorers)); } echo "<br/>"; } while ($row_rsFixtures = mysql_fetch_assoc($rsFixtures)); ?> </body> </html> <?php mysql_free_result($rsFixtures); mysql_free_result($rsScorers); ?>
however when I copy this code into the page layout I want the goalscorers do not display, the code for that is
<?php require_once('includes/connect.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $maxRows_rsFixtures = 20; $pageNum_rsFixtures = 0; if (isset($_GET['pageNum_rsFixtures'])) { $pageNum_rsFixtures = $_GET['pageNum_rsFixtures']; } $startRow_rsFixtures = $pageNum_rsFixtures * $maxRows_rsFixtures; ; $query_rsFixtures = "SELECT * FROM tbl_fixtures WHERE tbl_fixtures.team_id = 1"; $query_limit_rsFixtures = sprintf("%s LIMIT %d, %d", $query_rsFixtures, $startRow_rsFixtures, $maxRows_rsFixtures); $rsFixtures = mysql_query($query_limit_rsFixtures) or die(mysql_error()); $row_rsFixtures = mysql_fetch_assoc($rsFixtures); if (isset($_GET['totalRows_rsFixtures'])) { $totalRows_rsFixtures = $_GET['totalRows_rsFixtures']; } else { $all_rsFixtures = mysql_query($query_rsFixtures); $totalRows_rsFixtures = mysql_num_rows($all_rsFixtures); } $totalPages_rsFixtures = ceil($totalRows_rsFixtures/$maxRows_rsFixtures)-1; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>• Yardley Hockey Club •</title> <meta name="keywords" content="yardley, hockey, league, mrha, small heath, co-op" /> <meta name="description" content="The Official Website of Yardley Hockey Club" /> <link href="style/2008.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="favicon.ico" > </head> <body bgcolor="#FFFFCC"> <div align="center"> <div id="maincontent"> <div id="header"><img src="images/logo.png" /></div> <div id="scrolltext"> <marquee> <?php include('includes/marquee.php'); ?> </marquee> </div> <div id="topnav"> <a href="index.php"><img src="images/menu/home.png" border="0" /></a> <a href="club.php"><img src="images/menu/club.png" border="0" /></a> <a href="main.php?team_id=1"><img src="images/menu/1st_XI.png" border="0" /></a> <a href="main.php?team_id=2"><img src="images/menu/fathoms.png" border="0" /></a> <a href="main.php?team_id=3"><img src="images/menu/badgers.png" border="0" /></a> <a href="main.php?team_id=4"><img src="images/menu/u11.png" border="0" /></a> <a href="news.php"><img src="images/menu/news.png" border="0" /></a> <a href="forum/index.php"><img src="images/menu/forum.png" border="0" /></a> <a href="links.php"><img src="images/menu/links.png" border="0" /></a> </div> <div id="submenu"> <?php $team = ('SELECT * FROM `tbl_team_menu` where `page` <>"main.php" and `team_id`=\'' . $_GET['team_id'] . '\''); $teamresult=mysql_query($team); while($teamrow = mysql_fetch_array($teamresult)) { echo('<a href="'.$teamrow['page'].'?team_id='.$teamrow['team_id'].'"><img src="images/menu/'.$teamrow['button'].'" border="0"></a>'); } ?> </div> <div id="maintext"> <div id="fixtures"><?php include('includes/next_fixtures.php'); ?> </div> <div align="left"> <table width =75%> <b><tr><td>Date</td><td>Home</td><td width="20">Score</td><td>Away</td><td>Result</td><td>Scorers</td><td>Match Report</td></tr></b> <?php $result = mysql_query('SELECT * FROM `tbl_fixture_dates` INNER JOIN `tbl_fixtures` ON `tbl_fixture_dates`.`date_id` = `tbl_fixtures`.`date_id` WHERE `tbl_fixtures`.`team_id` = \'' . $_GET['team_id'] . '\' order by match_date') or die(mysql_error()); if(mysql_num_rows($result) < 1) { echo('<tr><td colspan="6">Sorry, no results were found.</td></tr>'); } else { while($row = mysql_fetch_array($result)) { if ($row[HomeAway]=="Home") { echo "<tr><td>".date("d-M-Y", strtotime($row['match_date']))."</td><td><b>Yardley</b></td>"; echo ('<td align="center">'.$row[yardley_goals].'-'.$row[opposition_goals].'</td><td>'.$row[Opposition].'</td>'); echo ('<td>'.$row[Result].'</td><td>'); if($row_rsFixtures['yardley_goals']>0) { $match_id = $row_rsFixtures['match_id']; echo "Goal Scorers - "; $maxRows_rsScorers = 10; $pageNum_rsScorers = 0; if (isset($_GET['pageNum_rsScorers'])) { $pageNum_rsScorers = $_GET['pageNum_rsScorers']; } $startRow_rsScorers = $pageNum_rsScorers * $maxRows_rsScorers; $query_rsScorers = "SELECT tbl_scorers.scorer, tbl_scorers.goals, tbl_scorers.match_id, tbl_fixtures.match_id FROM tbl_fixtures, tbl_scorers WHERE tbl_fixtures.match_id = $match_id AND tbl_scorers.match_id = $match_id"; $query_limit_rsScorers = sprintf("%s LIMIT %d, %d", $query_rsScorers, $startRow_rsScorers, $maxRows_rsScorers); $rsScorers = mysql_query($query_limit_rsScorers) or die(mysql_error()); $row_rsScorers = mysql_fetch_assoc($rsScorers); if (isset($_GET['totalRows_rsScorers'])) { $totalRows_rsScorers = $_GET['totalRows_rsScorers']; } else { $all_rsScorers = mysql_query($query_rsScorers); $totalRows_rsScorers = mysql_num_rows($all_rsScorers); } $totalPages_rsScorers = ceil($totalRows_rsScorers/$maxRows_rsScorers)-1; do { echo $row_rsScorers['scorer'] ."("; echo $row_rsScorers['goals']; echo ")<br/>"; } while ($row_rsScorers = mysql_fetch_assoc($rsScorers)); } echo "<br/>"; } while ($row_rsFixtures = mysql_fetch_assoc($rsFixtures)); { echo('</td><td><a href="report.php?match_id='.$row[match_id].'">View Report</a></td></tr>'); echo "<tr><td>".date("d-M-Y", strtotime($row['match_date']))."</td><td>".$row[Opposition]."</td>"; echo ('<td align="center">'.$row[opposition_goals].'-'.$row[yardley_goals].'</td><td><b>Yardley</b></td>'); echo ('<td>'.$row[Result].'</td><td>'); if($row_rsFixtures['yardley_goals']>0) { $match_id = $row_rsFixtures['match_id']; echo "Goal Scorers - "; $maxRows_rsScorers = 10; $pageNum_rsScorers = 0; if (isset($_GET['pageNum_rsScorers'])) { $pageNum_rsScorers = $_GET['pageNum_rsScorers']; } $startRow_rsScorers = $pageNum_rsScorers * $maxRows_rsScorers; $query_rsScorers = "SELECT tbl_scorers.scorer, tbl_scorers.goals, tbl_scorers.match_id, tbl_fixtures.match_id FROM tbl_fixtures, tbl_scorers WHERE tbl_fixtures.match_id = $match_id AND tbl_scorers.match_id = $match_id"; $query_limit_rsScorers = sprintf("%s LIMIT %d, %d", $query_rsScorers, $startRow_rsScorers, $maxRows_rsScorers); $rsScorers = mysql_query($query_limit_rsScorers) or die(mysql_error()); $row_rsScorers = mysql_fetch_assoc($rsScorers); if (isset($_GET['totalRows_rsScorers'])) { $totalRows_rsScorers = $_GET['totalRows_rsScorers']; } else { $all_rsScorers = mysql_query($query_rsScorers); $totalRows_rsScorers = mysql_num_rows($all_rsScorers); } $totalPages_rsScorers = ceil($totalRows_rsScorers/$maxRows_rsScorers)-1; do { echo $row_rsScorers['scorer'] ."("; echo $row_rsScorers['goals']; echo ")<br/>"; } while ($row_rsScorers = mysql_fetch_assoc($rsScorers)); } echo "<br/>"; } while ($row_rsFixtures = mysql_fetch_assoc($rsFixtures)); echo('</td><td><a href="report.php?match_id='.$row[match_id].'">View Report<a></td></tr>'); } } mysql_close($con); ?> </table> </div> </div> <div><div id="footers">designed and hosted by <a href="http://www.bravo14.co.uk" target="_blank">bravo14.co.uk</a></div> <div id="footer">© 2005-<?php echo date("Y") ?> Yardley Hockey Club</div></div> </div> </div> </body> </html> <?php mysql_free_result($rsFixtures); mysql_free_result($rsScorers); ?>
Any ideas where I havw gone wrong
Cheers
-
Thanks for your reply, but I want to try and get the goalscorers showing in the format laid out in the page
Any help would be appreciated
-
Hi guys
I shall try and explain this clearly...
I have one table in a database that shows the fixtures, and I have a table showing all of the goalscorers for each fixture linked by a field called fixture_id. What i want to achieve is next to the result show the goalscorers for that game, below is the entire code for the page
When I display the page I get all of the fixtures displayed but no goalscorers, now we may not be the best team in the world but we have scored this season
I did seek some help from a friend, which resulted in this page...
<?php require_once('includes/connect.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $maxRows_rsFixtures = 20; $pageNum_rsFixtures = 0; if (isset($_GET['pageNum_rsFixtures'])) { $pageNum_rsFixtures = $_GET['pageNum_rsFixtures']; } $startRow_rsFixtures = $pageNum_rsFixtures * $maxRows_rsFixtures; ; $query_rsFixtures = "SELECT * FROM tbl_fixtures WHERE tbl_fixtures.team_id = 1"; $query_limit_rsFixtures = sprintf("%s LIMIT %d, %d", $query_rsFixtures, $startRow_rsFixtures, $maxRows_rsFixtures); $rsFixtures = mysql_query($query_limit_rsFixtures) or die(mysql_error()); $row_rsFixtures = mysql_fetch_assoc($rsFixtures); if (isset($_GET['totalRows_rsFixtures'])) { $totalRows_rsFixtures = $_GET['totalRows_rsFixtures']; } else { $all_rsFixtures = mysql_query($query_rsFixtures); $totalRows_rsFixtures = mysql_num_rows($all_rsFixtures); } $totalPages_rsFixtures = ceil($totalRows_rsFixtures/$maxRows_rsFixtures)-1; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>• Yardley Hockey Club •</title> <meta name="keywords" content="yardley, hockey, league, mrha, small heath, co-op" /> <meta name="description" content="The Official Website of Yardley Hockey Club" /> <link href="style/2008.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="favicon.ico" > </head> <body bgcolor="#FFFFCC"> <div align="center"> <div id="maincontent"> <div id="header"><img src="images/logo.png" /></div> <div id="scrolltext"> <marquee> <?php include('includes/marquee.php'); ?> </marquee> </div> <div id="topnav"> <a href="index.php"><img src="images/menu/home.png" border="0" /></a> <a href="club.php"><img src="images/menu/club.png" border="0" /></a> <a href="main.php?team_id=1"><img src="images/menu/1st_XI.png" border="0" /></a> <a href="main.php?team_id=2"><img src="images/menu/fathoms.png" border="0" /></a> <a href="main.php?team_id=3"><img src="images/menu/badgers.png" border="0" /></a> <a href="main.php?team_id=4"><img src="images/menu/u11.png" border="0" /></a> <a href="news.php"><img src="images/menu/news.png" border="0" /></a> <a href="forum/index.php"><img src="images/menu/forum.png" border="0" /></a> <a href="links.php"><img src="images/menu/links.png" border="0" /></a> </div> <div id="submenu"> <?php $team = ('SELECT * FROM `tbl_team_menu` where `page` <>"main.php" and `team_id`=\'' . $_GET['team_id'] . '\''); $teamresult=mysql_query($team); while($teamrow = mysql_fetch_array($teamresult)) { echo('<a href="'.$teamrow['page'].'?team_id='.$teamrow['team_id'].'"><img src="images/menu/'.$teamrow['button'].'" border="0"></a>'); } ?> </div> <div id="maintext"> <div id="fixtures"><?php include('includes/next_fixtures.php'); ?> </div> <div align="left"> <table width =75%> <b><tr><td>Date</td><td>Home</td><td width="20">Score</td><td>Away</td><td>Result</td><td>Scorers</td><td>Match Report</td></tr></b> <?php $result = mysql_query('SELECT * FROM `tbl_fixture_dates` INNER JOIN `tbl_fixtures` ON `tbl_fixture_dates`.`date_id` = `tbl_fixtures`.`date_id` WHERE `tbl_fixtures`.`team_id` = \'' . $_GET['team_id'] . '\' order by match_date') or die(mysql_error()); if(mysql_num_rows($result) < 1) { echo('<tr><td colspan="6">Sorry, no results were found.</td></tr>'); } else { while($row = mysql_fetch_array($result)) { if ($row[HomeAway]=="Home") { echo "<tr><td>".date("d-M-Y", strtotime($row['match_date']))."</td><td><b>Yardley</b></td>"; echo ('<td align="center">'.$row[yardley_goals].'-'.$row[opposition_goals].'</td><td>'.$row[Opposition].'</td>'); echo ('<td>'.$row[Result].'</td><td>'); if($row_rsFixtures['yardley_goals']>0) { $match_id = $row_rsFixtures['match_id']; echo "Goal Scorers - "; $maxRows_rsScorers = 10; $pageNum_rsScorers = 0; if (isset($_GET['pageNum_rsScorers'])) { $pageNum_rsScorers = $_GET['pageNum_rsScorers']; } $startRow_rsScorers = $pageNum_rsScorers * $maxRows_rsScorers; $query_rsScorers = "SELECT tbl_scorers.scorer, tbl_scorers.goals, tbl_scorers.match_id, tbl_fixtures.match_id FROM tbl_fixtures, tbl_scorers WHERE tbl_fixtures.match_id = $match_id AND tbl_scorers.match_id = $match_id"; $query_limit_rsScorers = sprintf("%s LIMIT %d, %d", $query_rsScorers, $startRow_rsScorers, $maxRows_rsScorers); $rsScorers = mysql_query($query_limit_rsScorers) or die(mysql_error()); $row_rsScorers = mysql_fetch_assoc($rsScorers); if (isset($_GET['totalRows_rsScorers'])) { $totalRows_rsScorers = $_GET['totalRows_rsScorers']; } else { $all_rsScorers = mysql_query($query_rsScorers); $totalRows_rsScorers = mysql_num_rows($all_rsScorers); } $totalPages_rsScorers = ceil($totalRows_rsScorers/$maxRows_rsScorers)-1; do { echo $row_rsScorers['scorer'] ."("; echo $row_rsScorers['goals']; echo ")<br/>"; } while ($row_rsScorers = mysql_fetch_assoc($rsScorers)); } echo "<br/>"; } while ($row_rsFixtures = mysql_fetch_assoc($rsFixtures)); { echo('</td><td><a href="report.php?match_id='.$row[match_id].'">View Report</a></td></tr>'); echo "<tr><td>".date("d-M-Y", strtotime($row['match_date']))."</td><td>".$row[Opposition]."</td>"; echo ('<td align="center">'.$row[opposition_goals].'-'.$row[yardley_goals].'</td><td><b>Yardley</b></td>'); echo ('<td>'.$row[Result].'</td><td>'); if($row_rsFixtures['yardley_goals']>0) { $match_id = $row_rsFixtures['match_id']; echo "Goal Scorers - "; $maxRows_rsScorers = 10; $pageNum_rsScorers = 0; if (isset($_GET['pageNum_rsScorers'])) { $pageNum_rsScorers = $_GET['pageNum_rsScorers']; } $startRow_rsScorers = $pageNum_rsScorers * $maxRows_rsScorers; $query_rsScorers = "SELECT tbl_scorers.scorer, tbl_scorers.goals, tbl_scorers.match_id, tbl_fixtures.match_id FROM tbl_fixtures, tbl_scorers WHERE tbl_fixtures.match_id = $match_id AND tbl_scorers.match_id = $match_id"; $query_limit_rsScorers = sprintf("%s LIMIT %d, %d", $query_rsScorers, $startRow_rsScorers, $maxRows_rsScorers); $rsScorers = mysql_query($query_limit_rsScorers) or die(mysql_error()); $row_rsScorers = mysql_fetch_assoc($rsScorers); if (isset($_GET['totalRows_rsScorers'])) { $totalRows_rsScorers = $_GET['totalRows_rsScorers']; } else { $all_rsScorers = mysql_query($query_rsScorers); $totalRows_rsScorers = mysql_num_rows($all_rsScorers); } $totalPages_rsScorers = ceil($totalRows_rsScorers/$maxRows_rsScorers)-1; do { echo $row_rsScorers['scorer'] ."("; echo $row_rsScorers['goals']; echo ")<br/>"; } while ($row_rsScorers = mysql_fetch_assoc($rsScorers)); } echo "<br/>"; } while ($row_rsFixtures = mysql_fetch_assoc($rsFixtures)); echo('</td><td><a href="report.php?match_id='.$row[match_id].'">View Report<a></td></tr>'); } } mysql_close($con); ?> </table> </div> </div> <div> </div> </div> </body> </html> <?php mysql_free_result($rsFixtures); mysql_free_result($rsScorers); ?>
Any ideas, please
-
Thank you, just what I was after
-
I am nearly there now
I now have the following query
SELECT scorer, sum(goals) as total_goals, Sum(IF(team_id =1 and league="league",1,0)) AS firstleague, Sum(IF(team_id =1 and league="friendly",1,0)) AS firstfriendly, Sum(IF(team_id =2 and league="friendly",1,0)) AS fathoms, Sum(IF(team_id =3 and league="friendly",1,0)) AS badgers from `tbl_scorers` group by scorer order by total_goals desc ;
and get the following result
'Andy Pyke', 10, 2, 0, 2, 0
'Ismail Mutlib', 8, 0, 0, 4, 0
'Robin Stanley', 8, 0, 0, 5, 0
'Munib Altaf', 4, 0, 0, 3, 0
'Scott Oliver', 3, 0, 0, 3, 0
'Abrar Baig', 2, 1, 0, 0, 0
'Shoeb Siddiqui', 2, 0, 0, 2, 0
'Andy Elves', 2, 1, 0, 0, 0
'Luke Menzil', 2, 0, 0, 2, 0
'Saleem Hussain', 1, 0, 0, 1, 0
'Chris Wadhams', 1, 0, 0, 1, 0
'Rob McGuigan', 1, 1, 0, 0, 0
'Jonathan Smith', 1, 0, 0, 1, 0
'Glenn Sherrard', 1, 0, 0, 1, 0
'Jordan Allen', 1, 0, 0, 1, 0
'Gavin Hetherington', 1, 0, 0, 1, 0
What I need to do is total the goals field for each team like I have managed to do for the total goals, at the moment it is counting the number of records.
Shortening URLs
in Apache HTTP Server
Posted
Thanks for the replies
I now have the .htaccess file set to
When I go to a page I now get an error of
You don't have permission to access /page.php on this server.
The permissions are all ok.