PHP help
#1

Hi,
i trying make some format reading houses into php and i would like to get some help

i trying do something like that as PHP
Код:
format(nomefile,sizeof(nomefile),"%s.txt",biz[t][bizname]);
i got this line but that reading just one file and not reading

Код:
if(!$file=fopen("$GameDir/scriptfiles/property.cfg","r")) die("Error reading bizzfile");
Reply
#2

PHP код:
<?php
$path 
"PATH_TO_FILE";
$bizname "BIZNAME_HERE";
$file $path $bizname;
if(
file_exists($file"r") == true)
{
    
$file_content file_get_contents($file);
    
// Content of the buziness file is now in $file_content
}
else
{
    die(
"Error reading bizz file " $file);
}
Reply
#3

Can you make that stock i have for explain for me, i just started PHP ?
I have houses saving as " Casa " but they many like Casa1.txt , Casa2.txt to Casa800.txt

i just need that then i'll learn from it
PHP код:
    function GetPlayerHouseInfo($user)
    {
        require 
"config.php";
        if(!
$file=fopen("$GameDir/scriptfiles/Casa233.txt","r")) die("Error reading bizzfile");
        while ((
$data=fgetcsv($file,1024"|")) !== FALSE)
        {
            if(
$data[14] == $user)
            {
                
$datanew = array(
                    
"owner" => $data[0],
                    
"id" => $data[1],
                    
"housecash" => $data[2],
                    
"interiorpack" => $data[3],
                    
"garage" => $data[4],
                    
"PriceProd" => $data[5]
                );
                return 
$datanew;
            }
                
        }
        
    } 
Reply
#4

Anyone please...
How can i make it read just the house owner via php code and open it
Reply
#5

I think you are better up asking at a Forum that offers help and stuff for PHP Newbies.
Of course, there are some devs in here that know how to handle PHP but you'd get better answers mostly from their.
Reply
#6

Quote:
Originally Posted by Camorra
Посмотреть сообщение
I have houses saving as " Casa " but they many like Casa1.txt , Casa2.txt to Casa800.txt[/php]
You shouldn't rely on all 1-800 files to exist. Instead you need to scan the directory for each file.
http://php.net/manual/en/function.scandir.php

If you don't understand the basics of file scanning and iteration I suggest you ask it on a more PHP-related forum. Those people are in a much more suitable position to help you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)