godrob Posted December 19, 2009 Share Posted December 19, 2009 Hi Guys, I could really do with some help here please. I've just switched webhosts and using MYSQL5 instead of MYSQL4. Trouble is I now receive the following error: Warning: date() expects parameter 2 to be long, string given in... The error points to this line of code: if($_expires==''){$_expires='n/a';}else{$_expires=date('d M Y', $_expires);} Can somebody be so kind as to tell me what I need to change to resolve this? Thanks in advance Regards Rob. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/ Share on other sites More sharing options...
rajivgonsalves Posted December 19, 2009 Share Posted December 19, 2009 there second parameter is long most probably your $_expires is not set, change this if($_expires==''){$_expires='n/a';}else{$_expires=date('d M Y', $_expires);} to if(empty($_expires){$_expires='n/a';}else{$_expires=date('d M Y', $_expires);} Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-980515 Share on other sites More sharing options...
godrob Posted December 19, 2009 Author Share Posted December 19, 2009 Thanks for your quick reply but I'm afraid that didn't work, it now errors with: Parse error: syntax error, unexpected '{' If it helps the whole code that this relates to is: $_expires = ($i['expires_date']); $dolifetime = ($i['expires_date']); if($_expires<=date("U") && $dolifetime!='life'){ $sql = "UPDATE pro_membersu_privchatf SET memberlevel='0', expires_date='' WHERE usrname = '$pro_name'";;mysql_query($sql); } if($_expires==''){$_expires='n/a';}else{$_expires=date('d M Y', $_expires);} $_show_profile = ($i['show_profile']); $_admin_check = ($i['admin_check']); Hope you can help me? Thanks again Rob Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-980522 Share on other sites More sharing options...
rajivgonsalves Posted December 19, 2009 Share Posted December 19, 2009 on seeing your code your variable is in date from so you could use strtotime, try this out however what is the content of $_expires <?php $_expires = ($i['expires_date']); $dolifetime = ($i['expires_date']); if($_expires<=date("U") && $dolifetime!='life'){ $sql = "UPDATE pro_membersu_privchatf SET memberlevel='0', expires_date='' WHERE usrname = '$pro_name'";;mysql_query($sql); } if(empty($_expires)){$_expires='n/a';}else{$_expires=date('d M Y', strtotime($_expires));} $_show_profile = ($i['show_profile']); $_admin_check = ($i['admin_check']); ?> Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-980526 Share on other sites More sharing options...
godrob Posted December 19, 2009 Author Share Posted December 19, 2009 Thank you so much That's fixed it. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-980528 Share on other sites More sharing options...
godrob Posted December 29, 2009 Author Share Posted December 29, 2009 Well I thought my issue had been resolved but it turns out that I think it just masked the problem The issue now is that although I no longer receive the error: Warning: date() expects parameter 2 to be long, string given in... I instead get the wrong expiry date of a membership when called using: <?=$_expires?> The above returns 31/12/1969 even though the correct date is correctly stored in the MYSQL table and expires correctly when the expiry date is then reached. Please can somebody help me resolve this? Thanks for any assistance Regards Rob. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985405 Share on other sites More sharing options...
Buddski Posted December 29, 2009 Share Posted December 29, 2009 when you echo $_expires what is returned? $_expires = ($i['expires_date']); echo $_expires; Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985408 Share on other sites More sharing options...
godrob Posted December 29, 2009 Author Share Posted December 29, 2009 Hi Buddski, Thanks for your quick reply. By echoing $_expires nothing is retuned... If it helps here is the code that orginally displayed the expiry date of a membership that was stored in a MYSQL4 database: <!-- Membership Status --> <?php if($dolifetime!='life'){?> <table valign="top" cellspacing="0" width="160" border="0" cellpadding="0"> <tr><td height="12" valign="top" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Membership Status</div></div></td></tr></table> <div align="left"></div> <table valign="top" cellspacing="0" width="160" class="table_border" height="40" border="0"> <tr valign=top><td align="left" class="table_body"> <br> <font color="GREEN">»</font> <a href="lto.php"><font size="2">Upgrade Membership</a></font> <br> <br> <font size="2">Level: <?=$_level?> <?=$lang_members_35?></font><br> <font size="2">Expiry: <a href="lto.php"><font color="RED"><?=$_expires?></a></font><br> <a href="your-premium-membership.php"><font size="1">What's This?</a></font> <br> <br> </td></tr> </table> <?php }else{?> <table valign="top" cellspacing="0" width="160" border="0" cellpadding="0"> <tr><td height="12" valign="top" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Membership Status</div></div></td></tr></table> <table valign="top" cellspacing="0" width="160" class="table_border" height="40" border="0"> <tr valign=middle><td class="table_body" align="center"> <img src="lifetime-chatter.jpg" /> </td></tr> </table> <?php }?> However, now that we're on a MYSQL5 database the incorrect date is shown Thanks for any help you can offer Regards Rob. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985434 Share on other sites More sharing options...
Buddski Posted December 29, 2009 Share Posted December 29, 2009 If when you echo the value out there is nothing there, strtotime will convert nothing to a time which is still nothing.. There is obviously a problem with the values coming from the database.. ie. $i['expires_date'] is empty.. Can you show us the code that sets the $i variable. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985437 Share on other sites More sharing options...
godrob Posted December 29, 2009 Author Share Posted December 29, 2009 Hi Buddski, Thanks again for your reply. I'm afraid I am not a programer, however I did find this which is located in the admin area when I upgrade a membership: <?php $is_enabled=='0'; // set to 0 for testing if ($u=='1'){ if ($duration!=''){ if($duration!='life'){ $expires_date = date('U', strtotime('+'.$duration.' days')); $mlevel='1'; }else{ $expires_date = $duration; $mlevel='1'; } }else{ $expires_date=''; $mlevel='0'; } $sql = "UPDATE pro_membersu_privchatf SET memberlevel = '$mlevel', expires_date = '$expires_date' WHERE usrname = '$usrname'";;mysql_query($sql); $updated = '1'; } ?> Does that help? Thanks again Regards Rob Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985445 Share on other sites More sharing options...
Buddski Posted December 29, 2009 Share Posted December 29, 2009 thats not it.. you need to find where $i['expires_date'] is set.. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985447 Share on other sites More sharing options...
PFMaBiSmAd Posted December 29, 2009 Share Posted December 29, 2009 Can you show us the code that sets the $i variable. That would be the code immediately prior to the code you posted in reply #2. Post the code from the point where the database connection was made up to the line $_expires = ($i['expires_date']); Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985451 Share on other sites More sharing options...
godrob Posted December 29, 2009 Author Share Posted December 29, 2009 Sorry about this guys: here's the complete code: <?php $view_page='members_area'; include_once 'includes/config.php'; include_once 'includes/session.php'; include 'languages/default/'.C_LANG.'.php'; if ($action=='delete' && $confirm=='1'){ setcookie("pro_pass", "", 0, "/"); setcookie("pro_name", "", 0, "/"); setcookie("pro_id", "", 0, "/"); setcookie("reme", "", time()-30758400, "/"); } include_once 'templates/header.php'; include 'layout/menubar.php'; if ($action=='delete' && $confirm=='1'){include_once 'delete.php';} // change profile status - show/hide if($show_profile=='1' || $hide_profile=='1'){ if($show_profile=='1'){$change_status='1';$change_online='Online';$change_photo='1';$change_blog='1';$change_fav='1';} if($hide_profile=='1'){$change_status='0';$change_online='Offline';$change_photo='0';$change_blog='0';$change_fav='0';} $sql = "UPDATE pro_membersu_privchatf SET show_profile='$change_status' WHERE usrname = '$pro_name'";;mysql_query($sql); $sql = "UPDATE pro_membersu_privchatd SET show_online='$change_online' WHERE membername = '$pro_name'";;mysql_query($sql); $sql = "UPDATE pro_membersu_photos SET show_photo='$change_photo' WHERE membername = '$pro_name'";;mysql_query($sql); $sql = "UPDATE pro_membersu_guestbook SET show_blog='$change_blog' WHERE postbyname = '$pro_name'";;mysql_query($sql); $sql = "UPDATE pro_membersu_privchatg SET show_favourite='$change_fav' WHERE contact_name = '$pro_name'";;mysql_query($sql); } // members details $tmp=mysql_query("SELECT DISTINCT * FROM pro_membersu_privchatf WHERE id = '$pro_id' LIMIT 1"); while($i=mysql_fetch_array($tmp)) { $_level = ($i['memberlevel']);if($_level=='1'){$_level=$lang_members_1;}else{$_level=$lang_members_2;} $_expires = ($i['expires_date']); $dolifetime = ($i['expires_date']); if($_expires<=date("U") && $dolifetime!='life'){ $sql = "UPDATE pro_membersu_privchatf SET memberlevel='0', expires_date='' WHERE usrname = '$pro_name'";;mysql_query($sql); } if(empty($_expires)){$_expires='n/a';}else{$_expires=date('d M Y', strtotime($_expires));} if($first_name ==''){$first_name = $pro_name;} $_show_profile = ($i['show_profile']); $_admin_check = ($i['admin_check']); } ?> <table class="table_body" width="800"><tr><td> <table width="780"><tr><td> <br> <table valign="top" width="780" border="0" cellspacing="0" cellpadding="0"> <table valign="top" width="780" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top" width="550"> <!-- News Ticker --> <table cellspacing="0" width="550" border="0" cellpadding="0"> <tr><td height="12" valign="top" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> News Ticker</div></div></td></tr></table> <table valign="top" cellspacing="0" width="548" class="table_border" height="20" border="0"> <tr valign=top><td class="table_body"> <iframe width="546" height="60" src="scroller_newstic.html" scrolling="No" frameborder="0" border="0"></iframe> </td> </tr> </table> <td valign="top" width="20"> <td valign="top" width="210"> <!-- Live Help --> <table cellspacing="0" width="210" border="0" cellpadding="0"> <tr valign=top><td class="table_body"> <!-- stardevelop.com Live Help International Copyright - All Rights Reserved //--> <!-- BEGIN Live Help HTML Code - NOT PERMITTED TO MODIFY IMAGE MAP/CODE/LINKS //--> <a href="/livehelp/index.php" target="_blank" onclick="openLiveHelp(); return false"><img src="/livehelp/include/status.php" id="LiveHelpStatus" name="LiveHelpStatus" border="0" alt="Live Help" onload="statusImagesLiveHelp[statusImagesLiveHelp.length] = this;"/></a> <!-- END Live Help HTML Code - NOT PERMITTED TO MODIFY IMAGE MAP/CODE/LINKS //--> </td></tr> </table> </tr></table> <br> <!-- Most Popular Members--> <table align="center" cellspacing="0" width="100%" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Senior Chatters Finest! Looking For Genuine Friendships, Then Start Here... </div></div></td></tr></table> <table cellspacing="0" cellpadding=2 width="100%" class="table_border" border="0"> <tr><td colspan="6" class="table_body_feedback"> </td></tr> <tr><td align="center" colspan="6" class="table_body_feedback">Click On A Profile Below And Send Senior Chatters Most Popular Members A Message. You're Almost Guaranteed A Reply!</td></tr> <tr><td colspan="6" class="table_body_feedback"> </td></tr> <tr><td align="center" colspan="6" class="table_body_feedback">Looking For A Specific Chat Friend? No Problem, <a href="browse_ext.php">Click Here</a> To Tailor Your Profile Search</td></tr> <tr><td colspan="6" class="table_body_feedback"> </td></tr> <tr> <? $tmp=mysql_query("SELECT DISTINCT * FROM pro_membersu_privchatf WHERE show_profile = '1' AND admin_check = '0' ORDER BY `profile_views` DESC LIMIT 6"); while($i=mysql_fetch_array($tmp)) { $_memberid = ($i['id']); $_membername = ($i['usrname']); $_photo = ($i['photo']); $_gender = ($i['gender']); $_age = ($i['age']); $_location = ($i['location']); ?> <td class="table_body_feedback" height="100" align=center width="16.7%"> <a href="profile.php?user=<?=$_membername?>"> <?if($_photo=='' && $_gender==$lang_browse_7){?> <img style="border-color: #4D443B" src="<?=C_URL?>/members/uploads/nopic_<?=$lang_browse_7s?>.jpg" height=90 border=1> <?}elseif($_photo=='' && $_gender==$lang_browse_{?> <img style="border-color: #4D443B" src="<?=C_URL?>/members/uploads/nopic_<?=$lang_browse_8s?>.jpg" height=90 border=1> <?}elseif($_photo=='' && $_gender==$lang_browse_9a){?> <img style="border-color: #4D443B" src="<?=C_URL?>/members/uploads/nopic_<?=$lang_browse_9s?>.jpg" height=90 border=1> <?}elseif($_photo=='' && $_gender==''){?> <img style="border-color: #4D443B" src="<?=C_URL?>/members/uploads/nopic.gif" height=90 border=1> <?}else{?> <img style="border-color: #4D443B" src="<?=C_URL?>/members/uploads/<?=$_photo?>" height=90 border=1> <?}?> <br> <?=$_membername?></a> <br> <?if (REQ_AGE){if ($_gender =='' || $_age <='0') {echo $lang_members_47;}else{echo $_gender." ".$_age;}}?><br> <?if (REQ_CTRY){if ($_location) {echo $_location;}else{echo $lang_members_47;}}?> </td> <?}?> </tr> <tr><td colspan="6" class="table_body_feedback"> </td></tr> </table> <br> <?if($_admin_check=='1'){?> <br><table width="780" border="0"><tr><td align="center" class="body_text"><font color="red"><?=$lang_members_7?></font></td></tr></table> <?}?> <?if($action=='delete'){?> <br><br> <table align="center" cellspacing="0" width="600" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> <?=$lang_members_8?></div></div></td></tr></table> <table align="center" cellspacing="0" cellpadding=2 width="600" class="table_border" border="0"> <tr><td colspan="3" height="30" class="table_body" align="center"> <br><br> <?if ($action=='delete' && $confirm==''){?> <?=$lang_members_9?> <br><br> <form action="members.php" method="post" name="delete_membership"> <input type="hidden" name="action" value="delete"> <input type="hidden" name="confirm" value="1"> <input type="submit" name="submit" value="Delete Membership"> </form> <?} if ($action=='delete' && $confirm=='1'){?> <?=$lang_members_10?> <br><br> <a href="<?=C_URL?>"><?=$lang_members_11?></a> <br><br> <?}?> <br><br> </td></tr> <tr><td colspan="3" class="table_body"> </td></tr> </table> <br><br> <?}else{?> <table align="left" border="0" width="750" cellpadding="20"> <tr><td valign="top" width="160"> <!-- options --> <!-- Latest Member--> <table cellspacing="0" width="160" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Latest Senior Chatter</div></div></td></tr></table> <table cellspacing="0" cellpadding=2 width="160" class="table_border" border="0"> <tr><td colspan="1" class="table_body_feedback"> </td></tr> <tr><td colspan="1" class="table_body_feedback">I'm New And Looking For Friends. Please Send Me A Message...</td></tr> <tr><td colspan="1" class="table_body_feedback"> </td></tr> <tr> <? $tmp=mysql_query("SELECT DISTINCT * FROM pro_membersu_privchatf WHERE show_profile = '1' AND admin_check = '0' ORDER BY `id` DESC LIMIT 1"); while($i=mysql_fetch_array($tmp)) { $_memberid = ($i['id']); $_membername = ($i['usrname']); $_photo = ($i['photo']); $_gender = ($i['gender']); $_age = ($i['age']); $_location = ($i['location']); ?> <td class="table_body_feedback" height="100" align=center width="16.7%"> <a href="profile.php?user=<?=$_membername?>"> <?if($_photo=='' && $_gender==$lang_browse_7){?> <img style="border-color: #4D443B" src="<?=C_URL?>/members/uploads/nopic_<?=$lang_browse_7s?>.jpg" height=90 border=1> <?}elseif($_photo=='' && $_gender==$lang_browse_{?> <img style="border-color: #4D443B" src="<?=C_URL?>/members/uploads/nopic_<?=$lang_browse_8s?>.jpg" height=90 border=1> <?}elseif($_photo=='' && $_gender==$lang_browse_9a){?> <img style="border-color: #4D443B" src="<?=C_URL?>/members/uploads/nopic_<?=$lang_browse_9s?>.jpg" height=90 border=1> <?}elseif($_photo=='' && $_gender==''){?> <img style="border-color: #4D443B" src="<?=C_URL?>/members/uploads/nopic.gif" height=90 border=1> <?}else{?> <img style="border-color: #4D443B" src="<?=C_URL?>/members/uploads/<?=$_photo?>" height=90 border=1> <?}?> <br> <?=$_membername?></a> <br> <?if (REQ_AGE){if ($_gender =='' || $_age <='0') {echo $lang_members_47;}else{echo $_gender." ".$_age;}}?><br> <?if (REQ_CTRY){if ($_location) {echo $_location;}else{echo $lang_members_47;}}?> </td> <?}?> </tr> <tr><td class="table_body_feedback"> </td></tr> </table> <br> <!-- Membership Status --> <?php if($dolifetime!='life'){?> <table valign="top" cellspacing="0" width="160" border="0" cellpadding="0"> <tr><td height="12" valign="top" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Membership Status</div></div></td></tr></table> <div align="left"></div> <table valign="top" cellspacing="0" width="160" class="table_border" height="40" border="0"> <tr valign=top><td align="left" class="table_body"> <br> <font color="GREEN">»</font> <a href="lto.php"><font size="2">Upgrade Membership</a></font> <br> <br> <font size="2">Level: <?=$_level?> <?=$lang_members_35?></font><br> <font size="2">Expiry: <a href="lto.php"><font color="RED"><?=$_expires?></a></font><br> <a href="your-premium-membership.php"><font size="1">What's This?</a></font> <br> <br> </td></tr> </table> <?php }else{?> <table valign="top" cellspacing="0" width="160" border="0" cellpadding="0"> <tr><td height="12" valign="top" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Membership Status</div></div></td></tr></table> <table valign="top" cellspacing="0" width="160" class="table_border" height="40" border="0"> <tr valign=middle><td class="table_body" align="center"> <img src="lifetime-chatter.jpg" /> </td></tr> </table> <?php }?> <br> <!-- SeniorsSeekingLove.com --> <table cellspacing="0" width="160" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Looking For Love?</div></div></td></tr></table> <table cellspacing="0" width="160" class="table_border" height="50" border="0"> <tr valign=top><td class="table_body"> <br> » <a href="http://seniorsseekinglove.com">Seniors Seeking Love</a> <br> </td></tr> </table> <br> <!-- Main Options Panel --> <table cellspacing="0" width="160" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> <?=$lang_members_12?></div></div></td></tr></table> <table cellspacing="0" width="160" class="table_border" height="150" border="0"> <tr valign=top><td class="table_body"> » <a href="profile.php?user=<?=$pro_name?>"><?=$lang_members_13?></a><br> <?if($_admin_check =='1'){?> » <a href="#" onClick="javascript:alert('<?=$lang_members_7?> ')"><?=$lang_members_14?></a><br> <?}elseif($_show_profile =='1'){?> » <a href="members.php?hide_profile=1"><?=$lang_members_15?></a><br> <?}else{?> » <a href="members.php?show_profile=1"><font color=red><?=$lang_members_14?></font></a><br> <?}?> » <a href="edit.php"><?=$lang_members_17?></a><br> » <a href="edit.php"><?=$lang_members_18?></a><br> » <a href="members.php?action=delete"><?=$lang_members_19?></a><br> <br> » <a href="blogs/?username=<?=$pro_name?>"><?=$lang_members_20?></a><br> » <a href="buddys.php"><?=$lang_members_21?></a><br> <? //// new messages $sql = "SELECT * FROM pro_membersu_privchath WHERE recipient='$pro_name' AND isread='0' ORDER BY date DESC LIMIT 40"; $result=mysql_query($sql);$num_rows_new = mysql_num_rows($result); $sql = "SELECT * FROM pro_membersu_privchath WHERE recipient='$pro_name' AND isread='1' ORDER BY date DESC LIMIT 40"; $result=mysql_query($sql);$num_rows_old = mysql_num_rows($result); ?> » <a href="mail/"><?=$lang_members_22?> (<?=$num_rows_new?> <?=$lang_members_23?>, <?=$num_rows_old?> <?=$lang_members_24?>)</a><br> <?if($_show_profile =='1'){?> » <a href="gallery/?member=<?=$pro_name?>"><?=$lang_members_25?></a><br> <?}else{?> » <a href="gallery/update.php?member=<?=$pro_name?>"><?=$lang_members_25?></a><br> <?}?> <br> <?if(C_CHAT_MODULE && MESSENGER){?> <?if(CHAT=='2' && $p_member=='1'){?> » <a href="#" onClick="window.open('<?=MESSENGER_URL?>/members/_login.php?membername=<?=$pro_name?>&u=<?=$pro_pass?>&s=2','login','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=367,height=500,left=380,top=120');return false;" title="Insfeedbackt Messenger">Insfeedbackt Messenger</a><br> <?}else{?> » <a href="lto.php" title="Insfeedbackt Messenger">Insfeedbackt Messenger</a><br> <?}}?> » <a href="chat.php"><?=$lang_members_28?></a><br> » <a href="messageboard/"><?=$lang_members_52?></a><br> » <a href="browse_ext.php"><?=$lang_members_29?></a><br> » <a href="blogs.php"><?=$lang_members_30?></a><br> » <a href="gallerys.php"><?=$lang_members_31?></a><br> <br/> » <a href="faq.php">FAQ's</a><br> » <a href="comments.php">Testimonials</a><br> » <a href="over50.php">Life Over 50</a><br> » <a href="blog.php">Rob's Blog</a><br> <? //// who is online $sql = "SELECT * FROM pro_membersu_privchatd WHERE status='Online' AND show_online = 'Online' AND membername!=''"; $result=mysql_query($sql); $num_rows_users = mysql_num_rows($result); ?> » <a href="online.php"><font color="Green"><b><?=$lang_members_32?> (<?=$num_rows_users?>)</b></a></font><br> <br> » <a href="login.php?action=logout"><img border="0" src="logout-but.gif"></a><br> </td></tr> </table> <br> <!-- Donate --> <table cellspacing="0" width="160" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Membership Donations</div></div></td></tr></table> <table cellspacing="0" width="160" class="table_border" height="35" border="0"> <tr valign=middle><td class="table_body" align="center"> </td></tr> <tr valign=middle><td class="table_body" align="center"><a href="donate.php"><img src="donate.gif" border="0"></a></td></tr> <tr valign=middle><td class="table_body" align="center"> <a href="donate.php">Help A Friend</a></td></tr> <tr valign=middle><td class="table_body" align="center"> </td></tr> </td></tr> </table> <br> <!-- Social Bookmarks --> <table cellspacing="0" width="160" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Spread The Word</div></div></td></tr></table> <table cellspacing="0" width="160" class="table_border" height="20" border="0"> <tr valign=middle><td class="table_body" align="center"> </td></tr> <tr valign=middle><td class="table_body" align="center"> <!-- AddThis Button BEGIN --> <script type="text/javascript">var addthis_pub="godrob";</script> <a href="http://www.addthis.com/bookmark.php?v=20" onmouseover="return addthis_open(this, '', 'http://www.seniorchatters.co.uk', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img align="center" src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/200/addthis_widget.js"></script> <!-- AddThis Button END --> </td></tr> <tr valign=middle><td class="table_body" align="center"> </td></tr> </table> <br> <!-- InfoBox --> <table cellspacing="0" width="160" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Notice Board & Help</div></div></td></tr></table> <table cellspacing="0" width="160" class="table_border" height="20" border="0"> <tr valign=middle><td class="table_body" align="center"> <IFRAME name="InfoBox" SRC="InfoBox/?usr=<?php echo $pro_name;?>" WIDTH="160" HEIGHT="700" scrolling="no" frameborder="0" marginwidth="0" marginheight="0"></IFRAME> </td></tr> </table> <!-- main panel --> </td><td valign="top" width="600"> <!--shout box --> <table align="center" cellspacing="0" width="100%" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Shout Box - FREE Chat For Everyone. Need More? Try The <a href="chat.php">Chat Rooms</a></div></div></td></tr></table> <table cellspacing="0" width="100%" class="table_border" border="0"> <tr valign=top><td class="table_body"> <iframe id="shoutbox" name="shoutbox" src="shoutbox/?username=<?=$pro_name?>&userid=USERID" scrolling="auto" frameborder="no" style="width: 100%; height: 700px;"></iframe> <td></tr> </table> <br> <!-- success stories --> <table align="center" cellspacing="0" width="100%" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> Success Stories</div></div></td></tr></table> <table cellspacing="0" cellpadding=2 width="100%" class="table_border" border="0"> <tr><td align="center" colspan="4" class="table_body"><script>var slidemembersfoldername='';</script><script src="slidemembers.js" type="text/javascript"></script> Why not share your success story too?,<a href="mailto:[email protected]?subject=Our Success Story">email me with your details</a> <p/> </td></tr> </table> <br> <!--random members--> <table align="center" cellspacing="0" width="100%" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> <?=$lang_members_53?></div></div></td></tr></table> <table cellspacing="0" cellpadding=2 width="100%" class="table_border" border="0"> <tr><td colspan="4" class="table_body"> </td></tr> <tr> <? $tmp=mysql_query("SELECT DISTINCT * FROM pro_membersu_privchatf WHERE show_profile = '1' AND admin_check = '0' ORDER BY RAND() DESC LIMIT 4"); while($i=mysql_fetch_array($tmp)) { $_memberid = ($i['id']); $_membername = ($i['usrname']); $_photo = ($i['photo']); $_gender = ($i['gender']); $_age = ($i['age']); $_location = ($i['location']); ?> <td class="table_body" height="100" align=center width="25%"> <a href="profile.php?user=<?=$_membername?>"> <?if($_photo=='' && $_gender==$lang_browse_7){?> <img src="<?=C_URL?>/members/uploads/nopic_<?=$lang_browse_7s?>.jpg" height=90 border=0> <?}elseif($_photo=='' && $_gender==$lang_browse_{?> <img src="<?=C_URL?>/members/uploads/nopic_<?=$lang_browse_8s?>.jpg" height=90 border=0> <?}elseif($_photo=='' && $_gender==$lang_browse_9a){?> <img src="<?=C_URL?>/members/uploads/nopic_<?=$lang_browse_9s?>.jpg" height=90 border=0> <?}elseif($_photo=='' && $_gender==''){?> <img src="<?=C_URL?>/members/uploads/nopic.gif" height=90 border=0> <?}else{?> <img src="<?=C_URL?>/members/uploads/<?=$_photo?>" height=90 border=0> <?}?> <br> <?=$_membername?></a> <br> <?if (REQ_AGE){if ($_gender =='' || $_age <='0') {echo $lang_members_47;}else{echo $_gender." ".$_age;}}?><br> <?if (REQ_CTRY){if ($_location) {echo $_location;}else{echo $lang_members_47;}}?> </td> <?}?> </tr> <tr><td colspan="3" class="table_body"> </td></tr> </table> <?if(!REQ_GNDR){?> <br> <table align="center" cellspacing="0" width="100%" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> <?=$lang_members_51?></div></div></td></tr></table> <table cellspacing="0" cellpadding=2 width="100%" class="table_border" border="0"> <tr class="table_body"><td width="100"><b><?=$lang_members_40?></b></td><?if (REQ_AGE){?><td align="center" width="80"><b><?=$lang_members_41?></b></td><?}?><?if(REQ_CTRY){?><td width="150"><b><?=$lang_members_42?></b></td><?}?><?if(DATING){?><td align="center"><b><?=$lang_members_43?></b></td><?}?><?if(REQ_PIC){?><td align="center"><b><?=$lang_members_44?></b></td><?}?></tr> <? $tmp=mysql_query("SELECT DISTINCT * FROM pro_membersu_privchatf WHERE show_profile = '1' AND admin_check = '0' ORDER BY `id` DESC LIMIT 5"); while($i=mysql_fetch_array($tmp)) { $_memberid = ($i['id']); $_membername = ($i['usrname']); $_photo = ($i['photo']);if ($_photo!=''){$_photo=$lang_members_49;}else{$_photo=$lang_members_50;} $_gender = ($i['gender']); $_age = ($i['age']); $_location = ($i['location']); $_seek_gender = ($i['seek_gender']);if ($_seek_gender==''){$_seek_gender=$lang_members_48;} ?> <tr class="table_body"><td><a href="<?=C_URL?>/profile.php?user=<?=$_membername?>"><?=$_membername?></a></td><?if (REQ_AGE){?><td align="center"><?=$_age?></td><?}?><?if(REQ_CTRY){?><td><?=$_location?></td><?}?><?if(DATING){?><td align="center"><?=$_seek_gender?></td><?}?><?if(REQ_PIC){?><td align="center"><?=$_photo?></td><?}?></tr> <?}?> </table> <?}else{?> <br/> <table align="center" cellspacing="0" width="100%" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> <?=$lang_members_39?></div></div></td></tr></table> <table cellspacing="0" cellpadding=2 width="100%" class="table_border" border="0"> <tr class="table_body"><td width="100"><b><?=$lang_members_40?></b></td><?if (REQ_AGE){?><td align="center" width="80"><b><?=$lang_members_41?></b></td><?}?><?if(REQ_CTRY){?><td width="150"><b><?=$lang_members_42?></b></td><?}?><?if(DATING){?><td align="center"><b><?=$lang_members_43?></b></td><?}?><?if(REQ_PIC){?><td align="center"><b><?=$lang_members_44?></b></td><?}?></tr> <? $tmp=mysql_query("SELECT DISTINCT * FROM pro_membersu_privchatf WHERE show_profile = '1' AND gender = 'Male' AND admin_check = '0' ORDER BY `id` DESC LIMIT 5"); while($i=mysql_fetch_array($tmp)) { $_memberid = ($i['id']); $_membername = ($i['usrname']); $_photo = ($i['photo']);if ($_photo!=''){$_photo=$lang_members_49;}else{$_photo=$lang_members_50;} $_gender = ($i['gender']); $_age = ($i['age']); $_location = ($i['location']); $_seek_gender = ($i['seek_gender']);if ($_seek_gender==''){$_seek_gender=$lang_members_48;} ?> <tr class="table_body"><td><a href="<?=C_URL?>/profile.php?user=<?=$_membername?>"><?=$_membername?></a></td><?if (REQ_AGE){?><td align="center"><?=$_age?></td><?}?><?if(REQ_CTRY){?><td><?=$_location?></td><?}?><?if(DATING){?><td align="center"><?=$_seek_gender?></td><?}?><?if(REQ_PIC){?><td align="center"><?=$_photo?></td><?}?></tr> <?}?> </table> <br> <table align="center" cellspacing="0" width="100%" border="0" cellpadding="0"> <tr><td height="12" background="images/<?=C_STYLE?>/bg.gif" class="body_title"> <div class="tl"><div class="tr"> <?=$lang_members_45?></div></div></td></tr></table> <table cellspacing="0" cellpadding=2 width="100%" class="table_border" border="0"> <tr class="table_body"><td width="100"><b><?=$lang_members_40?></b></td><?if (REQ_AGE){?><td align="center" width="80"><b><?=$lang_members_41?></b></td><?}?><?if(REQ_CTRY){?><td width="150"><b><?=$lang_members_42?></b></td><?}?><?if(DATING){?><td align="center"><b><?=$lang_members_43?></b></td><?}?><?if(REQ_PIC){?><td align="center"><b><?=$lang_members_44?></b></td><?}?></tr> <? $tmp=mysql_query("SELECT DISTINCT * FROM pro_membersu_privchatf WHERE show_profile = '1' AND gender = 'Female' AND admin_check = '0' ORDER BY `id` DESC LIMIT 5"); while($i=mysql_fetch_array($tmp)) { $_memberid = ($i['id']); $_membername = ($i['usrname']); $_photo = ($i['photo']);if ($_photo!=''){$_photo=$lang_members_49;}else{$_photo=$lang_members_50;} $_gender = ($i['gender']); $_age = ($i['age']); $_location = ($i['location']); $_seek_gender = ($i['seek_gender']);if ($_seek_gender==''){$_seek_gender=$lang_members_48;} ?> <tr class="table_body"><td><a href="<?=C_URL?>/profile.php?user=<?=$_membername?>"><?=$_membername?></a></td><?if (REQ_AGE){?><td align="center"><?=$_age?></td><?}?><?if(REQ_CTRY){?><td><?=$_location?></td><?}?><?if(DATING){?><td align="center"><?=$_seek_gender?></td><?}?><?if(REQ_PIC){?><td align="center"><?=$_photo?></td><?}?></tr> <?}?> </table> <br> <?}?> </td></tr></table> <?}?> </td></tr></table> <? include_once 'templates/footer.php'; ?> Hopefully this will help? Thanks again Regards Rob Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985468 Share on other sites More sharing options...
PFMaBiSmAd Posted December 29, 2009 Share Posted December 29, 2009 Try - var_dump($_expires); I'm going to guess it is not empty but that it is not an expected value either. For debugging, add the following two lines of code immediate after the first opening <?php tag to cause all php errors to be displayed - ini_set("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985472 Share on other sites More sharing options...
godrob Posted December 29, 2009 Author Share Posted December 29, 2009 Hi PFMaBiSmAd var_dump($_expires); returns: string(11) "31 Dec 1969" ini_set("display_errors", "1"); error_reporting(E_ALL); creates a log with: [29-Dec-2009 09:04:40] PHP Notice: Undefined variable: _expires in /home/seniorch/public_html/memberstest.php on line 4 Thanks for your help Regards Rob Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985489 Share on other sites More sharing options...
Buddski Posted December 29, 2009 Share Posted December 29, 2009 Just above this line $_expires = ($i['expires_date']); put var_dump($i['expires_date']); $_expires = ($i['expires_date']); This will allow us to see WHAT is being assigned to $_expires Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985493 Share on other sites More sharing options...
godrob Posted December 29, 2009 Author Share Posted December 29, 2009 I just double checked the unix date time stored in the MYSQL table and it reads '1264164328' Which convers to Fri, 22 Jan 2010 12:45:28 GMT Which is correct and obviously not 31/12/1969 that is getting posted instead Thanks for your help Regards Rob. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985494 Share on other sites More sharing options...
Buddski Posted December 29, 2009 Share Posted December 29, 2009 If its storing a unix timestamp you dont need a strtotime.. just date('d M Y',$_expires); Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985497 Share on other sites More sharing options...
PFMaBiSmAd Posted December 29, 2009 Share Posted December 29, 2009 That may be what is in your table, but that is not what you are retrieving from the query. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985498 Share on other sites More sharing options...
godrob Posted December 29, 2009 Author Share Posted December 29, 2009 Hi Buddski, It shows as: string(10) "1264164328" instead of the actual date. Regards Rob Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985500 Share on other sites More sharing options...
Buddski Posted December 29, 2009 Share Posted December 29, 2009 If that is the var_dump($i['expires_date']); code then that is good.. It means $_expires is being passed a unix timestamp.. and you can then manipulate that using the date function date('d M Y',1264164328) = 22 Jan 2010 so date('d M Y',$_expires) will be suffice Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985502 Share on other sites More sharing options...
godrob Posted December 29, 2009 Author Share Posted December 29, 2009 So if strtotime is causing the problem, then is it this line of code that is wrong? if(empty($_expires)){$_expires='n/a';}else{$_expires=date('d M Y', strtotime($_expires));} If so, can you please advise what it should read so that I do not receive the warning: Re: Warning: date() expects parameter 2 to be long, string given in... and also do no get the wrong date being posted as 31/12/1969 Thanks again for all of your help Regards Rob. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985503 Share on other sites More sharing options...
Buddski Posted December 29, 2009 Share Posted December 29, 2009 You need to convert the $_expires varaible into a integer $_expires = (int)$i['expires_date']; if I remember correctly.. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985507 Share on other sites More sharing options...
cags Posted December 29, 2009 Share Posted December 29, 2009 You need to convert the $_expires varaible into a integer $_expires = (int)$i['expires_date']; if I remember correctly.. No you don't, PHP will automatically do the conversion for you. $_expires = empty($_expires) ? 'n/a' : date('d M Y', $_expires); Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985512 Share on other sites More sharing options...
Buddski Posted December 29, 2009 Share Posted December 29, 2009 He tried that but got the same error as that topic name says.. Ive never seen that error before so I figured it cant hurt. Quote Link to comment https://forums.phpfreaks.com/topic/185692-warning-date-expects-parameter-2-to-be-long-string-given-in/#findComment-985516 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.