
Mutley
Members-
Posts
765 -
Joined
-
Last visited
Everything posted by Mutley
-
I've done a nice bit of code for a gallery, each gallery section is divided like this: gallery.php?id=1 gallery.php?id=2 gallery.php?id=3 etc. Can I make it so if you put in www.mydomain.com/site1 ... it goes to gallery.php?id=2 and again for .com/site2 goes to gallery.php?id=2 etc. Is this possible, if so how?
-
I have a slight problem. It's confusing me, all the database stuff is set, I just don't know how to lay it out. What I want is a table with a list of players in a team, these players are in a seperate database table so it includes them in a drop down box. Theres 4 teams and I want it to know which team to edit. When you hit the submit button. So 4 seperate tables. Here is my mess of a code: The numbers, 1 to 20 are the players, 20 players. [code]<?php require_once("connection.php"); mysql_select_db("rufc"); if(isset($_GET['id'])){ $id = $_GET['id']; $result = mysql_query("SELECT id, team, against, kickoff, against, side, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, date DATE_FORMAT(date,'%d-%m-%Y') AS dstamp FROM teamplayers WHERE id=".$id." "); while($row = mysql_fetch_array( $result )) { ?> <form action="update_confirm.php?id=1" method="POST"> <table width="90%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td>Team 1 Players: </td> </tr> <tr> <td>Against:</td> <td><input class="form" type="text" size="20" name="agaubst" value="<?=$row['against']; ?>"> </td> </tr> <tr> <td>Date:</td> <td><input class="form" type="text" size="8" name="date" value="<?=$row['dstamp']; ?>"></td> </tr> <tr> <td>Kick-off:</td> <td><input class="form" type="text" size="12" name="kickoff" value="<?=$row['kickoff']; ?>"> </td> </tr> <tr> <td>1</td> <td> <select name="1"> <option value="<?=$row['1']; ?>"><?=$row['1']; ?></option> <? include('playerlistdata.php'); ?> </select> </td> </tr> <tr> <td>2</td> <td> <select name="2"> <option value="<?=$row['2']; ?>"><?=$row['2']; ?></option> <? include('playerlistdata.php'); ?> </select> </td> </tr> <tr> <td>3</td> <td> <select name="3"> <option value="<?=$row['3']; ?>"><?=$row['3']; ?></option> <? include('playerlistdata.php'); ?> </select> </td> </tr> <tr> <td>4</td> <td> <select name="4"> <option value="<?=$row['4']; ?>"><?=$row['4']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>5</td> <td> <select name="5"> <option value="<?=$row['5']; ?>"><?=$row['5']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>6</td> <td> <select name="6"> <option value="<?=$row['6']; ?>"><?=$row['6']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>7</td> <td> <select name="7"> <option value="<?=$row['7']; ?>"><?=$row['7']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>8</td> <td> <select name="8"> <option value="<?=$row['8']; ?>"><?=$row['8']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>9</td> <td> <select name="9"> <option value="<?=$row['9']; ?>"><?=$row['9']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>10</td> <td> <select name="10"> <option value="<?=$row['10']; ?>"><?=$row['10']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>11</td> <td> <select name="11"> <option value="<?=$row['11']; ?>"><?=$row['11']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>12</td> <td> <select name="12"> <option value="<?=$row['12']; ?>"><?=$row['12']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>13</td> <td> <select name="13"> <option value="<?=$row['13']; ?>"><?=$row['13']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>14</td> <td> <select name="14"> <option value="<?=$row['14']; ?>"><?=$row['14']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>15</td> <td> <select name="15"> <option value="<?=$row['15']; ?>"><?=$row['15']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>16</td> <td> <select name="16"> <option value="<?=$row['16']; ?>"><?=$row['16']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>17</td> <td> <select name="17"> <option value="<?=$row['17']; ?>"><?=$row['17']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>18</td> <td> <select name="18"> <option value="<?=$row['18']; ?>"><?=$row['18']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>19</td> <td> <select name="19"> <option value="<?=$row['19']; ?>"><?=$row['19']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> <tr> <td>20</td> <td><select name="19"> <option value="<?=$row['20']; ?>"><?=$row['20']; ?></option> <? include('playerlistdata.php'); ?> </select></td> </tr> </table> <input class="form" type="submit" value="Click to Update Playerlist"> </form> <br /><br /> <?php } } ?>[/code] So when I click submit, I want it to know which team it is out of the 4 and not just update all the teams with the same info.
-
I tried to do a simple include, to have my forum (SMF) included on my website. Unfortunatly I just get: [code]session_start() [function.session-start]: Cannot send session cache limiter - headers already sent[/code] I thought this was due to spaces after/before the PHP tags but I can't see any. My forum.php is just 7 lines including everything: [code]<?php $title = "Forum"; $sideplans = "no"; include('inc/header.php'); include('forum/index.php'); include('inc/footer.php'); ?>[/code] Any ideas?
-
Can anyone see how I fix this problem?
-
The problem is Orio, I do it like this using varialbes, I already have quotes: [code]if(is_dir($directory.$item)) { $team = $_GET['team']; ?> <p><a href="teamsgallery3.php?team=<?=$team?>&subject=2006&game=<?=$item?>"><?=$item?></a> - <? include("gallery/images/".$team."/2006/".$item."/date/date.txt");?></p><? } } } } } read_contents("gallery/images/".$team."/2006");[/code]
-
Those codes are both error free. Post ALL the code to your index.php Your probably missing a closed curley bracket at the end.
-
PLEASE could someone help me with this, it is becoming urgent. ???
-
What should I do here: [code] for($i=0;$i<$num_rows;$i++) {[/code] Is everything else in the above posts correct?
-
Thanks, I can't see if that works because this file needs changing in order to work with yours above: [code]require_once("connection.php"); for($i=0;$i<$num_rows;$i++) { $team = $_POST['team']; $p = $_POST[p.$i]; $w = $_POST[w.$i]; $d = $_POST[d.$i]; $l = $_POST[l.$i]; $for = $_POST[for.$i]; $against = $_POST[against.$i]; $diff = $_POST[diff.$i]; $pts = $_POST[pts.$i]; mysql_select_db("rufc"); $sql = "UPDATE league SET team='$team', p='$p', w='$w', d='$d', l='$l', for='$for', against='$against', diff='$diff', pts='$pts' WHERE team='$team'"; mysql_query($sql); echo "The selected information was updated! "; echo "<a href='league.php'>Click here[/url] to continue"; echo $sql; }[/code] I guess the "FOR" statement is wrong at the top? What should it be? Thanks for anyones help.
-
What I have is a scores table. It has a list of every sports match, some are played and some are not. What I want to do is make a playerlist, for who is playing in the next UNPLAYED sports match who are in teams 1, 2, 3 and 4. (There are 19 teams but I only want to do this for first 4). Here is my code: [code]<? require_once("connection.php"); $sql = "SELECT home, away, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`, `19` "; $sql .= "FROM scores "; $sql .= "WHERE team_id="1", "2", "3", "4" "; $sql .= "ORDER BY date"; $sql .= "LIMIT 4"; $result = mysql_query($sql); if(mysql_num_rows($result)!=0) { while(list($home, $away, $_1, $_2, $_3, $_4, $_5, $_6, $_7, $_8, $_9, $_10, $_11, $_12, $_13, $_14, $_15, $_16, $_17, $_18, $_19 ) = mysql_fetch_row($result)) { ?> Playerlist for match: <?=$home?> vs <?=$away?> <br /><br /> <table width="300" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="30"><strong>#</strong></td> <td width="270"><strong>Player</strong></td> </tr> <tr> <td>1</td> <td><?=$_1?></td> </tr> <tr> <td>2</td> <td><?=$_2?></td> </tr> <tr> <td>3</td> <td><?=$_3?></td> </tr> <tr> <td>4</td> <td><?=$_4?></td> </tr> <tr> <td>5</td> <td><?=$_5?></td> </tr> <tr> <td>6</td> <td><?=$_6?></td> </tr> <tr> <td>7</td> <td><?=$_7?></td> </tr> <tr> <td>8</td> <td><?=$_8?></td> </tr> <tr> <td>9</td> <td><?=$_9?></td> </tr> <tr> <td>10</td> <td><?=$_10?></td> </tr> <tr> <td>11</td> <td><?=$_11?></td> </tr> <tr> <td>12</td> <td><?=$_12?></td> </tr> <tr> <td>13</td> <td><?=$_13?></td> </tr> <tr> <td>14</td> <td><?=$_14?></td> </tr> <tr> <td>15</td> <td><?=$_15?></td> </tr> <tr> <td>16</td> <td><?=$_16?></td> </tr> <tr> <td>17</td> <td><?=$_17?></td> </tr> <tr> <td>18</td> <td><?=$_18?></td> </tr> <tr> <td>19</td> <td><?=$_19?></td> </tr> </table> <br/><br/> <? } } ?> [/code] As you can see the WHERE is probably wrong? I want it to do teams 1, 2, 3 and 4. The other thing is, how do I make it only display the matches with no score? So maybe: if($score == "") or something? I really need help on what to do here. The numbers you see 1 to 19 are the players.
-
Updating all fields can't be this hard to get no reply? Unless there is an easier way? :(
-
What error do you get?
-
ID is fine (first line which is "18" below), I got an error though: [code] 18 Unable to perform query 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 '1='', 2='', 3='', 4='', 5='', 6='', 7='', 8='', 9='', 10='', 11='', 12='', 13=''' at line 1[/code] I deliberatly put no data in by the way, so don't worry that nothing = anything. Thanks for the help guys!
-
Thanks. My script seems to not be updating my content, does this look right now I've changed it? [code]if(isset($id)){ $_1 = $_POST['1']; $_2 = $_POST['2']; $_3 = $_POST['3']; $_4 = $_POST['4']; $_5 = $_POST['5']; $_6 = $_POST['6']; $_7 = $_POST['7']; $_8 = $_POST['8']; $_9 = $_POST['9']; $_10 = $_POST['10']; $_11 = $_POST['11']; $_12 = $_POST['12']; $_13 = $_POST['13']; $_14 = $_POST['14']; $_15 = $_POST['15']; $_16 = $_POST['16']; $_17 = $_POST['17']; $_18 = $_POST['18']; $_19 = $_POST['19']; mysql_select_db("rufc"); $sql = "UPDATE scores SET 1='$_1', 2='$_2', 3='$_3', 4='$_4', 5='$_5', 6='$_6', 7='$_7', 8='$_8', 9='$_9', 10='$_10', 11='$_11', 12='$_12', 13='$_13', 14='$_14', 15='$_15', 16='$_16', 17='$_17', 18='$_18', 19='$_19' WHERE score_id = '".$id."'"; mysql_query($sql);[/code] The SQL echos on the page and looks fine but makes no change to the database. It has other fields in rows not just 1, 2, 3, 4 etc, would that be the problem? Because I'm not updating them with anything? I just want the fields listed above (the numbers) to be updated.
-
If I have a folder called "Yes and no" for example, with spaces, how do I make it display as "Yes and no" in the list but work as a link when you click it? It can't find a folder called "Yes and no" because it should have %20 in I think. Maybe something like "Yes-and-no" but the list filters out the - so it looks like "Yes and no" but the link still stays as "Yes-and-no". If you understand me?
-
Simple put: [code]$thumbnail_files = glob($thumbnail_folder . "/*jpg"); [/code] I would like it to find "jpg" AND "JPG" not just jpg which it is atm. Can't seem to get it to work however. If anyone knows how?
-
[quote author=Mutley link=topic=108546.msg437085#msg437085 date=1158655398] Got it but need help with this line: [code]$thumbnail_files = glob($thumbnail_folder . "/*.jpg");[/code] If the images are .JPG they don't show but do with .jpg, how do I make it show either show, not case sensitive? [/quote] Fixed them all now, lol, so no need to reply, a nice little blog of my problems, I guess I was on at a quiet time. :D This: [code]$thumbnail_files = glob($thumbnail_folder . "/*.jpg");[/code] Should of been: [code]$thumbnail_files = glob($thumbnail_folder . "/*");[/code] Thanks.
-
Got it but need help with this line: [code]$thumbnail_files = glob($thumbnail_folder . "/*.jpg");[/code] If the images are .JPG they don't show but do with .jpg, how do I make it show either show, not case sensitive?
-
Please, can anyone help?
-
Problem 1 fixed, I'm getting there, that just leaves problem 3 left which I just can't figure out myself. I just found at the top of the file this (can't belive I missed it): [code] build = false; if(isset($HTTP_GET_VARS["b"]) || isset($HTTP_GET_VARS["build"])) $build = true; [/code] ...which is how it creates the thumbnails and displays the images, if ?b then it creates thumbnails and makes images work. If not it displays gallery and if the images in the source foldr havn't been made it doesn't show anything.
-
The answer is probably a Google away but I want a more discussable answer. :) I hear Ajax is used alot by Google, it's a user interface, like Gmail, using Javascript and PHP/XML? Would I be correct in saying that? It sounds like a fairly new method of coding, well I only first heard of it in the last few months so I would be intrested in getting into it.
-
Heres what I have done so far: [code]<table align="center" cellpadding="5"> <? $build = false; if(isset($HTTP_GET_VARS["b"]) || isset($HTTP_GET_VARS["build"])) $build = true; $image = ""; if(isset($HTTP_GET_VARS["image"])) $image = $HTTP_GET_VARS["image"]; $team = $HTTP_GET_VARS['team']; $game = $HTTP_GET_VARS['game']; $thumbnail_folder = "./gallery/images/".stripslashes($team)."/2006/".stripslashes($game).""; $thumbnail_width = 160; $thumbnail_height = 120; $image_folder = "./gallery/images/".stripslashes($team)."/2006/".stripslashes($game).""; $image_width = 640; $image_height = 480; $source_folder = "./gallery/images/".stripslashes($team)."/2006/".stripslashes($game).""; //The number of thumbs in a row, //followed by the number of rows in a page. $row_size = 3; $page_size = 5; $row = $HTTP_GET_VARS["row"]; if($row == "") $row = 0; //if(is_dir($thumbnail_folder) == false) // mkdir($thumbnail_folder, 0755); //if(is_dir($image_folder) == false) // mkdir($image_folder, 0755); //if(is_dir($source_folder) == false) // mkdir($source_folder, 0755); //if($build == true) // { //Get an array of all the jpg files in the current source directory. $source_files = glob($source_folder . "/*.JPG"); //for($index = 0; $index < count($source_files); $index++) // { //$original_jpg = imagecreatefromjpeg($source_files[$index]); //$original_size = getimagesize($source_files[$index]); //$original_width = $original_size[0]; $original_height = $original_size[1]; //$source_file_name = substr($source_files[$index], strrpos($source_files[$index], "/") + 1); //$thumbnail_jpg = imagecreatetruecolor($thumbnail_width, $thumbnail_height); //imagecopyresized($thumbnail_jpg, $original_jpg, 0, 0, 0, 0, // $thumbnail_width, $thumbnail_height, $original_width, $original_height); //imagejpeg($thumbnail_jpg, $thumbnail_folder . "/" . $source_file_name); //imagedestroy($thumbnail_jpg); //$image_jpg = imagecreatetruecolor($image_width, $image_height); //imagecopyresized($image_jpg, $original_jpg, 0, 0, 0, 0, // $image_width, $image_height, $original_width, $original_height); //imagejpeg($image_jpg, $image_folder . "/" . $source_file_name); //imagedestroy($image_jpg); //imagedestroy($original_jpeg); //} // } ?> <? //Get an array of all the jpg files in the current thumbnail directory. $thumbnail_files = glob($thumbnail_folder . "/*.JPG"); $first_index = $row * $row_size; $last_index = $first_index + $page_size * $row_size; if($last_index > sizeof($thumbnail_files)) $last_index = sizeof($thumbnail_files); for($index = $first_index; $index < $last_index; $index++) { ?> <? if($index == $first_index) { ?> <tr> <? } ?> <? if($index != 0 && $index % $row_size == 0 && $image == "") { ?> </tr><tr> <? } ?> <? $image_file = substr($thumbnail_files[$index], strrpos($thumbnail_files[$index], "/") + 1); $image_url = "galleryfind.php?team=" . $team . "&subject=2006&game=" . $game . "&row=" . $row . "&image=" . $image_file; ?> <? if ($image == "") { ?> <td> <a onclick="window.open(this.href, 'popupwindow', 'width=700,height=600,scrollbars,resizable'); return false;" href="<?= $image_url ?>"> <img width="150" height="120" src="<?= $thumbnail_files[$index] ?>" border="3" style="border-color:aa5500;" /></a></td> <? } ?> <? $next_index = $index + 1; if($next_index >= $last_index) $next_index = $first_index; $next_image_file = substr($thumbnail_files[$next_index], strrpos($thumbnail_files[$next_index], "/") + 1); ?> <!--^ Get Next Image ^--> <? if($image == $image_file) { ?> <td colspan="2"> <a href="galleryfind.php?row=<?= $row ?>&image=<?= $next_image_file ?>"> <img src="<?= $image_folder . "/" . $image_file ?>" border="3" style="border-color:aa5500;" /></a> <br /> <center><a href="javascript:window.close();">Click here to close this Window</a></center> </td> </tr> <!--^ Image full size pop-up ^--> <? $previous_index = $index - 1; if($previous_index < $first_index) $previous_index = $last_index - 1; $previous_image_file = substr($thumbnail_files[$previous_index], strrpos($thumbnail_files[$previous_index], "/") + 1); ?> <!--^ Get Previous Image ^--> <tr> <td> <a href="galleryfind.php?team=<?=$team?>&subject=2006&game=<?=$game?>&row=<?= $row ?>&image=<?= $previous_image_file ?>"><b>Previous Image</b></a> </td> <td align="right"> <a href="galleryfind.php?team=<?=$team?>&subject=2006&game=<?=$game?>&row=<?= $row ?>&image=<?= $next_image_file ?>"><b>Next Image</b></a> </td> <? } ?> <? if($index == count($thumbnail_files) - 1) { ?> </tr> <? } ?> <? } ?> <? if($image == "") { ?> <tr> <td colspan="<?= $row_size ?>"> <table cellspacing="0" cellpadding="0" width="100%"> <tr> <td> <? $previous_row = $row - $page_size; $last_page_size = ceil(sizeof($thumbnail_files) / $row_size) % $page_size; if($last_page_size == 0) $last_page_size = $page_size; if($previous_row < 0) $previous_row = ceil(sizeof($thumbnail_files) / $row_size) - $last_page_size; ?> <a href="./teamsgallery3.php?team=<?=$team?>&subject=2006&game=<?=$game?>&row=<?= $previous_row ?>">Previous Page</a> </td> <td align="right"> <? $next_row = $row + $page_size; if($next_row >= ceil(sizeof($thumbnail_files) / $row_size)) $next_row = 0; ?> <a href="./teamsgallery3.php?team=<?=$team?>&subject=2006&game=<?=$game?>&row=<?= $next_row ?>">Next Page</a> </td> </tr> </table> </td> </tr> <? } ?> </table>[/code] I've been trying to solve problem 3, ignoring problem 1 for now, as it is least important. I have tried commenting out some lines in hope that it will display the images without having to create thumbnails (all I want it to do is show the images in a folder, currently, when you upload the images you need to do galleryfind.php?b to create them and only then will they be displayed!) It hasn't worked what I have commented out, which makes me belive that it is in this code maybe: [code]$thumbnail_files = glob($thumbnail_folder . "/*.JPG"); $first_index = $row * $row_size; $last_index = $first_index + $page_size * $row_size; if($last_index > sizeof($thumbnail_files)) $last_index = sizeof($thumbnail_files); for($index = $first_index; $index < $last_index; $index++) { ?> <? if($index == $first_index) { ?> <tr> <? } ?> <? if($index != 0 && $index % $row_size == 0 && $image == "") { ?> </tr><tr> <? } ?> [/code] But I can't be sure. As it is rather too complex for me. :(
-
I've fixed number 2 but stumped on problem 1 at the moment. I think it's because the file is included that it can't find the next row. The file is called "galleryfind.php" the "teamsgallery3.php" is where it is included. It works find if I do it from galleryfind.php