Jump to content

tcollie

Members
  • Posts

    45
  • Joined

  • Last visited

    Never

Everything posted by tcollie

  1. about the error...the error isnt on the confi.php...because I can connect to the database etc.... the problem is in the script that updates the table on the database...I suppose.... ??? //// You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET comentario='' WHERE id='0'' at line 1 Is there actually a record with the ID '0' since you're trying to UPDATE a record and not INSERT a record?
  2. Silly question here, but in the returned message that you get, it shows: [mobile number]@vtext.com as the recipient. Shouldn't you actually put the number in place of [mobile number]??
  3. Maybe because vtext.com is down? I keep getting a server not found error when I try and access it. Might be part of the problem? But I dunno.
  4. Actually, believe it or not, you don't have to group. After more fidgeting with the code, and kicking my dog (i love my computer more than the dog) this finally fixed it: SELECT DISTINCT l.locked_case_id as locked_case_id, l.uid, u.username as username FROM la_comments l LEFT JOIN users u on l.uid = u.uid where l.status = 1 BTW, I didn't really kick my dog. Thanks for everyone's help on this.
  5. yep. no luck by removing DISTINCT. I use the following SQL to get the actual count of DISTINCT updated records select distinct locked_case_id from la_comments where status = 1 and it works well. I just can't figure out how to join it on my users table to get their username.
  6. I'm using the supplied PHP IPN from the PDN and it's unaltered except for my database update scripts to update my users, so just find this line: // send an email in any case echo "Verified"; mail($notify_email, "VERIFIED IPN", "$res\n $req\n $strQuery\n $struery\n $strQuery2"); Then add in your user update scripts. You will want to add a "custom" field to your actual form and then retrieve the value of your "custom" field in the IPN which will come through as $custom. I use the "custom" field to include the USER ID of my user.
  7. I'm having problems with a SELECT DISTINCT statement with an INNER JOIN. Here is the table structure for my tables: 'locked_accounts' locked_account_id uid 'la_comments' comment_id locked_case_id uid status 'user' uid username And here is my SQL: SELECT DISTINCT l.locked_case_id as locked_case_id, l.uid, u.uid as uid, u.username as username FROM la_comments l LEFT JOIN users u ON l.uid = u.uid where status = 1 What I'm trying to accomplish is getting a display of updated accounts (where status=1) and I want to display their username. In the la_comments table, there might be 50 distinct 'uid's, but I only want to display the distinct uid/username's where the status = 1. Can someone point me in the right direction on this. I've messed with this for a couple of hours and I'm at wits end. Not very bright I am when JOIN statements it comes to.
  8. thanks for the help teng. Apparently I've been slamming my head on my desk over nothing. Always have to make a big deal out of everything. Thanks again for your help.
  9. Basically what I want to do is this. I have table with about 20 fields in it. I want to be able to dynamically pull the data for a certain record and create an array with the keys as the fields names and of course the data as the value. Here's what I have so far (and it's not working ): function get_data($record_id) { $query = mysql_query("SELECT * FROM table where record_id = '$record_id'") or die(mysql_error()); while($row = mysql_fetch_array($query )) { foreach ($row as $key => $value) { $data .= "&$key=$value"; } } return $data; } Now I want to be able to call the function and work with the data I'm trying to call. $record_id = 'xxxxxxxxx'; $test = get_data($record_id); $name = $test['username']; //This would be the username field from the table echo $name; All I get is a blank screen when I run this and I know the problem is in the foreach statement I tried to write. Any suggestions here? Thanks in advance.
  10. The problem is this. When using heredoc strings you can't have a line indention before your closing tag. So this example does work. <?php $test = 1; if($test == 1){ echo <<<END Monkey has brains END; }else{ echo "monkey has no brain!"; } ?> If you'll notice the closing tag END; has no space before it. It you add spaces, or any other information in front of it, it won't work. Hope that helps you out some.
  11. or do what i do, simply run a cron job every 5 minutes (or however long you want the interval to be) to delete records from your "online" table where the last_active time is greater than X minutes from the current time. Here's how mine works. My cron job runs every five minutes. If there are any records where the last active time is greater than the current time - 10 minutes, then I delete them from the "online" table. That help any?
  12. Sounds like you want to "automate" the process when the buyer updates the status to received, the payment (less fee) is automatically sent. I haven't really used my PayPal account in a while, but I'm pretty sure then answer will be no. I don't think you can automate PayPal, or any other payment gateway to send automatic payments to another user of their service, but I could be wrong. Of course, if you want to send the payments yourself, then this is completely workable. You simply set up your system to notify you, or person authorized to act on your behalf, when the Buyer updates the status to "received" and then you simply pay the seller the amount (less fees) received from the buyer.
  13. I have the following code for finding exact matches for records in my users table containing the same ip address. SELECT * FROM users WHERE ipaddress IN (SELECT ipaddress FROM users GROUP BY ipaddress HAVING COUNT(*) > 1) This returns a listing of user accounts with the EXACT SAME ip address registered. What I want to also be able to find is records with similar IP addresses. For an example, 127.0.0.1 127.0.0.15 would be returned as similar matches. I currently only want to ensure that the first 3 parts (127.0.0.*) are exact matches and the fourth part of the ip is the wildcard. Can somebody help me out with this or point me in the right direction.
  14. You need to add ob_start(); at the beginning of your code.
  15. I think what Andy is saying is this. <?php // mysql connection above $sql = "SELECT id FROM table_name"; $query = mysql_query($sql); $num = mysql_num_rows($query); if ($num > 50) { print "Sorry too many entries have been made in a short time, please try again later."; }else { // display form } ?> Where he has //display form above, that's where you actually put your form code. Just don't put your form code in there so they can't add their software. At least I think that's what Andy was getting at, but I might be wrong.
  16. <? $query="DELETE FROM `$dbtable` WHERE `$dbtable`.`unit_id` = $unitNum LIMIT 1;"; $result=mysql_query($query, $link) or die("Unable to delete"); //close link mysql_close($link) or die("Unable to close database"); //Redirect Here header( 'Location: comands.php'); ob_end_flush(); //I use this to prevent header/output issues ?> A refresh could cause problems with adding records again. Just put your header re-direct after you close your db connection. Same as in the example above.
  17. If you are deleting a record based on a unique id, such as 'record_id' then you won't have to worry about a refresh deleting another record. DELETE FROM tbl WHERE record_id = 123 Will only delete the row that has the record_id of 123. A refresh can't cause record_id 123 to be deleted twice.
  18. b/c when you're working on your own server (dev machine) that isn't actually an online server, it will show that as your IP. That's your localhost IP on your computer. If you upload your script to an actual web server, it will show your IP in the same manner as you see on here.
  19. I just glanced at your post, but I'm guessing that when you run the code $_SERVER['REMOTE_ADDR']; it shows your IP address as 127.0.0.1. Am I correct? or 192.168.10.1 or something like that?
  20. Shouldn't session_start(); be on each page that the session variables will be called on? Do you have it included on page_2?
  21. YOU CAN! Just check to make sure that the referring page is from a page within your site. If it is entered directly into the address bar, then re-direct them to an error page. I use this technique in my online game that I'm building to keep people from typing in info and taking certain shortcuts. So for instance, let's say that your script.php file is linked to from your index page and other links within your site. If they click any link on your page, it sets a referring page that you can get using a php script and compare the referring link to your site base (i.e., mysite.com). If the referring page isn't from your site, redirect to an error page. If the referring page is from your site, then let them continue. Does that make any sense? Here is the part of my code that does this. $root = 'localhost'; $webserver = apache_request_headers(); if (!eregi($root, $webserver['Referer'])) { //Re-direct header('Location: forbidden.php'); } else { //Allow entry to site } One thing to remember though is this. Only include this on pages where you don't want people to access via direct links, such as bookmarks.
  22. Okay so why don't you just set a session variable called 'last_login' with the login time/date from the database when you validate their password BEFORE updating your record to reflect the current login time. if( strcmp( $ValidPassword[1], $txtPassword) == 0 ) { $complete = 1; $userid = $txtUserID; //Get Last Login Time From DB Here //Set Session Variable 'last_login' here //Then Continue On With Database Update To Reflect Current Login Time session_register('userid'); $HTTP_SESSION_VARS['userid'] = $userid; $sql="UPDATE customer SET Last_active=NOW() WHERE Cust_id='$userid'"; $result=mysql_query($sql);
  23. Just add another field to your db called last_login and when they login, take the current login time field and set it as the last login time and then set the current login time field. Does that make sense?
  24. tcollie

    Rand()

    Or if you want a random number between x and y, where x is starting number and y is ending number: $number = rand(1,50); In this example x=1 and y=50. This will generate a random number between 1 & 50.
×
×
  • 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.