Jump to content

samshel

Members
  • Posts

    837
  • Joined

  • Last visited

Everything posted by samshel

  1. just check if paypal redirects to this only in case of payment success and not when payment fails or is cancelled, i m sure u must have thought about this, but just double checking
  2. try mysql_fetch_assoc() instead of mysql_fetch_array()
  3. <?php $con = mysql_connect("CONNECTION"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("bssql", $con); $result = mysql_query("SELECT title, subtitle FROM articles ORDER BY ID DESC LIMIT 2") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo $row['Title']; echo $row['SubTitle']; } mysql_close($con); ?> try this..
  4. i m not sure why that doesnt work. but what u r doing can be achieved by the following code too.. <?php $ans = "ftp"; $operator = true; if ( eregi( 'ftp', $_GET['bg'] )) { $operator = true; echo "$operator"; echo "<br>"; } else { $operator = false; echo "$operator"; echo "<br>"; } if (eregi('ftp', $ans) == $operator) { echo "matched"; } else { echo "not matched"; } ?>
  5. strange...LIMIT n1,n2 always worked for me.. may be u can try it and post what it does ?
  6. if ($num_rows != 1 ){ ... } else { } $num_rows--; try putting the decreament after the if else condition. u need to decrement after u check it. and i think u need to check for 1, rather than 0 for last record.
  7. u can format the timestamp any way u like...take a look at http://us.php.net/manual/en/function.date.php for updating date in database from JS, u can search for AJAX functionality on google. hope thats what u r looking for.
  8. <?php $arr = array(734.5369,250.2526, 0, 0, "1,007.5307", "1,026.2838", 0.8281, 0.7834); $cnt = count($arr); $newarr = array(); for($i=0;$i<$cnt;$i++) { $newarr[] = str_replace(",", "", $arr[$i]); } print_r($newarr); ?> this works for me...
  9. //return in_array(end(explode(".", $fileName)), $allowedExtensions); //break this line to debug.. //is it exploding as expexted? print_r(explode(".", $fileName)); //is it returning extension properly echo end(explode(".", $fileName); //check case as in_array() is case sensitive..you can try to lowercase ur extension before comparing return in_array(end(explode(".", $fileName)), $allowedExtensions);
  10. $logged_in = $_SESSION['username']; ur code probably should have something like this before the lines u posted. make sure this line is included too in all frame files.
  11. if u can post the array before sorting and desired output array after sorting, it will be easy, may be there is a simpler approach. if not this approach will be still here
  12. thats the only possible reason, either a whitespace or a newline char..
  13. not sure if u can make it faster, but u can definitely reduce the lines of code.. <ul> <?php for($i=1; $i>=-5; $i--) { $today = date("z",(time()-3600))+$i; ?> <li><? INCLUDE "/usr/home/bcmurray/public_html/features/$today.txt";?></li> <?php } ?> </ul> PS: the code is not tested.. beaten by Mchl
  14. <?php $month_list = array(); for( $i=1;$i<13;$i++) { $month_list[$i] = date("F", mktime(0, 0, 0, $i, 1, 2008)); } print_r($month_list); $newmonthlist = $month_list; foreach($newmonthlist as $monthnumber=>$month) { if( $monthnumber < date("n")) { unset($newmonthlist[$monthnumber]); $newmonthlist[$monthnumber] = $month; } } echo "<br>"; print_r( $newmonthlist); ?> this should work for you... PS: we unsetting the months and setting the same values to them again in next line, but the difference here is it is an associative array and it will add elements at the bottom, so when u foreach they will come last... I have tried to imitate your month list, just fill it in with ur variable.
  15. this might help...not sure http://net.tutsplus.com/videos/screencasts/create-a-photo-admin-site-using-php-and-jquery/
  16. "from" is a keyword in MySQL. dont use it as a field. If u insist, try using it with backticks. but u will have to do this everytime you refer to that field. I prefer this.. mysql_query("CREATE TABLE $username1( message_from VARCHAR(50), message TEXT, date VARCHAR(50), time VARCHAR(50), dt VARCHAR(50), dt2 VARCHAR(50))") or die(mysql_error()); But this will also work. mysql_query("CREATE TABLE $username1( `from` VARCHAR(50), `message` TEXT, `date` VARCHAR(50), `time` VARCHAR(50), `dt` VARCHAR(50), `dt2` VARCHAR(50))") or die(mysql_error()); beaten by wildteen
  17. eval () works only for PHP code not HTML. i think u can achieve what u want using just simple include(). include ur file wherever u want and the code will be executed perfectly.
  18. may be the zip extension is not enabled on ur new server. please check. u can see it in phpinfo() if u dont have access to php.ini
  19. try posting it in mysql forum, u will get better response this is PHP forum..
  20. i think u can achieve this by the following method... include ("http://www.website.com/path_to_file/includedfile.php"); while including use URL to include, this will be as good as firing system command and creating seperating instances of the included file..without system dependency. how ever this will work if you included file echoes out something... i m not sure whether it will work or not..but worth a try i guess.... PS: for this to work, all ur included files should be in the web enabled directory...
  21. it should work..try this <?php /*creates a new url with variable to send to justthisday.php*/ session_start(); $days = $_GET["days"]; echo $days; //header("Location: http://www.mysite.com/test/anotherpage.php?days=".$days); ?> if $days is echoed properly, comment echo and uncomment line below.
  22. the error speaks for itself, it is not able to connect to mysql as user/password are not correct.
  23. <?php $var = "xxx"; $var2 = "yyy"; if(empty($var)) { if(empty($var2)) { echo 'Both 1 and 2 are Empty !!'; } else { echo '1 is Empty !!'; } } else { if(empty($var2)) { echo '2 is Empty !!'; } else { echo 'Both 1 and 2 are not Empty !!'; } } ?>
×
×
  • 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.