Jump to content

DasHaas

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by DasHaas

  1. you lost me but, I'll study up on it lol. Thanks again for the help!
  2. your a genius, it worked like a champ!!! thanks a million. Is it possible to update the table whenever someone clicks on the image
  3. I have the following code that displays an ad at the top of my webpage. I would like to add an update statement that updates a field in my table for the cooresponding ad whenever the ad is displayed. Here is what I have so far: <?php // includes include('includes/PXS_Conf.php'); // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to MySql server!'); // select database mysql_select_db($db) or die ('Unable to select database!'); // generate and execute query $query = "SELECT id,HREF, SRC, ALT FROM PXS_Ads WHERE status = 1 and type =1 and impressions_left >0 ORDER BY RAND() LIMIT 1"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); while ($row = mysql_fetch_object($result)) { $HREF = "$row->HREF"; $SRC = "$row->SRC"; $ALT = "$row->ALT"; ?> <table width="729" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td scope="col"><a href='<?php echo($HREF); ?>'><img src='<?php echo($SRC); ?>' name='<?php echo($ALT); ?>' border=0></a></td> <?php } //close connection mysql_close($connection); ?> This works fine but I also want to update the impressions_left to impressions_left-1, so when the impressions_left field = 0 the ad will no longer be displayed
  4. i figured it out! SELECT...FROM...WHERE...ORDER BY...LIMIT 1
  5. i hope to eventually have lots of ads so i dont think the rand(0,9); will work unless I keep updating the code with the amount of ads that I have. Thanks a million for your help, i'll give it a shot anyway
  6. im sure this is an easy one to solve, but I cant seem to figure it out. Im got the ads to show but it shows all the ads in my database and is looks horrible. I would like to display only one ad at a time. here is my code: <?php $query = "SELECT HREF, SRC, ALT FROM PXS_Ads WHERE status = 1 and impressions_left>0 ORDER BY RAND()"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); while ($row = mysql_fetch_object($result)) { $HREF = "$row->HREF"; $SRC = "$row->SRC"; $ALT = "$row->ALT"; ?> <table width="729" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td scope="col"><a href='<?php echo($HREF); ?>'><img src='<?php echo($SRC); ?>' name='<?php echo($ALT); ?>' border=0></a></td> <?php }//close while; //continue code ?> any elp would be greatly appreciated
  7. no dice dude, I tried adding the \r\n but it still wont change the from address. I looked at the link you sent me and it seems like there are several ways to code the from header. I am not sure which one i should be using
  8. I cant get the From email address to pass through to the email recipients. The emails keep showing my domain as the sender. Any help on this would be greatly appreciated. $headers .="From: email@myserver.com\n"; $headers .="Reply-To: reply@myservers.com\n"; mail($email, $msgsubject, $msgbody, $headers); As mentioned above the recipients see myserver.cm as the sender, I would like to change that to email@myserver.com or better yet my name.
  9. Thanks, I got it to work with this: <?php include('../Includes/PXS_Conf.php'); // check for record ID if ((!isset($_GET['id']) || trim($_GET['id']) == '')) { die('Missing Backup ID!'); } // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to MySql server! Please contact PXS customer support.'); // select database mysql_select_db($db) or die ('Unable to select database! Please contact PXS customer support.'); $id = $_GET['id']; $qry = "SELECT * FROM PXS_BackupDesc WHERE id = '$id'"; $rst = mysql_query($qry) or die ("Error in query: $qry. " . mysql_error()); $row_result = mysql_fetch_assoc($rst); $path = '../backup/'.$row_result['file']; if (!unlink($path)) { echo ("Error deleting $path"); } else { // generate and execute query $query = "DELETE FROM PXS_BackupDesc WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // close database connection mysql_close($connection); // print result echo '<center><a href=PXS_Restore.php>Deletion successful click here to go back to the backup list</a></center>'; } ?>
  10. Im trying to delete a file, then delete the row in my table that holds the info for this file. I tried the code below and got this error: Parse error: parse error, unexpected T_STRING in /nfs/cust/4/97/13/731794/web/Admin/backup/PXS_DeleteBackup.php on line 34 Here is my code, any help would be greatly appreciated ??? <?php include('../Includes/PXS_Conf.php'); // check for record ID if ((!isset($_GET['id']) || trim($_GET['id']) == '')) { die('Missing Backup ID!'); } // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to MySql server! Please contact PXS customer support.'); // select database mysql_select_db($db) or die ('Unable to select database! Please contact PXS customer support.'); $id = $_GET['id']; $qry = "SELECT filename FROM PXS_BackupDesc WHERE id = '$id'"; $rst = mysql_query($qry) or die ("Error in query: $qry. " . mysql_error()); while($row = mysql_fetch_object($rst)) $filename = $row->filename unlink($filename); // generate and execute query $query = "DELETE FROM PXS_BackupDesc WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // close database connection mysql_close($connection); // print result echo '<center><a href=PXS_Restore.php>Deletion successful click here to go back to the backup list</a></center>'; ?>
  11. Maybe I will give them a call and see if they can modify the config file, i dont think they will but its worth a try
  12. Its not my server, I am using a gate.com server that has PHP and MySql installed. I dont think I have access to the config file
  13. pfft it worked it just took a few minutes to send to the second email address. DO you think this lag wil be multiplied once I have 100+ email addresses in the database?
  14. still only sends the email to one recipient. It seems to be sending the email only to the first entry in the database ???
  15. Im trying to send emails to all the email addresses in my database table. My table currently has 3 test emails but the script below only send the email to one of the email addresses. What do I need to modify to make it send to all email addresses in the table? $query = mysql_query("SELECT email FROM PXS_Newsletter WHERE verified = 1") or die (mysql_error()); while($row=mysql_fetch_row($query)) $email = $row[0]; $To = $email; $Subject = $msgsubject; $Body = $msgbody; mail($To, $Subject, $Body);
  16. I made the changes that Wildbug posted and I got the following error: Error in query: INSERT INTO PXS_Links(site_name, site_url, compiled_url) VALUES(Myspace, www.myspace.com,Myspace). 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 'Myspace)' a <html> <head> <link href="css/StyleSheet1.css" rel="stylesheet" type="text/css"> <body> <!-- standard page header begins --> <table width="100%" class="table1"> <tr> <td><div align="center" class="text2">Add Links </div></td> </tr> </table<br> <!-- standard page header ends --> <?php // form not yet submitted // display initial form if (!$_POST['submit']) { ?> <table cellpadding="5" cellspacing="5" class="table1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <tr> <td valign="top"><b class="text5"><font size="-1">Site Name </font></b></td> <td> <input name="txtname" type="text" class="table2" id="txtname" value="ex. Yahoo" size="50" maxlength="250"> </td> </tr> <tr> <td valign="top"><b class="text5"><font size="-1">Site URL </font></b></td> <td><input name="txturl" type="text" class="table2" id="txturl" value="ex. www.yahoo.com" size="50" maxlength="250"></td> </tr> <tr> <td colspan="2" valign="top"><input type="Submit" name="submit" value="Add"> <input type="reset" name="Reset" value="Reset"></td> </tr> </form> </table> <?php } else { // includes include('Includes/PXS_Conf.php'); // set up error list array $errorList = array(); $name = $_POST['txtname']; $url = $_POST['txturl']; // validate text input fields if (trim($_POST['txtname']) == '') { $errorList[] = 'Invalid entry: Site Name'; } if (trim($_POST['txturl']) == '') { $errorList[] = "Invalid entry: Site Url"; } // check for errors // if none found... if (sizeof($errorList) == 0) { // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to MySql server! Please contact PXS customer support.'); // select database mysql_select_db($db) or die ('Unable to select database! Please contact PXS customer support.'); //set link url $compurl = "<a href=\"http://$txturl\" target=\"_blank\">$txtname</a>"; // generate and execute query $query = "INSERT INTO PXS_Links(site_name, site_url, compiled_url) VALUES($name, $url,$compurl)"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // close database connection mysql_close($connection); // print result echo '<center><a href=PXS_ListLinks.php>Addition successful click here to go back to the links list</a></center>'; } else { // errors found // print as list echo '<font size=-1>The following errors were encountered:'; echo '<br>'; echo '<ul>'; for ($x=0; $x<sizeof($errorList); $x++) { echo "<li>$errorList[$x]"; } echo '</ul></font>'; } } ?> <!-- standard page footer begins --> <br><table width="100%" class="table1"> <tr> <td><div align="center" class="text1"> <div align="center">Copyright © 2006 Projekt-X-Studios. All Rights Reserved </div> </div></td> </tr> </table> <!-- standard page footer ends --> </body> </html> any suggestions, I have been staring at this for the last 30 min and cant find the error :'( Im sure its something obvious but my brian is jello today ???
  17. question, there are three email addresses in the table but only one email address is getting the message. Would the zero in $email = $row[0]; have anything to do with that?
  18. how long do you think it will take to send the email to 100+ users? can i expect some lag time or should it be instant?
  19. Doh!! i forgot a line, I think its working now. Please excuse the noobness that oozes from my pores lol
  20. Im still getting the following error: sendmail: No recipients specified although -t option used Here is my code with the changes you gave me: <html> <head> <link href="css/StyleSheet1.css" rel="stylesheet" type="text/css"> <body> <!-- standard page header begins --> <table width="100%" class="table1"> <tr> <td><div align="center" class="text2">Send Email to newsletter subscribers </div></td> </tr> </table> <!-- standard page header ends --> <?php // form not yet submitted // display initial form if (!$_POST['submit']) { ?> <br> <table cellpadding="5" cellspacing="5" class="table1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <tr> <td valign="top" class="text5">Group</td> <td> </td> </tr> <tr> <td valign="top" class="text5">Subject</td> <td><input name="txtsubject" type="text" class="table2" id="txtsubject" size="50" maxlength="250"></td> </tr> <tr> <td valign="top" class="text5">Email Body</td> <td valign="top" class="text5"><textarea name="txtbody" cols="47" rows="10" class="table2" id="txtbody"></textarea></td> </tr> <tr> <td colspan="2" valign="top" class="text5"><input name="submit" type="submit" id="submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </form> </table><br> <br> <?php } else { // includes include('Includes/PXS_Conf.php'); // set up error list array $errorList = array(); $msgsubject = $_POST['txtsubject']; $msgbody = $_POST['txtbody']; // validate text input fields if (trim($_POST['txtsubject']) == '') { $errorList[] = 'Invalid entry: Message Subject'; } if (trim($_POST['txtbody']) == '') { $errorList[] = "Invalid entry: Message Body"; } // check for errors // if none found... if (sizeof($errorList) == 0) { // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to MySql server! Please contact PXS customer support.'); // select database mysql_select_db($db) or die ('Unable to select database! Please contact PXS customer support.'); // generate and execute query $query = mysql_query("SELECT email FROM PXS_Newsletter WHERE verified = 1") or die (mysql_error()); $email = $row[0]; // send email $To = $email; $Subject = "<".$msgsubject.">"; $Body = "<".$msgbody.">"; mail($To, $Subject, $Body); // print result echo '<center>Message sent</center>'; // close database connection mysql_close($connection); } else { // errors found // print as list echo '<font size=-1>The following errors were encountered:'; echo '<br>'; echo '<ul>'; for ($x=0; $x<sizeof($errorList); $x++) { echo "<li>$errorList[$x]"; } echo '</ul></font>'; } } ?> <!-- standard page footer begins --> <table width="100%" class="table1"> <tr> <td><div align="center" class="text1"> <div align="center">Copyright © 2006 Projekt-X-Studios. All Rights Reserved </div> </div></td> </tr> </table> </body> </html>
  21. Thanks for your help, I will give this a shot
×
×
  • 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.