Welcome Guest ( Log In | Register )



2 Pages V  < 1 2  
Reply to this topicStart new topic
> Getting Certain Parts Of A Record, The character data
TavoxPeru
post Oct 19 2007, 05:51 AM
Post #11


Super Member
Group Icon

Group: [HOSTED]
Posts: 805
Joined: 8-April 06
From: Lima - Peru
Member No.: 12,579
myCENTs:46.87



I guess that pyost get confuse with the implode() php function, which accepts its parameters in any order and do the opposite task -join- of the explode() php function.

BTW, the explode function has one more parameter that you can use to limit the maximum of limit elements, but for this case you don't need to use.

Best regards,
Go to the top of the page
 
+Quote Post
pyost
post Oct 19 2007, 11:54 AM
Post #12


Nenad Bozidarevic
Group Icon

Group: [MODERATOR]
Posts: 1,049
Joined: 7-November 05
From: Belgrade, Serbia
Member No.: 9,500
myCENTs:9.92



Nope, I don't know either of them by heart, I just visit php.net every time I need them biggrin.gif And this time I wasn't careful when I read the order wink.gif
Go to the top of the page
 
+Quote Post
FirefoxRocks
post Oct 26 2007, 03:45 AM
Post #13


Super Member
Group Icon

Group: [HOSTED]
Posts: 752
Joined: 12-July 06
From: Ontario, Canada
Member No.: 14,464



Ok, how come no one suggested month() or monthname() ? I just found out those two.
Go to the top of the page
 
+Quote Post
pyost
post Oct 26 2007, 08:51 AM
Post #14


Nenad Bozidarevic
Group Icon

Group: [MODERATOR]
Posts: 1,049
Joined: 7-November 05
From: Belgrade, Serbia
Member No.: 9,500
myCENTs:9.92



There are no such functions in PHP5, or at least according to www.php.net.
Go to the top of the page
 
+Quote Post
turbopowerdmaxst...
post Oct 26 2007, 09:23 AM
Post #15


Premium Member
Group Icon

Group: [HOSTED]
Posts: 415
Joined: 16-February 06
From: Kolkata, India
Member No.: 11,322
myCENTs:67.18



I used to get confused by the same very thing. In some of the PHP functions, the order of parameters does defy the common logic. VB & C# support the split function as Split(<StringToSplit>, <Delimeter>). Another such function is str_replace which takes the syntax str_replace(<ReplaceWhat>, <ReplaceWith>, <ReplaceIn>). Again logic says that the source string must be the first parameter as is in, VB & C# - Replace(<ReplaceIn>, <ReplaceWhat>, <ReplaceWith>).

In C#, the Split() and Replace() methods are built into the string object itself. So, the first parameter (Source string) is not specified as the parameter. Rather, these method are called as SourceString.Split() or SourceString.Replace(). But, the thing is same, the source string must be specified before other parameters.
Go to the top of the page
 
+Quote Post
FirefoxRocks
post Oct 26 2007, 12:43 PM
Post #16


Super Member
Group Icon

Group: [HOSTED]
Posts: 752
Joined: 12-July 06
From: Ontario, Canada
Member No.: 14,464



QUOTE(pyost @ Oct 26 2007, 03:51 AM) *
There are no such functions in PHP5, or at least according to www.php.net.


There are date and time functions here on dev.mysql.com, exact url is http://dev.mysql.com/doc/refman/5.0/en/dat...-functions.html.
Go to the top of the page
 
+Quote Post
TavoxPeru
post Oct 27 2007, 03:17 AM
Post #17


Super Member
Group Icon

Group: [HOSTED]
Posts: 805
Joined: 8-April 06
From: Lima - Peru
Member No.: 12,579
myCENTs:46.87



QUOTE(pyost @ Oct 26 2007, 03:51 AM) *
There are no such functions in PHP5, or at least according to www.php.net.

That's correct, but you can obtain the month name easily using the strftime(), strtotime(), date() and time() php functions together or directly with the MONTHNAME() MySql function:
CODE
<?php
// php functions
$monthname=strftime("%B",strtotime(date("d-m-Y",time())));

// MySql function
$sql="SELECT MONTHNAME('2007-10-26') as mname";
$rs=mysql_query($sql) or die('Error...');
$row=mysql_fetch_array($rs);
$mname=$row["mname"];

echo "Month Name with Php: " . $monthname;
echo "<br />Month Name with MySql: " . $mname;
?>

Best regards,
Go to the top of the page
 
+Quote Post
pyost
post Oct 27 2007, 08:12 AM
Post #18


Nenad Bozidarevic
Group Icon

Group: [MODERATOR]
Posts: 1,049
Joined: 7-November 05
From: Belgrade, Serbia
Member No.: 9,500
myCENTs:9.92



QUOTE(FirefoxRocks @ Oct 26 2007, 02:43 PM) *
There are date and time functions here on dev.mysql.com, exact url is http://dev.mysql.com/doc/refman/5.0/en/dat...-functions.html.


Heh, didn't think of checking MySQL functions biggrin.gif
Go to the top of the page
 
+Quote Post

2 Pages V  < 1 2
Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Php, Sql Lite: Storing Session's Data?(1)
  2. PHP Based Site Access Authentication - Help(4)
  3. Php/mysql Data Display(3)
  4. Possible To Do?(7)
  5. [PHP + MySQL] Encrypting Data(11)
  6. Reading Data From Sessions(2)
  7. Storing Data Into Xml With A Php Form(2)
  8. Need An Alternative To $http_post_data For PHP4(5)
  9. Data Passing - Re An Assignment For School - Please Help :)(8)
  10. Send XML Data To PHP Page(0)
  11. Proper Way To Grab User Data?(1)
  12. Retrieving Data And Displaying In Boxes(6)
  13. Sql Injection Prevention (passing Numerical Data Across Pages).(9)
  14. Letting Users Add Mysql Data With Php(1)
  15. Reading Xml Data(2)


 



- Lo-Fi Version Time is now: 4th December 2008 - 11:25 PM