Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. you did this bit yeah? Can we see the code from the other page (facebook.php or index.php). And personaly, I would need a map and compass to follow what's going on in that tutorial...
  2. not exactly. you would need to use two queries: $qry1 = "SELECT username FROM loggedin WHERE username = '".$myusername"'"; $check = mysql_query($qry1); if (mysql_num_rows($check) < 1){ $qry2 = "INSERT INTO loggedin SET username = '".$myusername."'"; mysql_query($qry2) } something like that should do, not tested it though. To show the list of logged in users you would use another SELECT query, that would be run each time the page loads: $qlist = "SELECT DISTINCT username FROM logedin"; $rlist = mysql_query($qlist); while ($row = mysql_fetch_assoc($rlist)){ echo $row['username'].' | '; } again, untested. This is just the bare minimum of what you would need, there is no error checking or catching here so you should look to expand on this.
  3. what exactly is the problem? where is $like_status being assigned? what do you get if you echo $like_status just before the if? is that what it is supposed to be? Help us to help you
  4. Clutching at straws here, but have you tried changing the date selection to , DATE(`date`) AS `Date`,
  5. When declaring the contents of an array, you do not use the [] to surround the identifiers.
  6. What arn't you getting? $percent reffers to your $b for a numeric example $qry = UPDATE mem SET balance = ( balance + (balance * (1.5 / 100)) ) WHERE balance = 1000.00 Do please remeber the WHERE or you will update every balance to the same value (never handy).
  7. Do you mean that you want PHP to pull the MP3 tag info from the files, or just the names? although that's not really relevent, someone here will explain the process of setting the file size limit for upload in short order, I just have never used PHP for rile management before, so can't comment.
  8. INSERT IGNORE does not do what you want. What you need to do is query the table first to see if the name exists, then run the insert if it does not. INSERT IGNORE just suppresses error breaks during the query. To answer your second question, you will need to let us know what method you have of recording which users are logged in and which are not.
  9. It might be getting upset because date is a reserved word, try putting backticks around date and see how it gets on. And, am I the only one who has found that UNION can be a tempremental bugger at the best of times?
  10. It would make more sense to have a seperate settings table with individual fields for all the variables that joins with the user table, rather than having a single text field for storing every variable for that user. Setting default values within the database for the variables would have a standard "template" produced for every new user with the ability to update and change after user creation. I just think it makes things much easier to manage in the long term.
  11. Well as a week is a period of seven days, and a date is a single day, your looking at a serrious struggle making this run for over a year (unless the day of the week that your date reffers to is irrelivent). as it stands, you could calculate the week as a date by taking the substing after the - (in this case 05) and then multiplying it by 365.25 and dividing the result of that by 52. take that value and add it to the integer value gained by converting from, date to integer, the 1st of january for the substring before the - (in this case 2011). now take the result of that addition and convert it back to a date. ( I think you should get 5th Feb 2011). This however works within certain constants, so there is probably a better way of doing things.
  12. $find_friends = mysql_query("SELECT friend_1, friend_2 FROM friends WHERE (friend_1='".$id."' OR friend_2='".$id."') AND (friend_1<>'".$my_id."' OR friend_2 <>'".$my_id."')"); Not sure why your ID fields arn't numerical but I think that should get you going. $my_id will need to be assigned to the current user ID.
  13. If you are only looking to return a single data row per contdition, you should be using INNER JOIN. Could you show some sample data from each table for us please?
  14. Easiest way would be to fix your FRIENDS table to include a pending field. This would let you set Pending, Accepted, Refused/Ignored as values and filter accordingly.
  15. any reason you are using functions for other things and not using one for your bad word checking?
  16. Could you post the top 20 - 25 lines of each of the other two pages and your form statement please?
  17. echo 'Value of POST id = '.$_POST['id'].'<br>';
  18. I never knew that, I thought that it was a 0/1 bit flag. Thanks for that PFM. Oh, and miko - I missed you
  19. there's too many jumps here: load it = it's not working |--> copy content from createProduct.php to test.php, without changing page code or connection.php code = test.php working |-->decide connection.php is the problem, even though it works fine on two other different pages = Illogical how about filling in the blanks?
  20. could you post your form code please? this sounds like a name mis-match.
  21. right, I think we have been looking at this all wrong. your insert statement has no quotes around any of the values, so the database is looking for everything to be a number. every input that is not going to an integer needs to be wraped in single quotes.
  22. When you return multiple values from a function, they have to come out in an array. So you should be able to assign them using the array identifier for each. try $output = pageInfo(); print_r($output); Best I got just now, your well out of my comfort zone with that one.
  23. you shouldn't really use echo to display the contents of an array, change echo (empty($arende[$x])) ? "Saknas..." : $arende[$x]; to print_r($arende); for each of them and let us see what you get back. and no, it's not how it is done . If your id field is an auto inc' field then don't touch it with any insert statement at all, you don't need to. The table will fill it in on it's own, and databases can get upset when you start sticking your oar into their pond.
  24. You could also tryusing an if : $tim=time(); $timer=time()+100; $del = mysql_query("delete from test where time < $tim "); $act = mysql_num_rows($del); if ($act != 0 ){mysql_query("update test set time=$timer where status='Waiting');} Not something I have tested, but should work I think.
  25. And please explain why you are inserting a NULL value into the id field of the table.
×
×
  • 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.