Jump to content

Ell20

Members
  • Posts

    337
  • Joined

  • Last visited

    Never

Everything posted by Ell20

  1. Hey, Im trying to get a result such as this: Group Name 1: Link 1, Link 2....(for how many links there are) Group Name 2: Link 1, Link 2.... (for how many links there are) etc.... So far I have this: <?php $result3 = mysql_query("SELECT * FROM pictures WHERE user_id = '$userid'") or die(mysql_error()); $found3 = false; while ($i3 = mysql_fetch_array($result3)) {; $group = $i3['group_name']; echo "<b>".$i3['group_name']."</b>: "; $result2 = mysql_query("SELECT * FROM pictures WHERE user_id = '$userid' AND group_name = '$group'") or die(mysql_error()); $found2 = false; $r = 1; while ($i2 = mysql_fetch_array($result2)) { $found2 = true; ?> <a href="../uploaded_files/<?=$i2['picture_name']?>" target="_blank">Link <?=$r?></a> <?php $r = $r + 1; }} ?> Which is close however its printing out the group name and links too many times. Can anyone help me finsihed this? Appreciate the help Thanks
  2. I used another select statement in the end. But its working so thats the main thing. Thanks for your help
  3. I get what your saying but at the moment the SQL statement just pulls out all the names that are avaliable, so do I need another SQL statement to get the current value from which I then create the new variable?? Cheers
  4. Hi, I have a dynamic drop down box which lists the names of users from the database to select from then once selected it posts the user_id of the user into the database. However when I then edit this value I would like the drop down box to display the current value that is stored in the database, how would I go about doing this? Here is my current code: <select name="officer"><option value="">Select Officer:</option> <?php $sql = "SELECT * FROM users WHERE club_id = '$id' AND member_type != 'Guest'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ $user_id = $row["user_id"]; $first_name = $row['first_name']; $last_name = $row['last_name']; $name = "$first_name $last_name"; ?> <option value="<?php echo $user_id ?>"><?php echo $name ?></option> <?php } ?> </select> Thanks for your help
  5. Im still pulling my hair out with this, if anyone can help id really appreciate it.
  6. Anyone? The code is nearly there Im just not quiet sure how to finish it off? Thanks
  7. Ell20

    bullet points

    Well your using <li> which is the tag for bulletpoints, if you remove the <li> </li> tags the bullet points will go.
  8. Hey, At the moment I have a normnal registration which works fine. However I have now changed things inside the system which means that a name when used in the system is added to the database. This posses the problem that if the user then decides they wish to sign up the pair need to be matched to prevent having two usernames which are actually the same person. I have attempted to do this using the Like function in MySQL and have so far managed to get it to display matching names in a drop down box if there are any otherwise the registration goes through as normal. I have now attempted to add buttons under the drop down box to link the details from the registration page to the name in the drop down box however when I press the button I cant get it to work. This is probably a simple soultion for a good PHP coder but I am still new and learning all the time. The code for this is quiet long so if anyone is willing to help I would be happy to send the file via email to make things easier. Really appreciate the help
  9. Excellent, thanks for your help!
  10. Hi, I have some code which includes some GETS, however each GET contains a submit button which display a message and performs a task. This is working fine however once the submit button is pressed the current GET is lost and it returns to the original page from which the message is also display on. How do I adapt the code so that when the submit button is pressed the message is displayed in the current GET and it doesnt refresh back to the original page? <?php if (isset($_POST['submit'])) { echo "<center>This is test 1</center>"; } if (isset($_POST['submit2'])) { echo "<center>This is test 2</center>"; } ?> <table align="center" border="1" cellpadding="0" cellspacing="0" width="60%" class="game"> <tr> <td colspan="4"> Testing </td> </tr> <tr height="50px" align="center"> <td> <a href='<?=$_SERVER['PHP_SELF']."?";?>&mode=test1'>Test1</a> </td> <td> <a href='<?=$_SERVER['PHP_SELF']."?";?>&mode=test2'>Test2</a> </td> </table> <?php if (isset($_GET['mode']) && $_GET['mode'] == 'test1') { ?> <table width="60%" align="center" cellspacing="0" border="0" class="game"> <tr> <th width="50%">Testing 1</th> </tr> <tr> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <td width="33%" align="center"><input name="submit" type="submit" value="Test" /></td> </form> </tr> </table> <?php } ?> <?php if (isset($_GET['mode']) && $_GET['mode'] == 'test2') { ?> <table width="60%" align="center" cellspacing="0" border="0" class="game"> <tr> <th width="50%">Testing 2</th> </tr> <tr> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <td width="33%" align="center"><input name="submit2" type="submit" value="Test 2" /></td> </form> </tr> </table> <?php } ?> Appreciate any help
  11. Hey, I have been doing my nut trying to work this out so would appreciate any help! I have created some code in dreamweaver. As its a project which I need to document I need to add the code into Microsoft Word. However when doing so I loose all the highlights which dreamweaver uses. Is there anyway in which I can copy code from dreamweaver into Microsoft Word with the highlights still in place? Really appreciate the help Cheers
  12. Hey, At the moment I have a registration page where users can register to join the site. However as their names can already be used within the system I need to do a check to see whether their name already exsists. I thought the best way would be to use the LIKE mysql function to check the database when the user attempts to register, if last_name and first_name are not close to matching any in the database then register as normal otherwise display a drop down box with the possible matches then UPDATE the database with the additional information added by the user when registering. However I cant seem to get it to work. I code is quiet long so if someone is willing to help I will email the code. Thanks alot Elliot
  13. Excellent that seems to have worked!! Appreciate your help so much!!
  14. Error given out: Subquery returns more than 1 row
  15. Error given out: Subquery returns more than 1 row
  16. Ill try and explain a bit clearer. A club has lots of teams, each team has a captain and a vice_captain. When you create a team the captain and vice_captain fields contain the user_id from the users table. When I display the teams I want to display the captain and vice_captain however I dont want to display the user_id number I want to display the first_name and last_name of the user that is linked to that user_id. Appreciate your help
  17. Thanks for the reply, this was what I tried myself but it doesnt appear to work as it gives out no rows but it should give out 2 according to the database. Cheers
  18. I want to display the first_name and last_name of the captain and vice_captain by using the user_id rather than having to duplicate the name again. Thanks
  19. Hey, I have been going over my database/website and redoing the code so that I can reduce data redundancy etc. I have done quiet alot but I am stuck on this particular one: Users Table: user_id first_name last_name Teams Table: captain vice_captain I have made it so that captain and vice_captain contain the user_id of the user that I want to display however I cant get it working: $result = mysql_query("SELECT * FROM teams INNER JOIN users ON teams.captain = users.user_id AND teams.vice_captain = users.user_id WHERE teams.club_id = '$id' ORDER BY 'team_id' ASC LIMIT $from, $max_results") or die(mysql_error()); If I take away the vice_captain join bit I can get it to work but I cant get them to display the correct values together. Appreciate any help
  20. Is there not a topic solved button anymore?!
  21. Excellent, seems to have solved the problem. Thanks for your help!
  22. This is what got returned when it fails: Array ( [imagefile] => Array ( [name] => new.jpeg [type] => image/pjpeg [tmp_name] => /tmp/php2lvzG1 [error] => 0 => 3003 ) )
  23. Hi, I have a fully working image upload script, in Mozilla Firefox, however if I attempt to upload images in Internet Explorer it dosent like it and says Picture not uploaded, wrong file type. It only seems to occur with JPG, JPEGS. if($_POST['changeimage']){ $tab1=0; $tab3=1; $tab2=0; $tab4=0; $tab5=0; list($width, $height) = getimagesize($_FILES['imagefile']['tmp_name']); if ($width <= 350 && $height <= 300) { if (($_FILES['imagefile']['type'] == "image/jpeg") || ($_FILES["imagefile"]["type"] == "image/gif") || ($_FILES["imagefile"]["type"] == "image/png")) { copy ($_FILES['imagefile']['tmp_name'], "/home/scrpgco/public_html/images/profiles/".$_FILES['imagefile']['name'] = md5($_FILES['imagefile']['name'] . rand()) . $_FILES['imagefile']['name']) or die ("Could not copy"); $message = "Picture Uploaded!"; if($userinfo['profimage']!=""){ $location = $userinfo['profimage']; $file_delete = "/home/scrpgco/public_html/images/profiles/$location"; unlink($file_delete); updatedata($id,"profimage=''"); } updatedata($id,"profimage='{$_FILES['imagefile']['name']}'"); } else { $message = "Picture not uploaded, wrong filetype (".$_FILES['imagefile']['name'].")"; } } else { $message= "Picture not uploaded, picture dimensions are too big (".$_FILES['imagefile']['name'].")"; } } Can anyone shed any light as to why this might work in Mozilla but not IE? Thanks for any help
×
×
  • 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.