Jump to content

ericburnard

Members
  • Posts

    46
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

ericburnard's Achievements

Member

Member (2/5)

0

Reputation

  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.
×
×
  • 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.