Jump to content

bubbasheeko

Members
  • Posts

    166
  • Joined

  • Last visited

    Never

Everything posted by bubbasheeko

  1. $newLine = "\r\n"; // FIRST THING - GRAB THE EMAIL LIST $email_pull = mysql_query('SELECT * FROM `mail_list`') or die('There was an error connecting to the database to retrieve the email list'); // CREATE EMAIL GROUP VARIABLE $to = ""; while($email_results = mysql_fetch_assoc($email_pull)) { $email_address = $email_results['email_address']; $name = $email_results['name']; $to .= "BCC: $name <$email_address>" . $newLine; } echo $to; I am trying to build an email list pulled from a database for a newsletter. When I try to combine name and email address the second variable is always ignored....so for example it should be BCC: My Name <my@email>.... but that is not what is happening. What is displaying is: BCC: My Name. email_address is not blank - if I swap the variables, email address is displayed and name is ignored. I did discover that if I removed the <> it would work fine...but of course I want to be able to have the name and email address showing in the email client. I have tried this way as well: "BCC: " . $name . "<" . $email_address . ">" . $newLine; - I get the same results. Anybody see the error of my ways?
  2. hmm..I don't give myself enough credit..... <?php if(isset($_GET['d'])) { $path = "../photos/" . $_GET['d'] . "/"; $imgDir = opendir($path); } else { $path = "../photos/"; $imgDir = opendir($path); } echo "<table width='600' colspan='2' rowspan='2' align='center'>"; $i=0; // COUNTER FOR TABLE BUILDER while($imgName = readdir($imgDir)) { $i++; if($i == 1) { echo "<tr>"; } elseif($i == 6) { echo "</tr><tr>"; $i = 0; } if(is_dir($path . $imgName)) { if (($imgName != ".") && ($imgName != "..")) { echo '<td><a href="photo_test.php?d=' . $imgName . '"><img src="../images/PictureFolder.jpg" border="0"><br />' . $imgName . '</a></td>'; } } else { if (($imgName != ".") && ($imgName != "..")) { echo '<td><a href="' . $path . $imgName . '">' . $imgName . '</a></td>'; } } } echo "</tr></table>"; ?> Again...it may not be perfect...but it works
  3. Okay....massive misfire of the brain...I think I am a victim of if statements. I want to throw the directories and the files in a table with 5 columns...how would I do that with what I have come up with???
  4. Okay...did some playing while I have been waiting I came up with this... <?php if(isset($_GET['d'])) { $path = "../photos/" . $_GET['d'] . "/"; $imgDir = opendir($path); } else { $path = "../photos/"; $imgDir = opendir($path); } while($imgName = readdir($imgDir)) { if(is_dir($path . $imgName)) { if (($imgName != ".") && ($imgName != "..")) { echo "<a href=\"photo_test.php?d=" . $imgName . "\">". $imgName ."</a><br />"; } } else { if (($imgName != ".") && ($imgName != "..")) { echo '<a href="' . $path . $imgName . '">' . $imgName . '</a><br />'; } } } ?> Not sure if this is the right way, but it does work I have separated the directories because I am going to be adding a nice listing using thumbnails...so I will see how that goes.
  5. I am trying to come up with an easy way for a client to update their image gallery and came up with an idea....the problem? Inexperience with file commands for php... Here is the idea. A folder is set up for the user - /photos/ They will create new directories - used as categories. Under each directory (category) they will upload images related to the directory name. The site visitor will see a thumbnail of the first image in the directory acting as an 'icon'. If they click on it they will then be able to see a thumbnails of each image under that directory. They will be able to click on it and it will show up on screen. Can anybody provide me with direction??
  6. I have that one bookmarked as well, thanks for sharing
  7. In addition, I always make it a practice to use quotes in my queries. mysql_query("SELECT `a`.`products_name`, `a.`products_id`, `b`.`products_id`, `b`.`products_price` FROM `a`, `b` WHERE `a`.`products_id` = `b`.`products_id` && `b`.`products_price` = '" . $price . "' && `a`.`products_name` = '" . $name . "'")or die("Error : " . mysql_error()); Your tables appeared wrong according to your select string a.products_name = table name is 'a' and the field name is 'products_name'. Replace the 'a' and 'b' table names with the table names you have. As Daniel said, let us know the error message you are receiving...it helps us to help you solve your issue.
  8. To further the example by Mchl. Your database connection: $link = mysql_connect ( $hostname, $username, $password ) or trigger_error ( mysql_error(),E_USER_ERROR ); mysql_select_db ( $database ); Your mysqli string: $name = mysql_real_escape_string($link, $_POST[name]);
  9. angelcool - elvia is talking about the form information into the database...not the image itself. There is a form with information about the image that is being submitted to the database. The image is being stored in the images directory.
  10. Depends on your FTP program. If you use say...Firefox and FireFTP...you just simply right click on the images folder and set permissions. Most cases in FTP programs...you would just right click on the file or folder and choose to set the permissions. You could get a way with 755..but if not you would need to set the permissions to 777.
  11. The box has no special features really...so the content in the middle should expand it automatically - unless you set the height of the box with css.
  12. Whoops...forgot about that...thanks PF!
  13. Use the W3 HTML Validation to hunt down some HTML errors you may have made. http://validator.w3.org/check?uri=http%3A%2F%2Fwww.hfhpulm.com%2Fschedules%2Fstaffcallcurrent.php&charset=%28detect+automatically%29&doctype=Inline&group=0 Switch from applying styles directly to each line of a table and just use css. :S Makes for easier reading of the code and will save you time in the future if you want to change the look of it. Change it from one place?? or 2..3..4..50.
  14. Welcome to PHPFreaks! That is somewhat easy, but I have not used Wordpress. I do know that you could simply pull the articles and their titles from the Wordpress database, but beyond how to show them within the Wordpress environment - I don't know. Maybe somebody with some Wordpress experience could chime in with some ideas.
  15. Try: $name = mysqli_real_escape_string($_POST['name']);
  16. Try this if your permissions are fine: if(move_uploaded_file($_FILES['picture'], $target)) { echo "The file ". basename($_FILES['picture']). " has been uploaded, and your information has been added to the directory"; } else { echo "Sorry, there was a problem uploading your file."; That would explain why it would be failing the first check and jumping to the else.
  17. Resolved. Didn't see the 's' on: $event_name_result's'['SUM(`ticketevents`.`mc_gross`)'];
  18. Anybody have any ideas why my SUM()'s are not working?
  19. Thanks for the response! I figured that out right after I posted. I didn't mark it as resolved because I couldn't get it to work - I keep receiving an error. $event_name = mysql_query('SELECT `ticketevent_items.item_name`, `ticketevent_items.event_date`, SUM(`ticketevents.mc_gross`), SUM(`ticketevents.tax`), SUM(`ticketevents.mc_fee`) FROM `ticketevents`, `ticketevent_items` WHERE YEAR(`ticketevent_items.event_date`) = "' . $year . '" && `ticketevents.item_number` = `ticketevent_items.item_number`'); With PHP output I receive this error: Tested within PHPMyAdmin and received this error: Double checked my spelling of the field names and the tables. They are correct. Corrected it - bad quotes...updated the fields to `ticketevents`.`fieldname`. Worked, however, I did not get anything for the SUM - turned up blank. All the sum's I tried to get did not produce anything like I saw in PHPMyAdmin. So let's add what I have for code: $event_name = mysql_query('SELECT `ticketevent_items`.`item_name`, `ticketevent_items`.`event_date`, SUM(`ticketevents`.`mc_gross`), SUM(`ticketevents`.`tax`), SUM(`ticketevents`.`mc_fee`) FROM `ticketevent_items`, `ticketevents` WHERE YEAR(`ticketevent_items`.`event_date`) = "2009" && `ticketevent_items`.`item_number` = `ticketevents`.`item_number` GROUP BY `ticketevent_items`.`item_name'); echo "Report for -> " . $year; echo "<br><br>"; echo "<table width='650' border='0' cellspacing='0' cellpadding='0'>"; echo "<tr>"; // title row echo "<td>Event Title</td>"; echo "<td>Event Date</td>"; echo "<td>Gross Revenue</td>"; echo "<td>Total Transactions Costs</td>"; echo "<td>Total GST</td>"; echo "<td>Total Earned</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan='6'> </td>"; echo "</tr>"; while($event_name_result = mysql_fetch_assoc($event_name)) { $gross = $event_name_results['SUM(`ticketevents`.`mc_gross`)']; $fees = $event_name_results['SUM(`ticketevents`.`mc_fee`)']; $taxes = $event_name_results['SUM(`ticketevents`.`tax`)']; $net = ($gross - $fees) - $taxes; echo "<tr>"; echo "<td>" . $event_name_result['item_name'] . "</td>"; echo "<td>" . $event_name_result['event_date'] . "</td>"; echo "<td>$" . $gross . "</td>"; echo "<td>$" . $fees . "</td>"; echo "<td>$" . $taxes . "</td>"; echo "<td>$" . $net . "</td>"; echo "</tr>"; } echo "</table>";
  20. I have two tables but would prefer only one query to do the job. I am trying to pull yearly data (from `ticketevents` and `ticketevent_items`). The only common field between the two is `item_number`. The fields I want are: sum(ticketevents.gross), sum(ticketevents.tax), sum(ticketevents.fees), ticketevent_items.item_name and ticketevent_items.event_date. I have tried a few variations to SELECT them, but they have failed. Any hints in the right direction would be great!
  21. I am not sure how to do this.... I have a database: Customer Name Item Number Quantity_Purchased Amount_Due What I want to do is see one of each Item Number. So...if more than one item is purchased by more than one person, I want to see an 'individual' list of items. I need to do this with one query. Example output: Item Number 00022 00233 35221 Now 00022 has 23 purchased - so it will have at least 23 individual records...I only want to see the item in the list once. I hope this makes sense...
  22. Another option if you need to use a form....put your form buttons into an array...or name them using your database query...use the primary key as the name or something like that. The way you have it now will always default to the first vehicle because the submit button has the same name....you will need a different name when it is contained within the same form tag. That's the only suggestion I have looking at your code. BTW...you should contain your code in the code tags.
  23. Starters....do you not need 'config.inc'? You have it ignored. Next...what are the error messages that you are receiving? If any.
  24. Yes it is possible. Do something like this: SELECT * FROM `table` LIMIT 0, 6 -> Gives you records 1-6 You will need to develop a counter or something along those lines....for example...you have something to add one to the last record count (6 + 1 = 7) and another for the last record to grab so for you (7 + 6 = 13). You would use these results to get your next query. SELECT * FROM `table LIMIT 7, 13 -> Gives you the next record (7) plus 6 (13).
  25. Okay...it worked once...but hasn't since. Here is the code that I have....please keep in mind for testing purposes I have matched the array keys to the field/column names in the database. $body .= "Transaction ID:" . $p->ipn_data['txn_id'] . "\n"; $body .= "Gross: " . $p->ipn_data['mc_gross'] . "\n"; $body .= "Tax: " . $p->ipn_data['tax'] . "\n"; $body .= "First Name: " . $p->ipn_data['first_name'] . "\n"; $body .= "Last Name: " . $p->ipn_data['last_name'] . "\n"; $body .= "Email Address: " . $p->ipn_data['payer_email'] . "\n"; $body .= "Street Address: " . $p->ipn_data['address_street'] . "\n"; $body .= "City: " . $p->ipn_data['address_city'] . "\n"; $body .= "State/Province: " . $p->ipn_data['address_state'] . "\n"; $body .= "Postal Code: " . $p->ipn_data['address_zip'] . "\n"; $body .= "Country: " . $p->ipn_data['address_country_code'] . "\n"; $body .= "PayPal Address Status: " . $p->ipn_data['address_status'] . "\n"; $body .= "Item Number: " . $p->ipn_data['item_number'] . "\n"; $body .= "Quantity: " . $p->ipn_data['quantity'] . "\n"; $body .= "Currency: " . $p->ipn_data['mc_currency'] . "\n"; $body .= "Payment Status: " . $p->ipn_data['payment_status'] . "\n"; $body .= "Payment Type: " . $p->ipn_data['payment_type'] . "\n"; This is the code that builds the body of a test email so i can see that there is content there. Which works great, I see everything I am supposed to. This code that takes certain items from the array so I can enter it into a database is what is causing my headaches. // DATABASE ENTRY $insert_update = mysql_query("INSERT INTO `ticketevents` (`txn_id`, `mc_gross`, `tax`, `first_name`, `last_name`, `payer_email`, `address_street`, `address_city`, `address_state`, `address_zip`, `address_country_code`, `address_status`, `item_number`, `quantity`, `mc_currency`, `payment_status`, `payment_type`) VALUES (" . $p->ipn_data['txn_id'] . ", " . $p->ipn_data['mc_gross'] . ", " . $p->ipn_data['tax'] . ", " . $p->ipn_data['first_name'] . ", " . $p->ipn_data['last_name'] . ", " . $p->ipn_data['payer_email'] . ", " . $p->ipn_data['address_street'] . ", " . $p->ipn_data['address_city'] . ", " . $p->ipn_data['address_state'] . ", " . $p->ipn_data['address_zip'] . ", " . $p->ipn_data['address_country_code'] . ", " . $p->ipn_data['address_status'] . ", " . $p->ipn_data['item_number'] . ", " . $p->ipn_data['quantity'] . ", " . $p->ipn_data['mc_currency'] . ", " . $p->ipn_data['payment_status'] . ", " . $p->ipn_data['payment_type'] . ") "); And I haven't even got to the ON DUPLICATE KEY update. Can anybody see the problem with my database entry 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.