Jump to content

TecTao

Members
  • Posts

    145
  • Joined

  • Last visited

Everything posted by TecTao

  1. Yes there are five other fields, three that are identifiers to the particular businesses. Two are categories of those businesses. These fields were added early on years ago but are not necessary to any applications. The consumer_mgmt table handles sending out various emails for different specials. So we are finding multiple emails going out to the same recipient that had been added multiple time. I just need to pare it down so that there is one customer email for one business. There is a field of the date of entry so if there were the need to identify which of the multiple emails should be removed, it could be the oldest. I see where you are going with this, how would the script decide which entry stays and which ones get deleted.
  2. I need Delete Duplicate Email Records That Are Attached To One Account But Can Be Found In Multiple Accounts I have a table, consumer_mgmt. It collects consumer information from various forms. These forms are available through different pages that are part of a business package. A business can offer these signups to gather names and emails from consumers for various types of specials they may offer. So a consumer my be in the consumer_mgmt table 5, 10, 15 times for that particular business. But, that consumer may be in the consumer_mgmt table multiple times for a different business. So multiple times for multiple businesses. I need to remove duplicates for each business account so the consumer is only the consumer_mgmt only once for each business. There are approximately 15,000 rows currently in the consumer_mgmt table. I'm not sure where to begin on the logic. Since there are multiple business accounts that the emails are attached to, would one have to build a case for each loop?
  3. Thanks CroNiX, I understand your explanation. I read up on your in scope link and see what you are talking about. I move the $todayRepost35 into the function. I'm not clear completely on you point about never calling your function. Is this specific to the echo of the results? As I work on building this, I wanted to see the row results to verify it is selection the correct rows. If it does, then I will add the specific commands using the variables from each row. From what I have read and illustration, I assume that these commands are outside the function, and will loop through each time from the query in the function until completed. An example is below <?php $unLink1 = "/home/zipclick/public_html/specialslocator.com/FAP_Images/$FAPforSale_IDnumber/$FAPforSale_image1"; //echo $unLink2; unlink($unLink1); $unLink2 = "/home/zipclick/public_html/specialslocator.com/FAP_Images/$FAPforSale_IDnumber/$FAPforSale_image2"; //echo $unLink2; unlink($unLink2); $unLink3 = "/home/zipclick/public_html/specialslocator.com/FAP_Images/$FAPforSale_IDnumber/$FAPforSale_image3"; //echo $unLink2; unlink($unLink3); $unLink4 = "/home/zipclick/public_html/specialslocator.com/FAP_Images/$FAPforSale_IDnumber/gick.php"; //echo $unLink2; unlink($unLink4); $dir = "/home/zipclick/public_html/specialslocator.com/FAP_Images/$FAPforSale_IDnumber"; rmdir($dir); mysql_query("DELETE FROM FAP_forSale WHERE FAPforSale_username = '$con_username' AND FAPforSale_IDnumber = '$FAPforSale_IDnumber' "); ?>
  4. I am writing a CRON job that will execute daily. First it will identify from a MySql table the date in a field 'FAPforSale_repost35' If the date is the today date it will then execute commands to delete photo images in a directory, delete the directory, and finally remove the record from the database. I am on step one which is to build the array of records that match the days date. When I run the code, there are no errors but I am not getting results even though the records in the test table are set for today. Below is the select <?php define( "DIR", "../zabp_employee_benefits_processor_filesSm/", true ); require( '../zipconfig.php' ); require( DIR . 'lib/db.class.php' ); require_once( $_SERVER['DOCUMENT_ROOT'] . '/_ZABP_merchants/configRecognition.php' ); require_once( $_SERVER['DOCUMENT_ROOT'] . '/_ZABP_merchants/libRecognition/MailClass.inc' ); $todayRepost35 = date("Y-m-d"); echo $todayRepost35; function repostEndSelect() { global $db; $this->db = $db; $data = $this->db->searchQuery( "SELECT `FAPforSale_IDnumber`, `FAPforSale_image1`, `FAPforSale_image2`, `FAPforSale_image3`, `FAPforSale_repost35` FROM `FAP_forSaleTest` Where `FAPforSale_repost35` = '$todayRepost35' "); $this->FAPforSale_IDnumber = $data[0]['FAPforSale_IDnumber']; $this->FAPforSale_image1 = $data[0]['FAPforSale_image1']; $this->FAPforSale_image2 = $data[0]['FAPforSale_image2']; $this->FAPforSale_image3 = $data[0]['FAPforSale_image3']; $this->FAPforSale_repost35 = $data[0]['FAPforSale_repost35']; echo $this->FAPforSale_IDnumber; echo $this->FAPforSale_image1; echo $this->FAPforSale_image2; echo $this->FAPforSale_image3; echo $this->FAPforSale_repost35; } // ends function... echo( ' Finished...' ); ?> Thanks in advance for any suggestions or direction. Chapter two will be when I start testing the commands to delete.
  5. Thank you Requinix. This clears up issues and much to think about.
  6. This is something I've been trying to figure out for some time. I've read blogs and other forums and am still not clear. Seems that when I pass a variable that has Apostrophe's in the variable, from a form page to the submit page and insert it into the MySql DB table, it inserts OK without any / before the apostrophe. On the other hand on the same submit page, there is a select query from another table and there are variables with apostrophe's. These queried variables keep the variables from the form page and the queried DB from inserting into a new table. So I use mysql_real_escape_string () for the variables queried from the table to be inserted into the new table, don't use mysql_real_escape_string () on the variables passed frm the form page, and everything inserts into the new table just fine. Displays with no forward slashes. My confusion comes from when to use mysql_real_escape_string (), stripslashes () and htmlspecialchars(). Also in the reading I was doing, it looks like mysql_real_escape_string () is being replaced with mysqli_real_escape_string (), but when I tried to use it on a variable queried from the DB something like $username = mysqli_real_escape_string ( $s['username'] ) ( $s being 'foreach ( $result as $s )' from the select query. Thanks in advance for shedding any light on this.
  7. I may be mistaken but I think that would still put the original email in the header. Tyring to do an Anonymous Email like on Craigslist.
  8. I have built a small classified ads application. A person can put in an item for sale and it will diaplay the item. On the input form for the ad they enter their email address. I am looking for an application that will display an anonymous email address on the classified ad and send to the anonmmous email through to their real email address. I would prefer to do this through the web server of the client and not have to set up a Google Apps or third party email accout for the "catch all" account. Any recommendation for tutorials to explain and illustrate how to write this code. Thanks in advance for any assist. m
  9. I'm useing a simple HTML drop-down list box. But now I want to be able to and an editable drop-down box so that if the particular item in the drop-down is not changed it won't update the database. But if a new value is selected it will update the DB with the new value. I am not clear on a couple of things. should the valuse of the drop down be in a seperate DB table. And then the script to change the new value or keep the old. I've googled this and can't seem to find a workable solution. Thanks in advance,
  10. Yes I saw that and made complete sense. Didn't know if there were any other approaces such as error logs and the such. thanks for all the help.
  11. Thanks for your comments Psycho. I see now what you and Barand are saying. You first comment about the conditions no being arbitrary makes complete sense. Any suggestions on where I might start on debugging. I am weak on that and it would help in solving the problems I come with. Again, thanks.
  12. Thanks. I did try And and OR in place of && and ||. I don't think that's the problem. The code is not recognizing the $num_row count and then applying the conditions of the elseif statements.
  13. I am looking to identify a particular company records from a table that holds multiple records of the same company but with different criteria such as source of payment and row count to delete a specific record from two table and update a third. The ifelse statememts don't working. There are 4 conditions. First is if the paid source = "MT1000". Second is if the paid source = "2411". The third condition is if the Row Count >= 2, and the forth condition is that the Row Count == 1. Even though on a particular query the row count is 2, the condition returned is Row Count = 1. If I remove one record and switch the order of the last two conditions, the row count is 1 but returns the Row Count <= 2. $result = mysql_query( "SELECT COUNT(1) FROM townSponsor_OBC_tools WHERE ts_obc_username = '$ts_obc_username' AND ts_obc_userID = '$ts_obc_userID'" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_result($result, 0, 0); echo 'Row Count: = '; echo $num_rows; if ( $ts_obc_paidSourcee == 'MTM1000' ) { echo "This Paid source is MTM1000 and Nothing is done"; } elseif ( $ts_obc_paidSourcee == '2411' ) { echo "This Paid source is 2411 and Nothing is done"; } elseif ( $num_rows == 1 || $ts_obc_paidSourcee <> 'MTM1000' || $ts_obc_paidSourcee <> '2411') { echo "Row Count is = 1 and paid source isn not MTM1000 or 2411"; mysql_query("DELETE FROM townSponsor_OBC_tools WHERE ts_obc_m_orgIDSponsor = '$ts_obc_m_orgIDSponsor' AND ts_obc_username = '$ts_obc_username' AND ts_obc_userID = '$ts_obc_userID'"); mysql_query("DELETE FROM townSponsor_members WHERE tsm_m_username = '$ts_obc_username' AND tsm_m_userID = '$ts_obc_userID' AND tsm_assocID = '$ts_obc_m_orgIDSponsor'"); mysql_query("UPDATE users SET zabp_paid = 'NEW_S' WHERE username = '$ts_obc_username' AND id = '$ts_obc_userID'"); } elseif ( $num_rows >= 2 || $ts_obc_paidSourcee <> 'MTM1000' || $ts_obc_paidSourcee <> '2411') { echo "Row Count is >= 2 and paid source isn not MTM1000 or 2411"; mysql_query("DELETE FROM townSponsor_OBC_toolsTest WHERE ts_obc_m_orgIDSponsor = '$ts_obc_m_orgIDSponsor' AND ts_obc_username = '$ts_obc_username' AND ts_obc_userID = '$ts_obc_userID'"); mysql_query("DELETE FROM townSponsor_members WHERE tsm_m_username = '$ts_obc_username' AND tsm_m_userID = '$ts_obc_userID' AND tsm_assocID = '$ts_obc_m_orgIDSponsor'"); } Thank you in advance for any insights or suggestions.
  14. I posted a topic earlier and there was confusion as to what I could not work out. I am able to display the checkbox, either checked or unchecked depending of the value or 1 or 0 in the obcDisplay field. <input type="checkbox" name="obcDisplay" value="<?=$r['obcDisplay'] ?>" <?=($r['obcDisplay']) ? 'checked="checked"' : ''; ?>/> I am trying to update the DB table by the checkbox. If the checkbox is checked (obcDisplay = 1) and I uncheck the box and submit, I want the table updated so that obcDisplay now equals 0. When the form is displayed, the checkbox is now uncheck (obcDisplay = 0). Now I check the box and submit and the update changes the field from 0 to 1. I can display the checkbox as checked or unchecked by the DB field obcDisplay being either 0 or 1. It is changing the value where I am having the problem.
  15. Using the 1 or 0 as the value would make more sense. What I am having trouble understanding and making work would be, if 1 = checked and 0 = not checked. And the field for a particular user in the user table is set to 0 which returns an unchecked checkbox, I want to be able to check the box, click submit and update the DB field obcDisplay to a 1, and back and forth. <input type="checkbox" name="obcDisplay" value="<?=$r['obcDisplay'] ?>" <?=($r['obcDisplay']) ? 'checked="checked"' : ''; ?>/> so I put the result from the query to display the content of the obcDisplay field in the value = and it does display the correnct 1 or 0, and if it's a 1 the box is checked, if it's a 0 the box is unchecked. It's updating the table with the new 1 or 0 that I can't get my arms around.
  16. I'm trying to get some code to work that will update a field to show a checkbox either checked or not checked. The field either uses a Y or N. Y is checked, N not checked. A code that I have tried displays the correct result for the box either checked or not checked. input type="checkbox" name="obcDisplay" value="Y" <?=($r['obcDisplay'] == 'Y') ? 'checked="checked"' : ''; ?>/> But I want the ability to change when the form is submitted. so if I bring up a page and the checkbox is checked (Y) and I submint, I want the database to update to N and the other way around.
  17. A select query I've written joins three tables. The query works fine, pulling up a users table, a table for specials advertising that are entered by members, a and a third table the identivies members who have joined a customer application. A page displays listing all the entries who have joined the customer application, their names, address, etc display but if they have not set up their special advertising, then the fields for that table display NULL. I have tried an If and an ifelse to not display text (you can see in the code the HTML Hours of Operation: and Specials:). Thee field I am using to differentiate is "m_primeID", it is an intiger field. The if statement I've written is follows. if( $row["$m_primeID"] == 'NULL' ) { $company .= ""; } elseif( $row["$m_primeID"] <> 'NULL' ) { $company .= "<b>Hours of Operation:</b><br>" . ($row["m_coupon_title"]) . "<br /><br />\n"; $company .= "<b>Special:</b><br>" .($row["m_coupon_desc"]) . "<br /><br />\n"; } Here is a screen shot of part of the joined tables. This screen shot show the Null on the joined tables that don't have customer advertising set up. Any Ideas
  18. First, there is an seperate file that formats the random numbers and letters doimg.php <?php // Create the image with width=150 and height=40 $IMGVER_IMAGE = imagecreate(150,40); // Allocate two colors (Black & White) // This uses the RGB names of the colors $IMGVER_COLOR_BLACK = imagecolorallocate ($IMGVER_IMAGE, 0, 0, 0); $IMGVER_COLOR_WHITE = imagecolorallocate ($IMGVER_IMAGE, 255, 255, 255); // Flood Fill our image with black imagefill($IMGVER_IMAGE, 0, 0, $IMGVER_COLOR_BLACK); // This handles our session. We get the random text that // was stored in our session var on the first page. session_start(); $IMGVER_RandomText = $_SESSION["IMGVER_RndText"]; //$IMGVER_RandomText = $HTTP_SESSION_VARS["IMGVER_RndText"]; // Since our Text had 6 chars (we defined this not to be longer) // we now write the 6 random chars in our picture // For those who don´t know: You can access the third character //in a string easily by typing $myString[2]; imagechar($IMGVER_IMAGE, 8, 20, 13, $IMGVER_RandomText[0] ,$IMGVER_COLOR_WHITE); imagechar($IMGVER_IMAGE, 18, 40, 18, $IMGVER_RandomText[1] ,$IMGVER_COLOR_WHITE); imagechar($IMGVER_IMAGE, 12, 60, 13, $IMGVER_RandomText[2] ,$IMGVER_COLOR_WHITE); imagechar($IMGVER_IMAGE, 10, 80, 10, $IMGVER_RandomText[3] ,$IMGVER_COLOR_WHITE); imagechar($IMGVER_IMAGE, 12, 100, 13, $IMGVER_RandomText[4] ,$IMGVER_COLOR_WHITE); imagechar($IMGVER_IMAGE, 12, 120, 13, $IMGVER_RandomText[5] ,$IMGVER_COLOR_WHITE); //Now we send the picture to the Browser header("Content-type: image/jpeg"); imagejpeg($IMGVER_IMAGE); ?> Nest there is the form page creating the session variable and displaying the random numbers and letters in the form form.php <?php session_start(); // Initialize a variable. THIS IS OBSOLETE AND ONLY USED TO PREVENT // NOTICES ON SOME SYSTEMS. $IMGVER_TempString=""; // Now we generate a string that consists of 6 characters that are // generated randomly. I choose 6, because I didn´t want the user to // type forever. Of course, any other number would do as well. (NOTE, // THAT IF YOU USE ANOTHER NUMBER, YOU ALSO HAVE TO EDIT THE IMAGE // CODE) --> Have a look at the GetRandomChar() function at the bottom // of this script! for ($i = 1; $i <= 6; $i++) { $IMGVER_TempString .= GetRandomChar(); } // Now we store the text in our session variable. $_SESSION["IMGVER_RndText"] = $IMGVER_TempString; //$HTTP_SESSION_VARS["IMGVER_RndText"] = $IMGVER_TempString; function GetRandomChar() { // This function generates our random chars // Seed with microseconds since last "whole" second mt_srand((double)microtime()*1000000); // Create a random number between 1 and 3 $IMGVER_RandVal = mt_rand(1,3); // If the random number was 1, we generate a lowercase // character, if it was 2, we generate a number and if // it was 3, we generate an uppercase character. switch ($IMGVER_RandVal) { case 1: // 97 to 122 are the ASCII codes for lower- // case characters from a to z. $IMGVER_RandVal = mt_rand(97, 98); break; case 2: // 48 to 57 are the ASCII codes for the // numbers from 0 to 9. $IMGVER_RandVal = mt_rand(49, 57); break; case 3: // 65 to 70 are the ASCII codes for upper- // case characters from a to z. $IMGVER_RandVal = mt_rand(65, 78); break; } // Now we return the character, generated from the ASCII code return chr($IMGVER_RandVal); } // BELOW THIS LINE YOU CAN WRITE HTML CODE OR ANYTHING ELSE. ?> <form action="form_submitted.php" method="post" onSubmit="return validateForm(this)" id=form1 name=form1> <table width="558" align="center" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="172" height="30" valign="middle"><p>Company Name: </p></td> <td width="331" valign="middle"><label> <input name="company" type="text" id="company" size="50" /> </label> </td> </tr> <tr> <td height="30" valign="middle"><p>Email Address: </p></td> <td valign="middle"><input name="email" type="text" id="email" size="50" /> </td> </tr> <tr> <td height="51"> </td> <td valign="top"> <img src="doimg.php?<?php echo SID ?>" /> <input type="button" value="Reload Page" onClick="window.location.reload()"><br> </td> </tr> <tr> <td height="30"> </td> <td class="body_text_13_left">Please Enter Captcha Code <br><input name="txtCode" type="text" id="txtCode" size="10" /> </td> </tr> <tr> <td height="30"><p> </p></td> <td><input type="submit" name="Submit" value="Submit" /> </td> </tr> </table> </form> The form page is submitted to form_submitted.php where session varible is processed and then there is an if statement. If the variable is equal the page sends an email out, if not there is an error message to return and fill out the correct captcha <?php session_start(); $company = $_POST["company"]; $email = $_POST["email"]; // Then we get the Text entered by the user and // the random generated text $IMGVER_EnteredText = $HTTP_POST_VARS["txtCode"]; $IMGVER_RandomText = $_SESSION["IMGVER_RndText"]; //$IMGVER_RandomText = $HTTP_SESSION_VARS["IMGVER_RndText"]; // Now we check, if the two strings are the same if ($IMGVER_EnteredText == $IMGVER_RandomText) { ?> This is where the script to send the email out with the $_POST variables and a html thank you. <?php } else { ?> This is where the HTML to return to form.php is contained <?php } ?> His is in it's simplest form, no html markup which would have no bearing on the process.
  19. For years I have used a simple captcha application displaying a simple combination of letters and numbers. All has worked fine except that my hosting company upgraded some of their servers from PHP 5.2.17 to PHP 5.4.29. The numbers now down't display and I can submit the form without filling any captcha into the text box. On the otherhand, I have a couple of sites on different servers, (same hosting company) using PHP 5.2.17 and the captcha application works perfectly. The code to make the captcha works uses $HTTP_SESSION_VARS and I understand it is deptrecated with newer versions of PHP so I changed to $_SESSION. If I fill out the form and leave the captcha blank it will default to the error message and require a return to the form page to fill in the captcha. Once filled in and the form submitted, it goes to the default message. It appears that the session variable is not passing to the page and recognized.
  20. Thanks again for your time and interest. I misunderstood your comments in the first post regarding replacing strip_slashes() with urldecode(). I am not clear on the differences between htmlentities(), htmlspecialchars(), urldecode() and mysql_real_escape_string() but from your reply I should. Your change to the close row works perfectly, and as I see it I understand the logic. This is much cleaner and provides more control. I am not very strong in object oriented programming but each time I get feedback I see the flow and how it works. Thanks again for all your help and direction. mike
  21. First, thanks so much for your time and for the explaination and the example code. Sorry for the sloppy code, the closed anchor tag was just plain sloppy. I've read up on the modulus operator and I believe I understand. If there are 5 records and 3 columns, is leaves a remainder of .67 which gives a result of 0 and closes the row. In this case closes it on row 2. if it were 15 records, no remainder it would display 5 rows closing, I guess, at the 6th. The function you wrote at the beginning of the script is the output that I had in each of the table columns. I was curious why you wrote the sql select query the way you did, but I read your note and it makes sense, the query doesn't need to work as hard by going through every record. Regarding your question about the order, it can flow you you described in the first illustration ------------- | 1 | 2 | 3 | ------------- | 4 | 5 | 6 | ------------- | 7 | 8 | 9 | ------------- It my test query, there are 5 results. Below is the page URL for setting the maximum columns to 3. It is returning 2 columns with 1 result in row 1, 2 results in row 2, and 1 result in rows 3 and 4. http://specialslocator.com/specials_zip_locator/managersSpecial_display_v2.php?un=830&mS_MGMTcampaignID=1IBu3992p If I set the maximum columns to 4, It returns 1 result for row 1, 3 results for row 2 and 1 result for row 3. http://specialslocator.com/specials_zip_locator/managersSpecial_display_v2.php?un=830&mS_MGMTcampaignID=1IBu3992p Here is the uploaded code for 3 rows. <?php include("../_customer_apps/include/session.php"); define( "DIR", "SIMT_town_sponsorship_processing_files/", true ); require( 'zipconfig.php' ); require( DIR . 'lib/db.class.php' ); require( DIR . 'lib/busgroup.class.php' ); //Define the number of columsn to use $max_columns = 3; //Function to create output for one company function companyOutput($row) { //Create output for the company $company = ''; if(!empty($row["m_logo"])) { $imgURL = urlencode($row["m_logo"]); $company .= "<div align='center'>\n"; $company .= "<img src='http://marketingteammates.com/_ZABP_merchants/_zcnsLogos/gick.php/{$imgURL}?resize(220)' border='0'><br />"; $company .= "</div>\n"; } $company .= "<h6>" . ($row["mS_MGMT_m_company"]) . "</h6>\n"; $company .= ($row["b2c_m_address1"]) . ' ' . ($row["b2c_m_address2"]) . "<br />\n"; $company .= ($row["b2c_m_city"]) . ' ' . ($row["b2c_m_state"]) . ', ' . ($row["b2c_m_zip"]) . "<br />\n"; $company .= "Phone: " . ($row["b2c_m_phone"]) . "<br />\n"; $company .= "Fax: " . ($row["b2c_m_fax"]) . "<br />\n"; $company .= "<a href='mailto:" . ($row["b2c_email"]) . "'>" . ($row["b2c_email"]) . "</a><br /><br />\n"; $company .= "Hours of Operation: " . ($row["m_coupon_title"]) . "<br />\n"; $company .= ($row["m_coupon_desc"]) . "<br /><br />\n"; $company .= "<div align='center'>"; $company .= "<img src='../images/print_image.gif' width='29' height='31' /><br /><br />\n"; $company .= "<hr width='80%' size='1' />\n"; $company .= "</div><br /><br />\n"; return $company; } //Get data from the url - and make SQL safe $UN_URL = urlencode($_GET['un']); $mS_MGMTcampaignID_URL = urlencode($_GET['mS_MGMTcampaignID']); //Create and run query ### DON'T USE * IN THE SELECT - IT IS INEFFICIENT $query = "SELECT mS_MGMT_m_company, m_logo, b2c_m_address1, b2c_m_address2, b2c_m_city, b2c_m_state, b2c_m_zip, b2c_m_phone, b2c_m_fax, b2c_email, m_coupon_title, m_coupon_desc FROM manager_Specials_company_mgmt MSCM LEFT JOIN b2c_coupons B2CC ON (MSCM.mS_MGMT_id = B2CC.m_primeID ) WHERE mS_MGMTcampaignID = '$mS_MGMTcampaignID_URL' ORDER BY mS_MGMT_m_company ASC"; $result = mysql_query($query); $result_count = mysql_num_rows($result); //Create the output $output = ''; if(!$result_count) { //There were no results $output .= "<tr><th>There were no results</th></tr>\n"; } else { //Redefine max_columns if total is less than the max //i.e., if there are only 2 records, only use 2 columns $max_columns = min($max_columns, $result_count); //Create header row $companyString = ($result_count==1) ? 'company:' : 'companies:'; $output .= "<tr>\n"; $output .= "<th colspan='{$max_columns}' valign='top' class='body_text_10_Center'>"; $output .= "{$mS_campaignName_mS} is proud to sponsor {$result_count} {$companyString}"; $output .= "</th>\n"; $output .= "</tr>\n"; //Create output for each result record $row_count = 0; while($row = mysql_fetch_assoc($result)) { //Increment the row counter $row_count++; //Open new row if first record in a row if($row_count%$max_columns == 1) { $output .= "<tr>\n"; } //Output the record $output .= "<td>\n"; $output .= companyOutput($row); $output .= "</td>\n"; //Close row if last record in a row if($row_count%$max_columns == 1) { $output .= "</tr>\n"; } } //If last row was not closed, close it now if($row_count%$max_columns != 1) { $output .= "</tr>\n"; } } ?> <html> <head></head> <body> <table width="944" border="1" align="center" cellpadding="0" cellspacing="0"> <?php echo $output; ?> </table> </body> </html>
  22. Thanks for the help and direction. I thought the code was pretty logically structured, and you are right about the PHP Logic and output. I'm so use to going in and out of PHP and being a visual person I am geared to view the output as I go along. I'm sure it drives structured code writers nuts. Sorry that it's an interference. Looking forward to see your approach.
  23. I am trying to create 3 columns of data from a query. I have used this code before for 2 columns but and now wanting to use for three columns. There are 5 records from a join query. The first two columns display the results, 2 results in the left column and 3 results in the center column. The right column displayw empyt text used in displaying the results, there is no data to populate and it seems to mimic the the number from the center, 3. Here is the URL to see the problem http://specialslocator.com/specials_zip_locator/managersSpecial_display.php?un=830&mS_MGMTcampaignID=1IBu3992p Here is the Code for the query and the 3 column results. <?php $UN_URL = $_GET['un']; $mS_MGMTcampaignID_URL = $_GET['mS_MGMTcampaignID']; ?> <table width="944" border="1" align="center" cellpadding="0" cellspacing="0"> <?php $result = mysql_query( "SELECT * FROM manager_Specials_company_mgmt MSCM LEFT JOIN b2c_coupons B2CC ON (MSCM.mS_MGMT_id = B2CC.m_primeID )WHERE mS_MGMTcampaignID = '$mS_MGMTcampaignID_URL' ORDER BY mS_MGMT_m_company ASC" ); $num_results = mysql_num_rows($result); $numb_tb_rows= ceil($num_results/3) ?> <? if ( $numb_tb_rows > 0 ) { ?> <tr > <td colspan="4" valign="top" class="body_text_10_Center"><strong><?=$mS_campaignName_mS?> is proud to sponsor <?=$num_results?> <? if ( $num_results == 1 ) { ?> company:</strong> <? } elseif ( $num_results > 1 ) { ?> companies:</strong> <? } ?> </td> </tr> <tr class="body_text_10_Center"> <!-- Column 1 --> <td width="320" class="body_text_10_Center" valign="top"> <? // column #1 if($num_results>=1) { for($i=0; $i<$numb_tb_rows; $i++) { $row= mysql_fetch_array($result); ?> <?php if(!empty ($row["m_logo"])) { ?> <div align="center"> <img src="http://marketingteammates.com/_ZABP_merchants/_zcnsLogos/gick.php/<?=stripslashes($row["m_logo"])?>?resize(220)" border="0"></a><br /> </div> <?php } else { } ?> <h6><?=stripslashes($row["mS_MGMT_m_company"])?></h6> <?=stripslashes($row["b2c_m_address1"])?> <?=stripslashes($row["b2c_m_address2"])?><br /> <?=stripslashes($row["b2c_m_city"])?> <?=stripslashes($row["b2c_m_state"])?>, <?=stripslashes($row["b2c_m_zip"])?><br /> Phone: <?=stripslashes($row["b2c_m_phone"])?><br /> Fax: <?=stripslashes($row["b2c_m_fax"])?><br /> <a href="mailto:<?=stripslashes($row["b2c_email"])?>"><?=stripslashes($row["b2c_email"])?></a><br /><br /> Hours of Operation: <?=stripslashes($row["m_coupon_title"])?><br /> <?=stripslashes($row["m_coupon_desc"])?><br /><br /> <div align="center"> <img src="../images/print_image.gif" width="29" height="31" /><br /><br /> <hr width="80%" size="1" /> </div><br /><br /> <? // END column #1 } } ?> </td> <!-- Column 2 --> <td width="320" class="body_text_10_Center" valign="top"> <? // column #2 if($num_results>=2) { for($i=($numb_tb_rows); $i<$num_results; $i++) { $row= mysql_fetch_array($result); ?> <?php if(!empty ($row["m_logo"])) { ?> <div align="center"> <img src="http://marketingteammates.com/_ZABP_merchants/_zcnsLogos/gick.php/<?=stripslashes($row["m_logo"])?>?resize(220)" border="0"></a><br /> </div> <?php } else { } ?> <h6><?=stripslashes($row["mS_MGMT_m_company"])?></h6> <?=stripslashes($row["b2c_m_address1"])?> <?=stripslashes($row["b2c_m_address2"])?><br /> <?=stripslashes($row["b2c_m_city"])?> <?=stripslashes($row["b2c_m_state"])?>, <?=stripslashes($row["b2c_m_zip"])?><br /> Phone: <?=stripslashes($row["b2c_m_phone"])?><br /> Fax: <?=stripslashes($row["b2c_m_fax"])?><br /> <a href="mailto:<?=stripslashes($row["b2c_email"])?>"><?=stripslashes($row["b2c_email"])?></a><br /><br /> Hours of Operation: <?=stripslashes($row["m_coupon_title"])?><br /> <?=stripslashes($row["m_coupon_desc"])?><br /><br /> <div align="center"> <img src="../images/print_image.gif" width="29" height="31" /><br /><br /> <hr width="80%" size="1" /> </div><br /><br /> <? // END column #2 } } ?> </td> <!-- Column 3 --> <td width="320" class="body_text_10_Center" valign="top"> <? // column #3 if($num_results>=3) { for($i=($numb_tb_rows); $i<$num_results; $i++) { $row= mysql_fetch_array($result); ?> <?php if(!empty ($row["m_logo"])) { ?> <div align="center"> <img src="http://marketingteammates.com/_ZABP_merchants/_zcnsLogos/gick.php/<?=stripslashes($row["m_logo"])?>?resize(220)" border="0"></a><br /> </div> <?php } else { } ?> <h6><?=stripslashes($row["mS_MGMT_m_company"])?></h6> <?=stripslashes($row["b2c_m_address1"])?> <?=stripslashes($row["b2c_m_address2"])?><br /> <?=stripslashes($row["b2c_m_city"])?> <?=stripslashes($row["b2c_m_state"])?>, <?=stripslashes($row["b2c_m_zip"])?><br /> Phone: <?=stripslashes($row["b2c_m_phone"])?><br /> Fax: <?=stripslashes($row["b2c_m_fax"])?><br /> <a href="mailto:<?=stripslashes($row["b2c_email"])?>"><?=stripslashes($row["b2c_email"])?></a><br /><br /> Hours of Operation: <?=stripslashes($row["m_coupon_title"])?><br /> <?=stripslashes($row["m_coupon_desc"])?><br /><br /> <div align="center"> <img src="../images/print_image.gif" width="29" height="31" /><br /><br /> <hr width="80%" size="1" /> </div><br /><br /> <? // END column #3 } } ?> </td> </tr> <? } else { echo ""; } ?> </table> Thanks for any help in advance. Mike
  24. I want to remove the HTTP:// or HTTPS:// from the insert into the DB. The Viewer may put just www, or copy the entire URL with the HTTP:// or HTTPS:// I tried using the preg-replace but couldn't seem to get it to work. Any other recommendation? Thanks in advance, Mike
  25. In my .htaccess, I have the following to enter a domain name then a store number such as www.domain.com/c111 The page storeNumber.php displays perfectly call the correct variables through the _GET. The help I got and has been set up works for an Alpha and thre rest numbers. What would be rewriterule be to use any random string of Alpha Numberic characters? Such as C123, 12CF, cf15, C2f5... RewriteOptions inherit RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-z0-9-]+)$ /storeNumber.php?storeNumberID=$1 [NC,L] Thanks for any help in advance, Mike
×
×
  • 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.