Jump to content

samshel

Members
  • Posts

    837
  • Joined

  • Last visited

Everything posted by samshel

  1. Not sure if this is what u r looking for: 0) Back up table so if anything goes wrong, u r not in soup 1) Delete the 10800 row. 2) use the following ALTER command to reset the auto increment: ALTER TABLE `table_name` AUTO_INCREMENT=773
  2. SELECT job.id, jobtext, jobdate, job.name, category.name FROM job LEFT JOIN author ON author.id=job.authorid LEFT JOIN jobcategory ON(jobcategory.jobid = job.id) LEFT JOIN category ON (jobcategory.category_id = category.id)
  3. U guessed it ! Something like this.. SELECT job.id, jobtext, jobdate, name, category.name FROM job LEFT JOIN author ON author.id=job.authorid LEFT JOIN jobcategory ON(jobcategory.jobid = job.id) LEFT JOIN category ON (jobcategory.category_id = category.id)
  4. try this: <?php $arr = array( "Monday 11:50 AM", "Saturday 11:50 PM", "Saturday 11:58 PM", "Sunday 12:03 AM", "Sunday 12:15 AM" ); function changeTime(&$val, $key){ $val = strtotime($val) + 53; //add 53 seconds } //Convert the array into Linux time in seconds array_walk($arr, 'changeTime'); //sort array sort($arr); //Convert the current time into Linux time in seconds, include seconds in current time $currentTime = strtotime(date("l h:i:s A")); $intCount = 0; //loop through the array till you find a value greater than current time. while($arr[$intCount] < $currentTime) { $intCount++; } echo date("l h:i A", $arr[$intCount]); ?> 2 Changes: 1) add 53 seconds inside the changeTime function. 2) Use seconds as well when converting current time into Linux seconds. Thanks Sam
  5. Sorry if i missed something but u are base64_decoding the image after retrieving, but not base64_encoding before storing ?
  6. Good for you !! have some food and mark this as solved !
  7. What version of PHP are you using ? http://php.net/manual/en/function.array-merge.php Make sure both parameters are array, else type cast them to be on the safe side.
  8. FYI, The above code is updating your array and converting into Linux time. If you need to re-use the array in original format later in the script, do the above calculations on an array copy.
  9. try this: <?php $arr = array( "Monday 11:50 AM", "Saturday 11:50 PM", "Saturday 11:58 PM", "Sunday 12:03 AM", "Sunday 12:15 AM" ); function changeTime(&$val, $key){ $val = strtotime($val); } //Convert the array into Linux time in seconds array_walk($arr, 'changeTime'); //sort array sort($arr); //Convert the current time into Linux time in seconds $currentTime = strtotime(date("l h:i A")); $intCount = 0; //loop through the array till you find a value greater than current time. while($arr[$intCount] < $currentTime) { $intCount++; } echo date("l h:i A", $arr[$intCount]); ?>
  10. <?php $str = "Sameer"; //convert string in array $arr = str_split($str); $arrMod = array(); for($intCount=0;$intCount<count($arr);$intCount++){ //Find Ascii Value $intAscii = ord($arr[$intCount]); //If a or A, make it z or Z if($intAscii == 97) $strMod = "z"; else if($intAscii == 65) $strMod = "Z"; //else find charachter with ascii value 1 less than current else $strMod = chr($intAscii-1); $arrMod[$intCount] = $strMod; } $strMod = implode($arrMod); echo $strMod; ?> just another way
  11. I mean the actual records in your table: Like AmountDue Amount1RS TotalCollected 100 Balance Due 0 100 100
  12. please post sample records in the table and expected output in simple words.
  13. Where is $id defined ? - Also echo the query and directly fire it on DB console to see if you see any errors - Use mysql_error() to debug <?php include("db.inc.php"); //connects to database $result2 = mysql_query("SELECT messid,message,from,read,date FROM messages WHERE id = '$id'") or die (mysql_error()); // line 36 while ($row2 = mysql_fetch_row($result2)) { // line 37 $message = $row2[1]; // line 38 echo "$message"; // line 39 } // line 40 ?>
  14. Try this: //Bring this statement out of while $_SESSION['MONEYOWED'] = "0.00"; while($ckdue =mysql_fetch_array($ckifdue)){ //remove if else, even if amount due is 0, it will add 0 $_SESSION['MONEYOWED'] = $_SESSION['MONEYOWED'] + $ckdue['AmountDue']; Keep the remaining code as it is.
  15. Does the following query return any records: SELECT * FROM r_rost_rma JOIN teamy ON r_rost_rma.student_id = teamy.student_id SET r_rost_rma.teachername = teamy.team WHERE RTRIM( UPPER( r_rost_rma.localcourse ) ) = 'HOMEROOM'
  16. try type casting them to integer: if((int) $index == (int) $index1)
  17. Use $result = mysql_query($query) or die($query."==".mysql_error()); It will tell u whats going wrong.
  18. Hi All, Does Zend framework support multiple controllers hosted on different servers talking to the centralized same model/view. Is it feasible ? Please feel free to provide comments on pros or cons of this approach. Thanks SamShel
  19. try adding urlencode() for the file name.
  20. r u sure the following query is returning any records from the DB ? SELECT * FROM `home` WHERE id = '1'
  21. $commonFields = array ('bed','bath','school'); $fieldNames = array ('Lisitng File #', 'Chain Y/N', 'Bedrooms', 'Half Baths', 'School District'); $arrMatches = array(); foreach ($fieldNames as $field) { foreach ($commonFields as $commonfield) { if(eregi($commonfield, $field)) $arrMatches[] = $field; } } print_r($arrMatches); not tested. Also i assume u must have thought about this and were looking for a shorter way, but still trying
  22. Opening up your database and allowing firing of any queries is as good as giving complete access of the database. They can fire the delete, drop and other harmful queries. What i suggest u need is a webservice. Which will host all the functions that they want to do. For example, if they want to update thier own details, you can expose a function called updateUser which will check the username, password and update the database. This way the queries stay with u and ur database is safe. Apologies if i misunderstood ur requirements Sam
  23. !== will compare the value as well as the data type.
  24. you can calculate the one year old date in PHP by $timstamp = time() - 315369000; And use that time stamp in the query $sql = "SELECT * FROM user WHERE lastvisit > '".$dt."'";
  25. if(!isset($_SESSION) || $_SESSION !== true){ header('Location: log.php'); } try changing to if(!isset($_SESSION)){ header('Location: log.php'); }
×
×
  • 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.