Jump to content

ziggy_909

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ziggy_909's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. is there an easy way to add weekdays to a stored date ... so far i have echo date ( 'Y-m-j' , strtotime ( '5 weekdays' ) ); this adds 5 weekdays to the current date , can i have it add 5 weekdays to say $TableDate 1; Thanks in advance...
  2. i have this code to set a date to the 1st of the previous month -- SELECT DATE_FORMAT(DATE_SUB(tbl_col, INTERVAL 1 MONTH), '%Y-%m-01') FROM table can it be changed to set date to first Monday in that month...?
  3. thanks that worked a treat... another quick question? is there a way to return the first working day of the month ie if the 01st is a sunday return 02nd instead
  4. DATE_SUB(tbl_col, INTERVAL 1 MONTH), this will remove 1 month from the date... date_sub(tbl_co, interval day(tbl_col)-1 day) this will display date as 1st day of the month is there a way to combine both?
  5. for the returned date from the db .. i need to display it in a table as the 01-previous month- same year eg returned date 2009-12-24 is displayed as 2009-11-01 returned date 2010-06-02 is displayed as 2010-05-01
  6. i need to get dates from my database and return the dates as the 1st of the previous month... ie 2010-12-17 will return as 2010-11-01 any ideas please....
  7. Use AJAX or, if you don't mind the page refresh, something that isn't a #. never used AJAX before if you could point me kindly in the right direction... also refresh isn't a problem.. what else can i use instead of the # as its not possible to use the full url in my case.
  8. Hi I'm using this piece of code to post back an 'id' to the same page that it came from... my problem is extracting 'id' from the url .. upon researching i believe php cant read anything after the #'hash' symbol.. is there another way to post to same page with out the hash symbol .. <a href="#?id=<?php echo $row['issues_id']; ?>"><img src="/update.jpg" alt="update" width="16" height="16" border="0" /></a> thanks in advance...
  9. connection is fine .. can read records .. but can't delete ... any ideas.. <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="test"; // Database name $tbl_name="test_mysql"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td><form name="form1" method="post" action=""> <table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td bgcolor="#FFFFFF"> </td> <td colspan="4" bgcolor="#FFFFFF"><strong>Delete multiple rows in mysql</strong> </td> </tr> <tr> <td align="center" bgcolor="#FFFFFF">#</td> <td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Lastname</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Email</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td> <td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['name']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['lastname']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['email']; ?></td> </tr> <?php } ?> <tr> <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> <? // Check if delete button active, start this if($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM $tbl_name WHERE id='$del_id'"; $result = mysql_query($sql); } // if successful redirect to delete_multiple.php if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete_multiple.php\">"; } } mysql_close(); ?> </table> </form> </td> </tr> </table> Mod edit: . . . tags added.
×
×
  • 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.