Jump to content

taquitosensei

Members
  • Posts

    676
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by taquitosensei

  1. I would put the number of rows before the loop $shows = mysql_query("SELECT * FROM tblConcert WHERE fkBandID = '$pk' AND fldConcertDate >= CURDATE() ORDER BY fldConcertDate", $db); $numRows = mysql_num_rows($shows); if($numRows == 0){ echo "<p>No upcoming shows for $show[fldBand]. <a href='#'>Know of one?</a></p>"; } else { while($show = mysql_fetch_array($shows, MYSQL_ASSOC)){ $date = date("F j, Y",strtotime($show[fldConcertDate])); }
  2. if it's a date or datetime field in MySQL it's Y-m-d H:i:s format it before you insert $date_field=date("Y-m-d", strtotime($date)); $sql="insert into yourtable(datefield) values('$date_field')";
  3. I would use a pre-built class for sending mail, makes it much easier, you can configure an SMTP server with authentication. I use pear's http://pear.php.net/package/Mail
  4. Try this $sql = "SELECT clients.company, clients.client_id, contacts.client_id, contacts.name, contacts.contact_id, contact_coms.contact_id, contact_coms.com_content ". "FROM clients JOIN contacts on clients.client_id=contacts.client_id LEFT JOIN contact_coms on contacts.contact_id=contact_coms.contact_id where clients.ctype=2"; the easiest way to think of a left join is, you're selecting all records on the table listed to the left of "LEFT JOIN" and the table listed to the right of LEFT JOIN will show an empty record if there isn't a match.
  5. If you're going to get more than 1 result. If Sect1_6 isn't a unique index. Then you need to loop through the mysqlresults. But that doesn't quite work with the header redirection. list($name, $domain) = explode("@", $email); $error = mysql_query("SELECT `Sect1_6`,`Sect1_7d`,`CompanyID` FROM tblDirectory2 WHERE `Sect1_6`='$email'") or die(mysql_error()); $errorID = mysql_fetch_array($error); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emailcheck=$row['Sect1_6']; list($name, $domaincheck) = explode("@", $emailcheck); $postcode = strtoupper($_POST["Sect1_7d"]); $postcodecheck = strtoupper($errorID["Sect1_7d"]); if ($domaincheck == $domain || $postcodecheck == $postcode) { header("Location: /new_directory/completed.php?ID=".$errorID["CompanyID"].""); exit(); } [/code] I would also put the code exploding $email outside of the loop so that you're not exploding it every instance through the loop. If it's going to be a single result then this would probably get you close $email = $_POST["Sect1_6"]; $error = mysql_query("SELECT `Sect1_6`,`Sect1_7d`,`CompanyID` FROM tblDirectory2 WHERE `Sect1_6`='$email'") or die(mysql_error()); $errorID = mysql_fetch_array($error,MYSQL_NUM); // This gives you a numeric indexed array $emailcheck = $errorID[0]["Sect1_6"]; // notice the 0 list($name, $domain) = explode("@", $email); list($name, $domaincheck) = explode("@", $emailcheck); $postcode = strtoupper($_POST["Sect1_7d"]); $postcodecheck = strtoupper($errorID[0]["Sect1_7d"]); // Notice the 0 if ($domaincheck == $domain || $postcodecheck == $postcode) { header("Location: /new_directory/completed.php?ID=".$errorID["CompanyID"].""); exit(); }
  6. That's the point of the function I posted it's recursive and checks to see if the folder exists or not.
  7. They're probably tabs try str_replace("\t","", $s);
  8. You're missing a step check out http://www.tizag.com/mysqlTutorial/mysqlquery.php This should help
  9. use sessions at the top of each page that's not an include put session_start(); then just do $_SESSION['whatever']="whatever"; then you can access that from any page that you put the session_start on.
  10. I would do it this way <?php $sql = "SELECT * FROM tblUsers"; require("../connection.php"); $rs=mysql_db_query($DBname,$sql,$link) or die(mysql_error()); while($row = mysql_fetch_assoc($rs)) { $users[] = $row['usrID']; } echo implode(",", $users);
  11. best way would be to write your own functions $response=myOwnSplit($string, $count, $interval); $arrays function myOwnSplit($string,$count,$interval) { $array=split(" ",$string); $counter=floor(count($array)/$count); for($a=0;$a<$counter;$a++) { $response=""; for($b=1;$b<=$interval;$b++) { $response.=$array[$a][$b]; } $responses[]=$response; } return $response; } that should get you pretty damn close. You might have to tweak it a bit. That's just off the top of my head.
  12. this if($getdate = "20day") { $day = 30; $sql = "SELECT * FROM comments WHERE date(CURDATE(), INTERVAL '$day' DAY) <= $todaysdate"; //date = column field in table echo $sql; } should be this if($getdate == "20day") { $day = 30; $sql = "SELECT * FROM comments WHERE date(CURDATE(), INTERVAL '$day' DAY) <= $todaysdate"; //date = column field in table echo $sql; } as a comparison the equals sign needs to be a double or if you're also comparing type it's a triple. Not sure about the syntax on the query.
  13. how about posting all the code, because at some point the Name equals "-4"
  14. echo out your variables and make sure they're right. Because in windows you can't create a "-4" folder. That's what causing the problem. The function I put up there would work fine if the folder name was valid. echo "Username: ".$username."<br>"; echo "Name_Artist: ".$name_artist."<br>";
  15. $sql = mysql_query("SELECT * FROM consultant WHERE email_address = '$email_address'"); if (mysql_num_rows($sql) == 0) { // This is if the e-mail is not in the database } else { $error=True; $errormessage="That e-mail is already in the database"; header("Location: addconsultantform.php?error=".$error."&message=".$message); } [/code] then in addconsultantform.php check for the error and message if(isset($_GET['error']) && $_GET['error']) { echo $_GET['error']; }
  16. That's fine is_dir(dirname($pathname)) || mkdir_recursive(dirname($pathname), $mode); if it's a directory or it can make directory it moves on to the next
  17. Here's a function to handle this function mkdir_recursive($pathname, $mode) { is_dir(dirname($pathname)) || mkdir_recursive(dirname($pathname), $mode); return is_dir($pathname) || @mkdir($pathname, $mode); } then you would use it like this $old=umask(0); $path="users/".$username."/".$name_artist."/images/tumbs",0777); mkdir_recursive($path, 0777); umask($old);
  18. You're not passing $error in the header try this $error = $_POST['error']; header("Location: addconsultantform.php?error=".$error); otherwise your $_GET['error'] doesn't exist
  19. something along these lines $sql="select field1,field2 from table where date_format(datecolumn,'%Y-%m-%d') > '".date("Y-m-d", strtotime("-7 days"))."'"; would get you all the posts in the past 7 days "-1 Days" would get you yesterday "-30 Days" would get you last 30 days this would get last months $sql="select field1,field2 from table where date_format(datecolumn,'%Y-%m-%d')='".date("Y-m",strtotime("-1 Month"))."'";
  20. Just before the if state put this echo "10 Days from now: ".date("m-d-Y",strtotime(+10 Days))."<br>"; echo "Expiration Date: ".$expire; to make sure that the expiration date variable is 10 days or 15 days whichever you're using, from today and that they're the same format.
  21. I would do this if(date("Y-m-d", strtotime("+10 days"))==date("Y-m-d", strtotime($expire))) { echo 'Renew Link'; } or +15 days
  22. try print_r($_POST) at the top of your page to make sure it's being posted. if it's not then make sure that your form is set to post and not get <form action='whatever.php' method='post'> double check to make sure your form opening and closing tags are in the right place
  23. If you change your checkboxes to this echo "<input type='checkbox' value='' name='room[]' />$row[Room_ID]<br/> "; then it will be an array so you can do this foreach($_POST['room'] as $room) { echo $name; }
  24. Try this $result_actions = mysql_query("SELECT *,actions.id as actionsid, contacts.id as contactid FROM actions JOIN contacts ON(actions.contact_id = contacts.id) WHERE date_of_reminder = '$today' AND send_reminder='Y' AND complete='N' ORDER BY contact_id"); while ($row_actions = mysql_fetch_assoc($result_actions)) { echo $row_actions["actionsid"] . $row_actions["contactid"]; }
×
×
  • 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.