PHP

Moderators: None (Apply to moderate this forum)
Number of threads: 1845
Number of posts: 5013

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
array element convert to string Posted by frag_ment on 10 Jun 2005 at 11:50 PM
<?
$fd = fopen("query_user.txt", "a+");
$stringData = $_POST['show_query']; //text in a text area
echo "edited text: ", $stringData, "<p>";
$edate = date("F j, Y, g:i a");

//get all data in e file
while (!feof ($fd))
{
$buffer = fgets($fd);

//get each line
$line = explode("\n", $buffer);

for($i = 0; $i < sizeof($line); $i++)
{
//get each element
list($user, $eadd, $subj, $msg, $pdate) = explode(";", $line[$i]);

echo $user;
echo $eadd;
echo $subj;
echo $msg;
echo $pdate;

{
fputs($fd, $user);
fputs($fd, ";");
fputs($fd, $eadd);
fputs($fd, ";");
fputs($fd, $subj);
fputs($fd, ";");
fputs($fd, $stringData);
fputs($fd, ";");
fputs($fd, $edate);
fputs($fd, "\n");
echo "Query Updated.<br>";
}
}
}
fclose($fd);
?>

e thing's fputs() oni wks for strings & e variables ($user, $eadd, $subj, $pdate) r all array elements. so is there ani way 2 convert em in2 strings?
Report
Re: array element convert to string Posted by treshr on 13 Jun 2005 at 5:46 AM
I don't know what you just wrote at the end and I'd like to ask you not to use the msn language for asking questions.

To answer your question, PHP doesn't make a difference between integers and and strings and other filetypes.

So if you want an integer just define the variable and PHP will find out what to do with it.


--=][tReShR][=--

Report
Re: array element convert to string Posted by frag_ment on 14 Jun 2005 at 8:17 AM
: I don't know what you just wrote at the end and I'd like to ask you not to use the msn language for asking questions.
:
: To answer your question, PHP doesn't make a difference between integers and and strings and other filetypes.
:
: So if you want an integer just define the variable and PHP will find out what to do with it.
:
:
: --=][tReShR][=--
:
:
the fputs() methods works for strings & the variables ($user, $eadd, $subj, $pdate) r all array elements (derived from the 2nd explode()). so is there any way to convert them into strings?




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.