Jump to content

Snooble

Members
  • Posts

    311
  • Joined

  • Last visited

    Never

Everything posted by Snooble

  1. Wicked, Thanks i'll have a look. I define the $list in an include up the page. I'll have a look. Thank you Snooble
  2. <?php $_SESSION['point'] = "".rand(0, 10).".".rand(0, 9)."".rand(0, 9).""; echo $_SESSION['point']; $result = $list['point'] + $_SESSION['point']; $sql = "UPDATE `wmusers` SET `point` = '$result' WHERE 'username' = '$list['username']' LIMIT 1" ; mysql_query($sql) or die ("Couldn't execute $sql: " . mysql_error()); ?> i get a parse error. It's almost definatly in this line: $result = $list['point'] + $_SESSION['point']; As i've no idea how to add the two numbers. lol Thanks, Snooble
  3. lol duh... i didn't have start session at the top, it still gave me a parse, used your code and all works. Thanks, Seem like an expert to me! Keep up the good work! Thanks Snooble
  4. blank page.. parse yes thanks, but i can do that. Just need to set the number to a variable and echo it out. Thanks Snooble
  5. <?php $_SESSION['point'] = rand(0, 10).".". rand(0, 9) rand(0, 9); echo $_SESSION['point']; ?> I want to set a variable (SESSION OR NOT) to a random number. The number needs to be 2 dec places. so i've used 3 random numbers. ????? how can i get it to work? The idea is to add the amount to a mysql cell (easy enough i believe) and then echo the cell out. number should look like this : *.** in the sql table. so: 3.91 or 1.27 etc. Thanks, Snooble
  6. i see, thank you! Very useful for me
  7. an example?? I assume, record the result before the sql and then after and if it's different then say successful else say "no song"? Snooble
  8. <?php $sql = "SELECT * FROM songs WHERE Title = '".$_POST['songtitledelete']."' LIMIT 1"; mysql_query($sql) or die ("Couldn't execute $sql: " . mysql_error()); if (mysql_query($sql) == NULL){ echo "No such song"; } else { $sql2 = "DELETE FROM songs WHERE Title = '".$_POST['songtitledelete']."' LIMIT 1"; mysql_query($sql2) or die ("Couldn't execute $sql: " . mysql_error()); } ?> That should make sense? I want to check if the song is there. Otherwise it always says "Song Deleted". I want something to detect whether it's there before deleting the row. When i run it now i dont see "No such song" when i enter an invalid song name.. Thanks Snooble
  9. used that and explode. Thanks Snooble
  10. you need to set session variables etc. If you have a log in system then just use the session to stop pages being shown to users without them firstly logging in. just read about sessions. http://us3.php.net/manual/en/features.sessions.php
  11. echo substr_replace($list['email'], strlen($list['email']), 0, - 0); Is my code... I want it to show 8 characters and then "..." any help? Snooble
  12. wicked, read the function page before seeing the example. Thanks for both! All done now, easy enough. Will have to remember that, banks use that method for verification. Snooble
  13. Man, everyone's mental i swear. Steviez look up the GET command. It's very simple, Like you do with POST you enter the form fields name within parenthesis. $_GET['step']; would print what was entered in the field "step". For hyperlinking you wouldn't use this method. Snooble
  14. Hello people, I'm echoing out table cell kept in an array using: $list['email'] It echos the user's email address. But if i had an email address that was: [email protected] it would strech the table. I want to limit the amount of charactors. put ...'s inbetween Limit the output to 10 charactors. Any help? Thanks Snooble
  15. I see, thanks for that redarrow. I didn't know which was faster. First table i wrote is the one i still use. cause i would echo out the variable I'll have a read up on mysql_num_rows() as i've never used it. Thanks! Snooble @ Chris. I'm sure you'll reflect on that statement. As you'll need to link some functions to get what you want sometimes. It helps to know how they work.
  16. I think it's better using a varialbe that you ++. Example: <?php $count = 0; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) //echo table and results $count++; ?> <?php if ($count < 1) { echo "<br><br>No rows were found in this table"; } ?> Snooble
  17. s'what i did, thanks
  18. rookie alert. Apologies, Thank you very much. Snooble
  19. <?php if(($_SESSION['username']) == "Snooble"){ echo "Hello Admin<br><a href="upload.php">Click Here To Upload Songs</a>"; } ?> Man i'm getting fed up with this stuff lol. any help here? Snooble, get parse error (blank page)
  20. I absolutely love you. Thank you so much! I'll have to read this code again and again because it's all this bloody $col => $col_value stuff. key and value if i'm right but i have no idea, i'll have a manual read. THANK YOU!!!!! Genius Snooble
  21. lol <?php $path = "./uploads"; $dir_handle = @opendir($path) or die("Unable to open $path"); while ($file = readdir($dir_handle)) { if($file == "." || $file == ".." || $file == "index.php" ) { continue; echo "<ul><li><a href=uploads/$file>$file</a></li></ul>"; } } // Close closedir($dir_handle); ?> Maybe?
  22. You say: If there is NO $_SESSION['access'] make it 3. So it will display 3 if you are not logged in before running this test. Snooble To clarify: <?php session_start(); echo 'before: ' . $_SESSION['access'] . '<br>'; session_destroy(); echo 'after: ' . $_SESSION['access'] . '<br>'; Try that and then you'll see. Make sure you're logged in when running the script. Snooble
  23. while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>\n"; } $count++; echo "\t</tr>\n"; } echo "</table>\n"; This code works fine. But i have two fields in the table that i want to display differently. I want everything from the fields Download and Mirror to be displayed within a <a href='INFOFROMDB'>Download here</a> manner. Any help. Getting real stuck on this. As my code loops a chunk of data. i need to break it up but keep it in a loop. Thank you, Snooble
  24. Because i'm nice: Look at the mktime() part! http://us2.php.net/manual/en/function.mktime.php Sorry my fault thought i gave you the link. :S Read read read Snooble
  25. Brilliant!!! It's so much easier when i see it with a little function. I will implement it when i get back tomorrow. Thanks alot!!!! I'll clean up the headers and table as i have a layout that's fine at the moment. But it's the "$row['size']" part thats going to come in handy! As i didn't know how to split the results. Just a quick question. When you put "size" in the parenthesis. Is that where i place the Fieldname according to the Table? lol I assume so. Just don't want to mess things around too much! Snooble (Thanks again)
×
×
  • 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.