-
Posts
332 -
Joined
-
Last visited
Everything posted by sasori
-
realy?, so how am i gonna use it then if i can't even see it on the cpanel on a live free webhosting account?
-
ok thanks for the reply , i got it working now.. this PHP thing is giving me lot of fun surprises
-
let's say i wanna create a class that will accept either integer or float, is it advisable to make 2 different classes? <?php class Customerorder { private $total = 0; //for integer function addtotal($amount) { $this->total = $this->total + $amount; echo "$amount was added; current total is $this->total"; } } class Customerorder { private $total = 0.0; //for float function addtotal($amount) { if(is_numeric($amount)) { $this->total = $this->total + $amount; echo "$total is added; current total is $this->total"; } else { echo "the value passed is not numeric"; } } } ?> (sorry for posting it here,, nobody's answering it in OOP section of the forum)
-
(im noob, so be patient) let's say i want to create a class that accepts an integer and a float datatype, how will you code that? should i create two different classes? like class Customerorder { private $total = 0; //the rest of the code here; } class Customerorder { private $total = 0.0; //for the float //the rest of the code here; } is this thing good? or there's another way to write it using only a single class?
-
is it ok to place as many class as i want inside a single php class file? let's say i have a file named, test.class.php then inside that class there are class test1 { code here; } class test2 { code here; } and so on and so forth..
-
am confuse, how could that be? since most "free" webhosting services for PHP doesn't have sqlite on the cpanel , i can only see this stuff in my wamp server in localhost as it is a built-in.
-
i think ill just skip this sqlite lesson.. this stuff isn't used that much in our real world businesses right?
-
first i made the testdb using this code $db = sqlite_open(testdb); it generates itself because the file doesn't exist then i made the table Product and the 2 fields named Firstname, Lastname using the sqlite manager
-
thanks thanks.topic solved
-
let's say i made a simple class if am gonna name it like class.totalCost.php is that file name good?
-
im a noob. my question is, how will I save a PHP class file? is it sensitive? i mean does the filename must be the same as the classname?
-
same error..it just added a space above the error message because of the <br> tag
-
the error says Warning: sqlite_query() [function.sqlite-query]: no such table: Product in C:\wamp\www\test2\index2.php on line 76 can't connect when there is a Product table existing in my testdb database kindly help me configure what's going on with that error please? here's my code <?php $db = sqlite_open("testdb"); $sql = "SELECT * FROM Product"; $result = sqlite_query($db,$sql) or die ("can't connect"); $row = sqlite_fetch_array($resut); while($row = sqlite_fetch_array($result)) { foreach($row as $value) { echo "$value<br/>"; } } sqlite_close($db); ?>
-
any other code technique? aside from the example in the php manual? by the way your code has errors just like what you've said
-
im troubled with producing a list of name of my csv file in my browser here is the list in the .csv file Chucky Chucky 12345 Dead St. CA 54321 Freddy Kruger 66666 Elm St. NY 56666 Jason Vorjis 24354 killer St. AK 64524 and here's my code <?php $fh = fopen('../test2/address.csv','r'); $address = fgetcsv($fh,1000); foreach($address as $name) { print_r($name); } fclose($fh); ?> it only outputs the first name from the list, in this output on the web browser Chucky Chucky12345Dead St.CA54321
-
it works fine now..thanks <?php $dir = ftp_connect("domain.test.org"); $user = "user"; $pwd = "password"; $login = ftp_login($dir,$user,$pwd); $filesarray = ftp_nlist($dir,"www/"); $fh = file_get_contents('http://www.domain.com/marry_poppins.html'); echo $fh; ftp_close($dir); fclose($fh); ?>
-
Warning: file_get_contents() expects parameter 1 to be string, resource given in C:\wamp\www\test2\index2.php on line 67 (where in Line 67 = $readline = file_get_contents($fh); )
-
i don't get how to use the file_get_contents function, my code produces error <?php $dir = ftp_connect("www.yourdomain.com"); $user = "username"; $pwd = "password"; $login = ftp_login($dir,$user,$pwd); $filesarray = ftp_nlist($dir,"www/"); $fh = fopen('http://www.yourdomain.com/marry_poppins.html','r') or die ("can't open file"); while(!feof($fh)) { $readline = file_get_contents($fh); echo $readline; } ftp_close($dir); fclose($fh); ?>
-
thanks buddy, it's working now
-
i don't know how to display the output in a vertical manner using this code of mine <?php $today = date('F d Y'); $fh = fopen('file.txt','a+'); fwrite($fh ,"$today\n"); fclose($fh); ?> the output produces, August 2 2008August 2 2008August 2 2008August 20008 <-- and so on, and so forth.. the "\n" seems that it doesn't work at all ,
-
same.. it only shows the index.php alone these are the directories inside my wamp www root folder -test <-- am trying to display the .php files inside this folder but it only shows /test/index.php alone -test2 <-- this is where my scrip resides -php i tried different variations for the $directory $directory = "C:/wamp/www/test/"; $directory = "/www/test/"; $directory = "../www/test/"; $directory = "../test/"; but still, it doesn't show the other files..only the index.php of the test folder
-
i made a test code that will show all the .php files in the directory, but how come when i try to open a different directory, it only shows the "index.php" when there are a number of php files in that directory, does this means, i should run the script in the same directory on which i want the files to be listed? <?php $directory = "../test2/"; $opendirectory = opendir($directory); while($filename = readdir($opendirectory)) { $filepath = $directory.$filename; if(is_file($filename) && ereg("\.php$",$filename); { $gallery[] = $filepath; } sort($gallery); foreach($gallery as $file) { echo "<br/>"; echo $file."<br/>"; } ?>
-
how bout that "subscribe to this thread" tool module of vbulletin? can you guys add that module in this SMF type forum?
-
aren't there any functionality of thread subscription in this forum?, it would be very convenient if everyone would be able to subscribe in their own threads..so that next time we log in, we can easily search our own post and read the replies to our threads ..(help)
-
(noob here) am trying to make a seperate function for an input form and a submit button form then i wanna use the both function in an index file and it should output whatever i input inside the form here's the code of my index file <?php require("includes/formfunctions.inc.php"); inputform($input); submitbutton($input); if($_GET['$input'] == '$submit') { echo $input; } ?> at the bottom are the 2 functions saved as formfunctions.inc.php here's the submit button function code <?php function submitbutton() { echo "<form>"; echo "<input type='submit' name='$submit' value='send'>"; echo "</form>"; return $input; } ?> here's the input form function code <?php function inputform($input) { echo "<form>"; echo "<input type='text' name='$input' size='10'>"; echo "</form>"; return $input; } ?> they look good..but when i input a word in the input form and click send.nothing happens ..will somebody help me with the logic please