Jump to content

ericburnard

Members
  • Posts

    46
  • Joined

  • Last visited

Everything posted by ericburnard

  1. oh and I managed to fix the links, they are all scrolling perfectly now
  2. Thanks for the advice. The <center> tag is and old bad habit that i just end up doing, especially when i have them in my css as well! I was struggling to center the countdown box vertically the other day, and obviously it didn't work properly. I will do some work tonight and add the doctype tonight and fixed the center tags. Thanks
  3. I am not the best at php, so there is probably a better way than this to do it, but, why don't you combine the 2 forms into one and also file_upload.php and combine.php into one. That way you can use the variable $file right into you combine script. no? Either that or if you were needing the $file variable again, put it in a session of for Permanent storage into a database.
  4. Hi there. I have just made a quick site over the past 2 days to help keep people up to date with my charity runs. Its not supposed to be anything flash or snazzy just a tool to help connect to people. Let me know what you think or if anyone finds any problems in any browsers. One thing problem that has arisen just now is that the links seem to work then not and then work again its very random. Let me know if anyone else has this problem. www.summer-running.com Thanks again Eric
  5. Hi there, I am needing a bit of advice. I am currently working on a new site, and I have my links at the top in a fixed header, and the rest of my content throughout the same page. http://sr.bluepigeon.com have a look it will make more sence then me describing it. Now i have worked a little bit with jQuery but do not know all the ins and outs of it, which is why I am a bit stuck. Now when I click one of the links on the page, I want the page to scroll down to that div and display it in the center of the screen. Now the code I am using (see below) obviously works on my laptops screen size but won't be as 'perfect' and centered on other sized screens. If i user the following code without each of the offsets then it will scroll to the correct div, but it will be displayed on the top of the page and not centered in the middle. What I am wanting to know, is, is it possible to make it scroll to a div and then center the div in the middle of the screen? If not how could i get as close as possible to this? $(document).ready(function(){ $("#blogl").click(function() { $('html, body').animate({ scrollTop: $("#blog").offset().top }, 2000); }); $("#racel").click(function() { $('html, body').animate({ scrollTop: $("#race").offset().top }, 2000); }); $("#aboutl").click(function() { $('html, body').animate({ scrollTop: $("#about").offset().top +700 }, 2000); }); $("#srl").click(function() { $('html, body').animate({ scrollTop: $("#sr").offset().top +100 }, 2000); }); $("#donatel").click(function() { $('html, body').animate({ scrollTop: $("#donate").offset().top }, 2000); }); }); Thanks for your help again Eric
  6. Always something so simple. I think I have been overwriting my brain as well today! You're a superstar Thanks!
  7. I seem to be struggling massively with this little problem. im sure its just a little something I am missing but it has be winding me up for hours. This is the said code. <? $id = $_POST['id']; $tags = $_POST['tags']; foreach( $id as $n ) { $tags = $tags[$n]; echo '<br><br>'.$tags.'---'.$n.'<br>'; $tags = explode(", ", $tags); $num=count($tags); echo "$num<br>"; foreach( $tags as $tag ) { print "ID: ".$n." --- tag: ".$tag." <br>\n"; } } ?> It finishes one full loop through fine, separates out all of the tags and puts them with the correct id. But when it moves onto the second full loop it seems to be getting nothing out of here $tags = $tags[$n]; I have tried changing the $n for one of the id numbers to make sure it is pulling the data from the $_POST[] and it is. The following is the results I am getting. cheese, more cheese, even more cheese---409 3 ID: 409 --- tag: cheese ID: 409 --- tag: more cheese ID: 409 --- tag: even more cheese ---287 1 ID: 287 --- tag: ---288 1 ID: 288 --- tag: ---406 1 ID: 406 --- tag: ---407 1 ID: 407 --- tag: ---408 1 ID: 408 --- tag: Any help or pointers in the right direction would be a massive help. Eric
  8. Im having a bit of trouble with my script. I wrote the script originaly to run from one variable which i changed manualy, but now im trying to put the whole script inside a loop. The script is now running all the way through fine on the first loop, starting starting the second but getting stuck at the part with my implode. This is my script that is around the implode area. Bear in mind that this code snippet is from a very large script. $t=1; while ($t <= $bm) { $mn=${'m'.$t}; $mn2[$t]="$mn"; $t++; } // The is where the script runs to, and the error comes from the next few lines and the script stops running $implode=implode(',', $mn2); print $implode; $query2="SELECT * FROM artists WHERE id IN(".implode(',', $mn2).")"; $result2=mysql_query($query2) or die(mysql_error()); $i=0; $bm2=$bm-1; while ($i <= $bm2) { $id3=mysql_result($result2,$i,"id"); ${"id3$i"} = $id3; $s1=mysql_result($result2,$i,"s1"); ${"s1$i"} = $s1; $s2=mysql_result($result2,$i,"s2"); ${"s2$i"} = $s2; $sl1=mysql_result($result2,$i,"sl1"); ${"sl1$i"} = $sl1; $sl2=mysql_result($result2,$i,"sl2"); ${"sl2$i"} = $sl2; $i++; } And this is the error that im getting ,,,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 ',,)' at line 1 Any help or point in the right direction would be amazing right no. Thanks Eric
  9. I will go study =) Ive only ever learnt from bits and bobs that ive needed at the time so really i should learn things properly! This is what i came up with before i saw the new posts $num2=$num+1; echo "<center><table border='0' cell padding='3' class='small'><tr>"; $x = 0; $xp = 1; while ($xp < $num2) { $id=mysql_result($result,$x,"id"); $caption=mysql_result($result,$x,"cap"); $address=mysql_result($result,$x,"address"); $date=mysql_result($result,$x,"date"); $album=mysql_result($result,$x,"album"); $member=mysql_result($result,$x,"member"); echo "<td><center><a href='?p=album&album=$album'><img src='/images/uploads/main/thumb_".$address."'></a><br><a href='?p=album&album=$album'>$album</a><br> Last Updated on $date By $member</center></td>"; echo (($xp % 2 == 0) && $xp != 0)? "</tr><tr>" : ""; $xp++; $x++; } echo "</tr></table>";
  10. But surely that world give you 4 results on the first row and the 3 on all the others?!
  11. If i have $x = 0 then the code echo ($x % 3 == 0)? "</tr><tr>" : ""; will equal 0 which means it will start a new row. So i will have 1 image on the first row and then 3 on all the others
  12. Have a good read through this http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html I have only just worked out how to get my JOINS to work, but its because of this that they do. Makes them alot easier to get your head round!
  13. Back again!! I have been trying to think of a way to do this but its starting to make my brain itch a bit too much now!!! I have the code below to display my query. Basicly its to disply 3 images and when 'x=a multiple of 3' it ends the row and starts another. The only problem is, that the first result will not be displayed as x has to begin at 1. if x begins at 0, it will display the first result and begin a new line. echo "<center><table border='0' cell padding='3'><tr>"; $x = 1; while ($x < $num) { $id=mysql_result($result,$x,"id"); $caption=mysql_result($result,$x,"cap"); $address=mysql_result($result,$x,"address"); $date=mysql_result($result,$x,"date"); $album=mysql_result($result,$x,"album"); $member=mysql_result($result,$x,"member"); echo "<td><center><img src='/images/uploads/main/thumb_".$address."'><br>$caption</center></td>"; echo ($x % 3 == 0)? "</tr><tr>" : ""; $x++; } echo "</tr></table>"; Can anyone point me in the right direction?? Thanks Eric
  14. You, my friend, are amazing. It took me a bit of time to work out how to put the rest of my bits in there but it works perfect! This is what i ended up with just so people can see (Only from the upload down) ##################### UPLOAD SCRIPT if($_SERVER['REQUEST_METHOD'] == "POST"){ // detect if a form was submitted foreach ($_FILES["uplimg"]["error"] as $key => $error) { // loop over each error element if ($error == UPLOAD_ERR_OK) { // if no error (the file uploaded correctly) $tmp_name = $_FILES["uplimg"]["tmp_name"][$key]; // reference the temp_name $name = $_FILES["uplimg"]["name"][$key]; // reference the name $caption = $_POST['cap'][$key]; // perform other validation tests here.... // process the uploaded file and caption information here.... $img_path = $upload_dir.$name; copy($tmp_name, $img_path ); if($enable_thumbnails) make_thumbnails($thumb_dir, $name); echo "Name: $name, Caption: $caption, <br />"; include ('db.php'); $con = mysql_connect("$host","$username","$password"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("erikee10_eric", $con); $sql="INSERT INTO photos (address, cap) VALUES ('$name', '$caption')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } } } } ############################### HTML FORM $i = 0; $form_img = ''; while($i++ < $upload_image_limit){ $form_img .= "<label>Image $i: </label> <input type='file' name='uplimg[$i]'><br /> Caption: <input type='text' name='cap[$i]' value='cap$i'><br /><br />\n"; } $htmo .= ' <p>'.$feedback.'</p> <form method="post" enctype="multipart/form-data"> '.$form_img.' <br /> <input type="submit" value="Upload Images!" style="margin-left: 50px;" /> </form> '; echo $htmo; Having these displayed echo '<pre>Files:',print_r($_FILES,true),'</pre>'; // display the $_FILES array for demo purposes echo '<pre>Post:',print_r($_POST,true),'</pre>'; // display the $_POST array for demo purposes Really helped me understand arrays and the $_FILES function alot better! Thanks again Eric
  15. Thanks for the reply but i really don't understand it. I don't know what or how im supposed to put it into an array. I tried to understand $_FILES function again but the examples make me more confused. I cant use the $_FILES function to move the text from the text box. I think i can understand how to get it from the array into the database but no idea how to get the text box data into the array.
  16. Hey again!! I have a piece of code i found on a forum that will upload and make a thumbnail of the uploaded image. I have changed a few pieces and tried adding some parts to make it take extra fields from the form and put them into a database. The code i have is below <?php $upload_image_limit = 2; // How many images you want to upload at once? $upload_dir = "./images/uploads/main/"; // default script location, use relative or absolute path $thumb_dir = "./images/uploads/main/"; // default script location, use relative or absolute path $enable_thumbnails = 1 ; // set 0 to disable thumbnail creation $max_image_size = 3024000 ; // max image size in bytes, default 1MB ##################### THUMBNAIL CREATER FROM GIF / JPG / PNG function make_thumbnails($updir, $img){ $thumbnail_width = 80; $thumbnail_height = 60; $thumb_preword = "thumb_"; $arr_image_details = GetImageSize("$updir"."$img"); $original_width = $arr_image_details[0]; $original_height = $arr_image_details[1]; if( $original_width > $original_height ){ $new_width = $thumbnail_width; $new_height = intval($original_height*$new_width/$original_width); } else { $new_height = $thumbnail_height; $new_width = intval($original_width*$new_height/$original_height); } $dest_x = intval(($thumbnail_width - $new_width) / 2); $dest_y = intval(($thumbnail_height - $new_height) / 2); if($arr_image_details[2]==1) { $imgt = "ImageGIF"; $imgcreatefrom = "ImageCreateFromGIF"; } if($arr_image_details[2]==2) { $imgt = "ImageJPEG"; $imgcreatefrom = "ImageCreateFromJPEG"; } if($arr_image_details[2]==3) { $imgt = "ImagePNG"; $imgcreatefrom = "ImageCreateFromPNG"; } if( $imgt ) { $old_image = $imgcreatefrom("$updir"."$img"); $new_image = imagecreatetruecolor($thumbnail_width, $thumbnail_height); imageCopyResized($new_image,$old_image,$dest_x, $dest_y,0,0,$new_width,$new_height,$original_width,$original_height); $imgt($new_image,"$updir"."$thumb_preword"."$img"); } } ################################# UPLOAD IMAGES foreach($_FILES as $k => $v){ $img_type = ""; $caption= "cap".$i."" ; ### $htmo .= "$k => $v<hr />"; ### print_r($_FILES); if( !$_FILES[$k]['error'] && preg_match("#^image/#i", $_FILES[$k]['type']) && $_FILES[$k]['size'] < $max_image_size ){ $img_type = ($_FILES[$k]['type'] == "image/jpeg") ? ".jpg" : $img_type ; $img_type = ($_FILES[$k]['type'] == "image/gif") ? ".gif" : $img_type ; $img_type = ($_FILES[$k]['type'] == "image/png") ? ".png" : $img_type ; $img_rname = $_FILES[$k]['name']; $img_path = $upload_dir.$img_rname; copy( $_FILES[$k]['tmp_name'], $img_path ); if($enable_thumbnails) make_thumbnails($thumb_dir, $img_rname); $feedback .= "Image and thumbnail created $img_rname with caption $caption<br />"; include ('db.php'); $con = mysql_connect("$host","$username","$password"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("erikee10_eric", $con); $sql="INSERT INTO photos (address, cap) VALUES ('$img_rname', '$caption')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } } } ############################### HTML FORM while($i++ < $upload_image_limit){ $form_img .= '<label>Image '.$i.': </label> <input type="file" name="uplimg'.$i.'"><br /> <input type="text" name="cap'.$i.'" value="cap'.$i.'">'; } $htmo .= ' <p>'.$feedback.'</p> <form method="post" enctype="multipart/form-data"> '.$form_img.' <br /> <input type="submit" value="Upload Images!" style="margin-left: 50px;" /> </form> '; echo $htmo; echo "$s"; ?> I have tried different was from POST script to putting in another loop to increase the cap number when it goes to insert the data. I spent 4 hours on it last night trying different ways and im stumped now. Any help would be great! Thanks a million Eric
  17. Hi there, have been trying to work this out for a while now but am really stumped so i need some help. Just to keep it easy i have a table with 4 columns id name nameid man/woman 0 barry 1 man 1 barry 1 man 2 george 2 man 3 barry 1 man Basicly what i want to know is how can i my query output barry and george and not barry, barry, George and barry. Im so sure that this is simple but its early in the morning and its annoying me greatly now! I have the man/woman value coming in via a $_get function if this helps at all Thanks a million Eric
  18. Im not sure if this is the right forum to post this but i wasnt to sure. Basicly i dont have the foggyest how to do this. I have a table say 5x5, alont the top there is A,B,C,D,E and down the side there is 1,2,3,4,5. I have names in the database that need to go into this table. Now the problem is some of these names need to span 2,3 or 4 columns. So, how can i get, say, Dave, who needs to be in row 2 but across columns 2,3 and 4, to span columns 2,3 and 4?? Help is really needed. Thanks Eric
  19. That worked perfect. Thank you very much. Could you just check for me that this is ok how i have changed it (or if you would have done it different? <? include ('db.php'); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM departments"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<table><tr>"; $x = 1; while ($x < $num) { $department=mysql_result($result,$x,"department"); echo "<td>$department</td>"; echo ($x % 5 == 0)? "</tr><tr>" : ""; $x++; } echo "</tr></table>"; ?>
  20. That didnt make any sence sorry. I think i know what you mean but there are different amouts of data to be diplayed in each table and the amout of data will be changed by the user
  21. Basicly what im wanting is to get data from my sql database (which i can do) diplay the results in a table (which i can do) But what im unsure on is this. When 5 results have been diplayed in the table, how can i get it to start a new row and display the next 5 results then a new row etc etc. Help and guidence would be awesome Thanks again Eric x
  22. ok i have fixed the last problem. I numbered all of the deps that were in the form and then deleted the ones that wernt needed in the address box. Now im having a problem with getting the dep value from the address box even though it worked before!! $depart=$_GET["dep"]; That is what im using which is correct, right? So every time i paste $depart it should display the value from the address box
  23. Thats worked!! thanks!! Just one more problem has arrisen its now sending to this link http://ericburnard.freehostia.com/login2.php?page=6&dep=&dep=Admin There is one dep to many in the address
  24. Hey there. First of here is my problem code ? include ('db.php'); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM departments"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo " <form name='dep' action='login2.php?page=6&dep=$department' method='get'> <select name='dep'>"; $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $department=mysql_result($result,$i,"department"); echo " <option value='$department'>$department</option> "; $i++; } ?> </select> <input type="submit" value="Go"> </form> Ass you can see, i am wanting to send my form to 'login2.php?page=6&dep=$department' The problem that im having is that it is only sending the user to 'login2.php?dep=(whatever department they chose)' I have tried allsorts from taking the name='dep' out of the select bit to changing the method of the form to 'post' (usin post will send it to the right page but it wont diplay the value chose in the dropdown box on the page before) Im sure its something really stupid that ive missed or done wrong but its starting to bug me now!!! Any help please Eric x
×
×
  • 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.