Jump to content

darga333

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Everything posted by darga333

  1. Hey Barand, do you know of a way with the older version of mysql? I am going to upgrade mysql but at a later date. I did several searches online and tried to come up with a solution before replying back to this topic. I have another question also. It said that i was tryign to do was a multiple table update when infact I am just updating 1 table. Maybe you might know why that is?
  2. This is what the screen says: Welcome to phpMyAdmin 2.5.6 MySQL 3.23.56
  3. it still gives me the same error I dont understand what I could be doing wrong I have it set up exactly how you are saying UPDATE members,discount SET members.sImagePath=discount.sImagePath WHERE members.user_id = discount.iMemberId i am trying to set members.sImagePath = discount.sImagePath ... could it possibly be because I set members.sImagePath as null when i created the column?
  4. Hey for some reason it is giving me the following error: #1064 - You have an error in your SQL syntax near ' discount SET members.sImagePath = 'discount.sImagePath' WHERE memb' at line 1 UPDATE members,discount SET members.sImagePath='discount.sImagePath' WHERE members.user_id = discount.iMemberId does anyone know what i am doing wrong?
  5. Hi I am trying to set t1.sImagePath=t2.sImagePath and it is not working for some reason This code selects what I need [code]SELECT t1.sImagePath,t2.sImagePath FROM members t1, discount t2 WHERE t1.bBusiness = 1 AND t1.user_id = t2.iMemberId AND t2.sActive = 1 GROUP BY t1.user_id[/code] does anyone know how to do that?
  6. for instance.. you have a file name that has an & in it and you try downloading it you cant find the file cause it stops at getWebsiteUp, it cant seem to get the & because the address bar processes &'s differnetly filedownnload.php?action=download&filename=getWebsiteUp&ampRunning.doc
  7. I apologize for that but I am looking for a solution without Inner Joins and List variables. But thanks for your earlier response, it was much appreciated. Just a bit too confusing for me
  8. can you narrow down your problem to just a few lines of code?
  9. I am having a problem displaying the result of my sql statement in groups. It needs to spit out the first category, then the first business name in that category, then all of the Headlines for that business... then it needs to just loop and do it again for each business in that same category.. and then it needs to move to the next category and repeat the process. I am only using 1 SQL statement that is relatively simple [code]$sql_1  = "SELECT t1.sHeadlines,t2.sName,t3.sBusinessname FROM ucfdiscount t1,ucfdiscountcategory t2,ucfmembers t3 WHERE t3.user_id = t1.iMemberId AND t1.iDisCategoryId = t2.idiscategoryid ORDER BY t2.sName, t3.sBusinessname, t1.sHeadlines ASC"; $result_1 = mysql_query($sql_1); $row_1 = mysql_fetch_array($result_1); $num33 = mysql_num_rows($result_1); if ($num33 > 0)  {                $message =  $row_1['sName'];           $message.=  $row_1['sBusinessname'];           $message.=  $row_1['sHeadlines']; }[/code] I know I am missing the if statements inside the bracket that will allow me to do this. Will someone please help me figure this out. The logic is: For each Category display category For each Business Name display business name For each Headline Display headline Do i just need 3 different for each statements? Thank you so much for helping me figure this out!
  10. yeah how it works is a "Print" link will be displayed.. that print link will make the print.php page pop up it will pass a variable print = 1 then i will run the SQL statement and update the database then it will pop up the print dialog box and then it will immediately close the window.. The question: Once the print dialog box pops up does it automatically know to print what was on the page that the Print button was on (print.php) even if i close the window before the person clicks to actually print the document?? or do you have to have the window open, and then the person prints it and only after it is printed, then you can close the window? I need to make sure that the person is actually going to print what was on the print.php page.
  11. would I close the window as soon as the print dialog pops up? the part about this whole thing that i dont understand is that the print button has to be attached to an onClick but in that onclick it is ganna be javascript.. how can i go from javascript to php to update the database? bcause javascript is client side and php is server side.. so when they click print do i have to have it submit to the same page first, then inside of the code... if it has been submitted, then do the php first.. and then call the javascript to popup the print window and close the window in that order?
  12. How do you make the window close immediately after you click "Print" but still allow it to print the page that the "Print" button was on and also allow it to update the database with print = 1. The order of operations would be: 1. Click Print 2. Run SQL Query $sql = "UPDATE print SET print=1 WHERE user_id='$user_id'"; $result = mysql_query($sql); 3. Print Dialog Pop Up 4. Immediately close window Does anyone know how to do this?
  13. I am not a fan of large code posts. I apologize for that. I understand the main thing we need to look at here are the two loops.
  14. [!--quoteo(post=372172:date=May 7 2006, 10:42 PM:name=shams)--][div class=\'quotetop\']QUOTE(shams @ May 7 2006, 10:42 PM) [snapback]372172[/snapback][/div][div class=\'quotemain\'][!--quotec--] hi, these are php codes to update the mysql enteries, when i run them the final updated.php message is "Welcome Done" but when i check the mysql table home it is not updated, this is the /var/log/httpd/error_log message: this is the update.php: [code] <html> <body> <?php $id = $_POST['id']; $name = $_POST['name']; mysql_connect("localhost", "root") or die(mysql_error()); mysql_select_db("mydb") or die(mysql_error()); $query = "SELECT * FROM home WHERE id='$id' or name='$name'"; $result = mysql_query($query); $num = mysql_numrows($result); $i=0; while ($i < $num) { $id = mysql_result($result,$i,"id"); $name = mysql_result($result,$i,"name"); $address = mysql_result($result,$i,"address"); ?> [/code] [!--html--][div class=\'htmltop\']HTML[/div][div class=\'htmlmain\'][!--html1--]<[color=blue]form action[/color]="[color=orange]updated.php[/color]" method="[color=orange]POST[/color]"> <[color=blue]input type[/color]="[color=orange]hidden[/color]" name="[color=orange]ud_id[/color]" value="[color=orange]<? echo $id; ?>[/color]"> Name: <[color=blue]input type[/color]="[color=orange]text[/color]" name="[color=orange]ud_name[/color]" value="[color=orange]<? echo $name; ?>[/color]"><[color=blue]br[/color]> Address: <[color=blue]input type[/color]="[color=orange]text[/color]" name="[color=orange]ud_address[/color]" value="[color=orange]<? echo $address; ?>[/color]"><[color=blue]br[/color]> <[color=blue]input type[/color]="[color=orange]submit[/color]" value="[color=orange]UPDATE[/color]"> <[color=blue]/form[/color]> <?php ++$i; } ?> <[color=blue]/body[/color]> <[color=blue]/html[/color]>[!--html2--][/div][!--html3--] and this is the updated.php: [code] <?php $id = $_POST['ud_id']; $name = $_POST['ud_name']; $address = $_POST['ud_address']; mysql_connect("localhost", "root") or die(mysql_error()); mysql_select_db("mydb") or die(mysql_error()); $query = "UPDATE home SET name='$ud_name', address='$ud_address' WHERE id='$ud_id'"; $rt = mysql_query($query); if($rt) { echo "Welcome Done";} else { echo "sorry";} ?> [/code] please any one can help? [/quote] change this $query = "UPDATE home SET name='$ud_name', address='$ud_address' WHERE id='$ud_id'"; to this $query = "UPDATE home SET name='$name', address='$address' WHERE id='$id'"; :) you can either do that or you can set the variables equal to the $_GET['ud_name'], $_GET['ud_address'], and $_GET['ud_id'] respectively
  15. I sincerely apologize but I tried to see how I could incorporate what you wrote but if I was to use that I would have to rewrite the entire script and it is very long. I want you to know that I did study the code that you wrote and I appreciate that you took the time to write that out. Hopefully it will help someone else that reads this post. As for the script I have. It is 100% complete, I just cant find out how to format it as follows: When I run it, it needs to display the following: It needs to print the first category name ASC,.. then it needs to loop through and display the first business name in that category ASC, then it needs to display all of the discounts for that business name... after it displays all the discounts for that business, then it needs to go through every business name and do the same thing for the rest of the businesses in that category. After it is finished going through all the business names in that category it needs to move on to the next category and do the same thing until it has went through every category it finds in the SQL statement. I have a 75 line script if you do not mind me posting it. Here is the code. [code]<?php $yesterday = "2006-05-06"; //Select all discounts in all categories for each discount that has been updated today $sql_1  = "SELECT *,ucfdiscountcategory.sName,ucfdiscount.sDescription FROM `ucfdiscount`,ucfdiscountcategory,ucfmembers WHERE ucfmembers.user_id = ucfdiscount.iMemberId AND ucfdiscount.sActive = 1 AND ucfdiscount.deleted != 1 AND ucfdiscount.last_update = '$yesterday' AND ucfdiscount.iDisCategoryId = ucfdiscountcategory.idiscategoryid ORDER BY ucfmembers.sBusinessname, ucfdiscountcategory.sName ASC"; $result_1 = mysql_query($sql_1); $num33 = mysql_num_rows($result_1); //If there is atleast one row send an email with all the discounts.         if ($num33 > 0)  {            $a = 1;     $discount_message = "";     while($row_1 = mysql_fetch_array($result_1))  {     $business_name     = stripslashes($row_1['sBusinessname']);     $user_id        = stripslashes($row_1['user_id']);     if (!isset($current_catid) || $current_catid != $row_1['iDisCategoryId'])  {         $current_catid = $row_1['iDisCategoryId'];         $discount_message .= "<hr>";         $discount_message .= "<h2>".stripslashes($row_1['sName'])."</h2>";     }     if (!isset($sBusinessname) || $sBusinessname != $row_1['sBusinessname'])  {         $sBusinessname = $row_1['sBusinessname'];         $discount_message .= "<br>";         $discount_message .= "<p><strong><font color='red'>                                 ".stripslashes($sBusinessname)."</font></strong><br>\n";                 }     $discount_message .= "<strong>".stripslashes($row_1['sHeadlines'])."</strong><br>\n";     $discount_message .= stripslashes($row_1['sDescription'])."<br>\n";     $discount_message .= stripslashes($row_1['sBusinessPhone'])."<br>\n";     $discount_message .= "<a href=\"viewcoupon.php?id=".$row_1['idiscountid']."\">                                                    View this coupon!</a><br /><br />";     $a++; }              //All people that have iNewDisc = 1 ((all people that have elected to receive an email))     $sql_0 = "SELECT t1.user_password,t1.username,t1.user_email,                                t1.user_id,t1.sFirstName,t1.sLastName, t2.imemberid,t2.iNewDisc                                FROM ucfnotifications t2,ucfmembers t1                                WHERE t2.iNewDisc=1 and t2.imemberid=t1.user_id AND t1.bBusiness = 0                                ORDER BY t1.user_id ASC";     $result_0 = mysql_query($sql_0);     while($row_0 = mysql_fetch_array($result_0)){     $user_id_member     = $row_0['user_id'];     $rep= stripslashes($row_0['sFirstName']);     $rep.= " ".stripslashes($row_0['sLastName']);     $username    = stripslashes($row_0['username']);     $pass        = stripslashes($row_0['user_password']);     $user_email = stripslashes($row_0['user_email']);     //Format the email     $message = file_get_contents("../templates/new_discounts.php");     $message = str_replace("%REP%",$rep,$message);     $message = str_replace("%USERNAME%",$username,$message);     $message = str_replace("%PASS%",$pass,$message);     $message = str_replace("%DISCOUNT_MESSAGE%",$discount_message,$message);                 echo $message;          // stuff for all emails     $subject           = "This is the subject!";       $from              = "support@testing.com";     $headers           = "From: $from\n";     $headers          .= "MIME-Version: 1.0\r\n";     $headers          .= "Content-type: text/html; charset=iso-8859-1\r\n";          //Mail the members (I have this commented out so it doesnt email members while testing)     //mail("$user_email","$subject","$message","$headers") or die('Could not send mail!');     //Store a value in the database so we know who we have sent mail to         $sql_3 = " INSERT INTO `tmp_mail_count` VALUES ('$user_id_member') ";     $result_3 = mysql_query($sql_3);              } echo "<h1>You are finished!</h1>"; }else{ echo "No new discounts exist for today"; } ?>[/code] You will notice the SQL statements are pretty in depth thats because there is a lot of info i need to provide.. i cleared out about 100 lines of code to make it easier to post on here.
  16. hi there! I have an indepth script that needs to display categories, and then it needs to loop through the database and display all the businesses for that category, but then while it is on that business name it needs to display all the items for that business name, then once there are no more business names for that category, it needs to move to the next category and do the same thing until it displays every category. We would make sure that the category name is only displayed once, and that the business name is only displayed once for instance... you have categories: food, auto, retail This is what you want to display Food McDonalds Big Mac Fries Shake Checkers Fries Spicy Chicken Sandwhich Soft drink Auto Midas Brakes Transmission Mobil Oil Changes Rodars Tires Transmission Retail Walmart Electronics Food Clothes Garden Supplies Thank you so much for the help!!
  17. Hi I am trying to change a file path from one folder to another folder. the main directory called mail_system then there are two folders in the mail_system directory one folder is called parser and the other is called templates The script that runs this file is located in mail_system/parser but the below line needs to get file contents from mail_system/templates $message = file_get_contents("mailer_template.php"); how do you go about doing that? I know that you use ../ when you want to go down a directory.. but what if you want to go down a directory and then back up antoher directory? wow it sounds too easy but i just cant figure it out I figured it out.. I dont know how i couldnt figure it out before.. if there are some real real beginers out there all you do is put require('../templates/mailer_template.php');
  18. Hey Crayon! Actually the capability to verify would be great! but the problem relies in that a lot of businesses would not have the time to take away from their normal daily operations to quickly log in, and enter a coupon code just to make sure it is valid. It would be great if everyone had internet access. Your tracking code idea is probably the best way.. that and only allowing them to print it once. So we will let them have access to the link for 30 days but once they click it.. they no longer get access. Thanks for the great thread! Hopefully everyone learned something onthis topic! [!--quoteo(post=371335:date=May 4 2006, 02:30 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 4 2006, 02:30 PM) [snapback]371335[/snapback][/div][div class=\'quotemain\'][!--quotec--] does the business have the capability of going to your website to varify the coupon code on the spot? if so then they can check to see if it's a valid code before accepting it. you may not be able to stop them from printing the certificate more than once, but you can make the validation code unique so that it will only be accepted once. but like i said earlier, that doesn't prevent people from going through the trouble of re-registering on a proxy server to get a completely new certificate. all i can think of for you to do to COMPLETELY illiminate the problem is to just ditch the whole "online certificate printing" idea and send them the coupon by mail on some not easily tampered with paper. [/quote]
  19. haha so it looks like I am stuck with tracking codes, etc. perhaps the business will have a peice of paper with them and they can mark down which certificates are used, and we could put 1 of 100, 2 of 100, 3 of 100 and so on.. that way if they receive a duplicate, they can just not honor it but that doesnt prevent them from changin the code themselves... just save the webpage.. change 1 to 100, to 2 to 100 and change the name.. and then bring it in.. there has to be a better way to control this. A barcode would be cool but each business would have to have a barcode reader, and well that is impossible. Maybe we could just have the script disappear after the first time they click the print button. But then if they accidently click the print button without having their printer on, then they lose their prize. [!--quoteo(post=371179:date=May 4 2006, 04:39 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 4 2006, 04:39 AM) [snapback]371179[/snapback][/div][div class=\'quotemain\'][!--quotec--] hmm. well i will have to think more on that, just for the sake of finding out if it's possible in some other language, just cuz you got me interested in finding out, lol. but it's definately not possible with PHP. i'm leaning towards active x control but i also wanted to point out something that makes this whole idea rather moot: even if you do manage to keep the user from printing it more than once from the browser... all they need is a program that can do screen capture. Then they can capture the screen and crop it and print them out all day long. And that's a pretty damn easy thing for someone to do. It mostly just takes a small degree of ingenuity to think of that solution, and virtually no technical skill. I'm by no means the brightest crayon in the box, and it only took me what, 2 days to figure it out? And it's not like i've been spending the last 2 days really focusing on it 24/7....so i think most any other person would go there with the intentions of gettingn more copies, and upon multi-print disabled failure, would sit back and think about it and come up with it fairly quickly.. especially if they are motivated to do so cuz they were miffed that you somehow managed to disable their multi-print! and disabling 3rd party programs from the browser [i]is[/i] virtually impossible. You would have to make a program that the user would have to download and install, and the program would have to run everytime the user is logged into windows, and basically disable any image manipulation program(s) that are on the user's harddrive. And I'm sorry to say that a program like that would most likely be labeled as a trojan (read: illegal). [/quote]
  20. Thank you ober! I appologize for the other email. It is just a very frustrating topic to someone that is new to php. I would have no idea how to use a Pear engine or a Curl. but I guess it wouldnt help to look it up. Thanks again! [!--quoteo(post=371246:date=May 4 2006, 09:24 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 4 2006, 09:24 AM) [snapback]371246[/snapback][/div][div class=\'quotemain\'][!--quotec--] There are more powerful engines for sending mass emails. I suggest looking into something like the Pear engine or Curl. Using mail() with that many emails is going to bog down your server and will hang the script until the process completes. You could also consider doing batches of emails instead of doing them all at once. [/quote]
  21. I have a dual 2.4 gig w/ 1GB ram.. and for some reason whenever i run the mail() function it bogs everythign down and it is very very hard to run any other webpages while this is occuring. Has anyone else run into this problem, or do you know why it happens and what we can do to prevent it?
  22. hahahha I love what you wrote in the last paragraph!!!! haha ok here is the deal.. we have them login to have access to the prize. the prize is ofcourse only for those that win it.. currently we give them 30 days to print the certificate, then after that the link disapears.. we have a tracking type number inplimented into the coupon, and we have a extra image placed over the current image to make sure noone just saved the image file.. i was thinking we can disable javascript rightclick, but its pretty easy to get by that... just disable javascript on your computer.. but what can we do to make them just print the coupon once... is there any function that says look here i am only going to print this coupon once i dont care if you want to print 5, too damn bad! ... what do you think? possible? [!--quoteo(post=371151:date=May 4 2006, 12:43 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 4 2006, 12:43 AM) [snapback]371151[/snapback][/div][div class=\'quotemain\'][!--quotec--] well the only thing i can think of is to make them register and login before allowing them access to the page where they can print the certificate, and then only allow them to go to the page one time. Of course, this won't stop people from registering bogus accounts for extra coupons, but you can do several things to minimize it. you can do email validation in your registration script. the user must provide a valid email address so that the script can send them a validation code and they have to get the code to complete registration. And you can script it to where email addresses can only be registered once. This will make people HAVE to go through the the process of starting up a new email account they can access just so they can re-register. On top of that, you can log their IP address when they register, and script it to where they cannot register from the same IP address again. Then they would have to do something like go through a proxy server AND get a new email just to register and access the page for another free coupon, which sounds like an aweful lot of time and effort for most people, just to get a free pizza (cuz it's a lot easier just to call up the pizza place with a bogus complaint to get a free pizza :) ) not to mention the fact that average joe doesn't even know what a proxy server is. And then on top of that, you can build a unique tracking number that links the coupon to their account, and since (i'm assuming) that the other business will eventually return the coupon to you (if not, maybe you could implement it, or at least, have them report to you the tracking number), and put a big fat warning on the page and on the coupon about what kind of nasty actions you will take against the customer if you recieve duplicate tracking numbers. Again, this will not totally illiminate the problem, but it should very drastically reduce the problem. [/quote]
  23. is there a more efficient way to mail thousands of members than mail() ??? every time i want to email 5000 people it takes several minutes.. or better yet, is there a way to run the mail function in the background? so people can continue doing other stuff so they dont have to wait for the script to finish??? for instance.. when you submit a button.. it sends 6000 emails... well can we make it run in the background.. and then i can submit that button again.. and it will send 6000 more emails but something different ofcourse please help !! :) also i noticed that whenever you run the mail() function... it tends to bog down the entire server does anyone know anything about this and the best methods to send email?
×
×
  • 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.