Jump to content

beennn

Members
  • Posts

    117
  • Joined

  • Last visited

Everything posted by beennn

  1. How can I check a row for a number and then based on the result, perform an insert if the number isn't found? I need to ensure only one of a particular number is found in the row.
  2. I've set up highscores for a game i'm working on, though im faced with an issue when two people get the same score. I want the player who achieved the score first to be at the top of the leader boards. Does anyone have any suggestions on how I can achieve this? Any help or pointers would be great, and sorry if this isn't the correct place to be asking.
  3. How can I stop the padding on a div from stacking? By this I mean, I have several of the same div next to one another with a padding of 30px, as the divs are placed next to each other, this gives a gap of 60px between them, and only a gap of 30px between other elements. How can I make sure only 30px is on each side and stop there padding from stacking?
  4. I'm having some trouble putting a php array into a javascript array, here's what I have: <?php $table = array(); while($d = mysql_fetch_array($sDP)) {$table[] = $d; } ?> <script Language="JavaScript"> var description = new Array; <?php for($i=0; $i < 7; $i++) { echo "description[$i]='".$table[$i]."';\n";} ?> for(i = 0; i < 7; i++){ document.write(description[i]) } </SCRIPT> However document.write gives out "Array", though I'm not sure where it's coming from. I know it's not coming from my database, so there must be something wrong with the way I'm assigning the array?
  5. Aha! Thank you very much, it was
  6. $Email is just letters, no symbols. It's not actually an email address, for testing, $Email's value is "Test" in the database. It only just crossed my mind to try it with "Test" instead of $Email, which does work. I know $Email is holding "Test", so is "SELECT * FROM $Email" the wrong way to write it?
  7. At the top of my file I have: session_start();$Email = $_SESSION['email_address']; mysql_connect ("localhost","root" ,"####") or die ('error: ' . mysql_error()); mysql_select_db ("accounts"); $selectProject = mysql_query("SELECT * FROM $Email") or die(mysql_error()); while($row = mysql_fetch_array($selectProject)) { $Name = $row ['Name']; } Further down the file I'm trying to echo $Name, but nothings appearing, and I'm not getting any errors <?php echo ($Name); ?> Any idea where I'm going wrong?
  8. Oh ok, thank you both. I would have posted but im not using html for posting lol. In the process of setting up a login checker inside of unity. Wanted to know where I was going wrong, looks like i've gone wrong in unity. Thanks for the help
  9. Oh ok, so the scripts fine just there cant be a difference between method of posting? The alternative to $_POST['username']; would be $_POST["username"]; ?
  10. Could use a hand finding what i've done wrong in this script Script: <?phpmysql_connect('####', '####', '####') or die('Could not connect: ' . mysql_error());mysql_select_db('####') or die('Could not select database'); $username = $_POST['username'];$password = $_POST['password'];$sql="SELECT * FROM 'accounts' WHERE username='$username' and password='$password'";$result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ echo "Login successful"; } else { echo "Login failed"; }?> Error: ( ! ) Notice: Undefined index: username in C:\wamp\www\_#\display.php on line 5Call Stack# Time Memory Function Location1 0.0003 676216 {main}( ) ..\display.php:0( ! ) Notice: Undefined index: password in C:\wamp\www\_#\display.php on line 6Call Stack# Time Memory Function Location1 0.0003 676216 {main}( ) ..\display.php:0( ! ) Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\_#\display.php on line 11Call Stack# Time Memory Function Location1 0.0003 676216 {main}( ) ..\display.php:02 0.0116 683696 mysql_num_rows ( ) ..\display.php:11Login failed
  11. Here's what I have: $target = "images/profile_pictures/";$target = $target . basename( $_FILES['fileBrowser']['name']);$pic=($_FILES['fileBrowser']);mysql_query("UPDATE `user_accounts` SET profile_picture=$pic WHERE email =$Email") ; if(move_uploaded_file($_FILES['fileBrowser']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['fileBrowser']). " has been uploaded, and your information has been added to the directory"; } else { echo "Sorry, there was a problem uploading your file."; } However I get errors at: $target = $target . basename( $_FILES['fileBrowser']['name']); $pic=($_FILES['fileBrowser']); if(move_uploaded_file($_FILES['fileBrowser']['tmp_name'], $target)) I found out how to do this originally at: http://php.about.com/od/phpwithmysql/ss/Upload_file_sql.htm If someone could give me a hint at what's wrong, id be greatful
  12. How do sites like facebook retrieve your friends from your mailing services? Do they have permission from the service provider to access there databases or is there another way of obtaining them? If someone could explain how this works id really appreciate it
  13. Thank you! no idea how I missed that.
  14. <html><head><script language="javascript">function getFilePathFromDialog() { document.getElementById('fileBrowser').click(); document.getElementById('filePath').value = document.getElementById('fileBrowser').value;}</script></head><body><img src="../../../wamp/www/images/browse_button.png" onlick="getFilePathFromDialog();"><input type="text" id="filePath" name="filePath" /><br /><input type="file" id="fileBrowser" name="fileBrowser" style="visibility:hidden; display:none;" /></body></html>
  15. still clueless I've found this using javascript: http://stackoverflow.com/questions/1377888/choose-file-box-by-clicking-on-image-not-with-browse-button doesn't seem to work though, or I'm doing something wrong by the looks of the likes
  16. I've been looking about and cant seem to find how to have an image as a file uploader instead of the default choose file button <input type="file" /> any help would be great
×
×
  • Create New...