-
Posts
837 -
Joined
-
Last visited
Posts posted by samshel
-
-
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)
-
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)
-
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
-
Sorry if i missed something but u are base64_decoding the image after retrieving, but not base64_encoding before storing ?
-
Good for you !! have some food and mark this as solved !
-
What version of PHP are you using ?
http://php.net/manual/en/function.array-merge.php
Warning
The behavior of array_merge() was modified in PHP 5. Unlike PHP 4, array_merge() now only accepts parameters of type array. However, you can use typecasting to merge other types. See the example below for details.
Make sure both parameters are array, else type cast them to be on the safe side.
-
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.
-
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]); ?>
-
<?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
-
I mean the actual records in your table:
Like
AmountDue Amount1RS TotalCollected
100 Balance Due 0
100 100
-
please post sample records in the table and expected output in simple words.
-
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 ?>
-
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.
-
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'
-
try type casting them to integer:
if((int) $index == (int) $index1)
-
Use
$result = mysql_query($query) or die($query."==".mysql_error());
It will tell u whats going wrong.
-
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
-
try adding urlencode() for the file name.
-
r u sure the following query is returning any records from the DB ?
SELECT * FROM `home` WHERE id = '1'
-
$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
-
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
-
!== will compare the value as well as the data type.
-
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."'";
-
if(!isset($_SESSION) || $_SESSION !== true){ header('Location: log.php'); }
try changing to
if(!isset($_SESSION)){ header('Location: log.php'); }
auto increment ID
in PHP Coding Help
Posted
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