Jump to content

stewart715

Members
  • Posts

    58
  • Joined

  • Last visited

    Never

Everything posted by stewart715

  1. hmm i'm getting Resource ID #3 There is a uid with 7 and a received of 1 in the same row in the actual table..but idk why it isn't working [code] <?php $link = mysql_connect("localhost","thepdcom_popnew","PASSWORD"); mysql_select_db("thepdcom_popnew",$link); $query = mysql_query("SELECT buddy FROM buddylist WHERE uid = '7' and received = '1'") or die(mysql_error()); mysql_query($query); $result = mysql_num_rows($query); print $query; ?> [/code]
  2. okay say i have this data uid  bid    rid 2      5        0 5      7        1 7      8        1  8      7        0 7      2        0 4      3        1 7      4        1 I need a script that will print ALL the bid's where the uid is 7 and the rid is 1...how would i do that? the result from the above table should be 4 and 8, for example.
  3. I'm developing a privacy feature based on the following: The person selects either private mode or public mode..if they select private mode, the value of 1 is inserted into a table.  if they select public mode..the value of 2 is inserted (along with their UID)..that part i already did this is what im having trouble figuring out doing.. then i want the profile page to select that table based on that persons UID to see whether they chose 1 or 2..if they chose 2..they can show the profile because its public mode but if they chose 1 i want the profile to check a 'buddylist' table to see if the person viewing has their user ID in the column 'buddy' next to the persons profile which their trying to viewings 'UID' (in the same row of course) Example.. buddy Mike has a UID of 2..buddy Joe has a UID of 4 Mike pics privacy so the table privac mode has UID  privacyid 2        1 Joe's trying to view mikes profile so since mike picked 1 the page checks buddy list for: UID  buddy 2        4 if it's not there..then it wont show how...
  4. :( it runs but no data is recorded :( i've talked to so many programmers...this seems so easy..why cna't i get it to work....this is the actualy code: [code]<?php include("global.inc.php"); $errors=0; $error="The following errors occured while processing your form input.<ul>"; pt_register('POST','Selectprivacymode'); pt_register('POST','Useridnumber'); if($errors==1) echo $error; else{ $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/")); $message="Selectprivacymode: ".$Selectprivacymode." Useridnumber: ".$Useridnumber." "; $link = mysql_connect("localhost","thepdcom_popnew","PASSWORD"); mysql_select_db("thepdcom_popnew",$link); $query = "SELECT uid FROM privacymode WHERE uid = '$Useridnumber'"; if ($result = mysql_query($query))   if (mysql_num_rows($result) > 0) {     $query = "UPDATE privacymode SET privacyid = '$Selectprivacymode' WHERE uid = '$Useridnumber'";     if (mysql_query($query)) {       echo "uid updated"; }   else {     $query="INSERT into privacymode (privacyid,uid) values ('$Selectprivacymode','$Useridnumber')";     if (mysql_query($query)) {       echo "uid added";   } }     } header("Refresh: 0;url=http://url.com"); } ?>[/code]
  5. Hmm thanks..i added that above the original $query..but all that does is prevent a duplicate entry in the database..so if i chose 2 as a pid and then 1 as a pid..i cant have that again..but i can still have duplicate usernames.. example: mysql table UID    PID 1        2 1        1 it wont write 1  2 or  1  1 again..but i want it to just update the PID
  6. As long as the text file isn't in the world readable folder, I guess it's fine.
  7. I have a form that when submitted, the below happens. However, If there is already a User ID Number (UID) in the database (say the user decides to update their profile), I would like it to update the Privacy ID (PID) instead of inserting a new row with the same UID but the new PID. What would I put to update it but if a UID doesn't exist, to create it? Thanks in advance, this would be a major major help. [code] $link = mysql_connect("localhost","DATABASENAME","DATABASEPASSWORD"); mysql_select_db("TABLENAME",$link); $query="INSERT into TABLENAME (PID,UID) values ('".$PID."','".$UID."')"; mysql_query($query);[/code]
×
×
  • 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.