Jump to content

Pavlin24

Members
  • Posts

    53
  • Joined

  • Last visited

Everything posted by Pavlin24

  1. Do you think it is possible newbie like me to find a job from distance as web designer?
  2. Yes. Thank you Ingolme. Now it works. But other problem. With encoding. I wrote text with cyrillic letters and it shows like this - ???????. Pls see the attachment. Doc1.docx
  3. Excuse me, but how I must use the localhost. On the old PC I did not do anything special. It worked directly.
  4. Hallo, Can anybody help for this question. I have changed my computer. And now my browser (google chrome) can not read php-files from my computer. I have installed PHP from XAMPP. What may be the reason for this?
  5. Hello. I try to find the the difference between two dates in months. I use this code: $diff=date_diff($date2_row[0],$cur_date); This is error message: Fatal error: Call to undefined function date_diff() Can anybody help me to find the reason for this.
  6. Yes, that may be a problem too. But the main problem was that I had to pass the query trough mysql_fetch_array() function. It works now. Thank you.
  7. Hello there, some help in this? Is it possible to calculate numeric data in table with data coming from forms? I mean something like this: mysql_query("UPDATE ov SET dt_ob=(dt_ob+'$suma1') WHERE smetka='$debit' ",$con) dt_ob and smetka are coloumns in the table, $suma1 and $debit are data coming from form. The code above do not work to me.
  8. To Petrucho: No errors are shown. Everything works, except of styling the width of this column. To dsonesuk: I have semicolon. I replaced the double quotes, I tried with class too, no result. But I found that the same code placed in other file works! I even copied the code from working file to not-working, but it still do not work in second file. It is some kind of mystery.
  9. Hallo, can anybody help me about this questuon. Is it possible to style HTML table heading, when it is in PHP? I mean something like this: <?php echo "<table border='1'> <tr> <th style='width:150px;'>дата на док.</th> </tr> </table> " ?> This not work . I want to set width of the heading to be 150 px. Is there other way?
  10. Thank you very much ! ! I have made corrections that you suggested. Now it is working. Here is the final code: ------------------------------------------------------ <?php class Car { public $ime="ne defenirana"; public $marka="ne defenirana"; public $model="ne definiran"; public $color="not defined"; public function __construct($ime) { $this->ime=$ime;} public function start($time) { echo $this->ime." starts at ".$time.".";} } $myCar=new Car("My car"); $myCar->marka="volkswagen"; $myCar->model="golf"; $myCar->color="grey"; $time=12.00; $myCar->start($time); echo "<br>"; echo "The color of my car is ".$myCar->color; echo "<br>"."The brand of my car is ".$myCar->marka."<br>"; $myBrothersCar=new Car("My brother's car"); $myBrothersCar->marka="volkswagen"; $myBrothersCar->model="passat"; $myBrothersCar->color="green"; $time=14.00; $myBrothersCar->start($time); echo "The car of my brother is ".$myBrothersCar->marka." ".$myBrothersCar->model." with color ".$myBrothersCar->color."."; ?>
  11. Hallo. I have difficulties understanding an error message. It is about creating class and 2 objects. The problem is with variable $ime. I have defined it once in the class. Then I assigned other values in the objects. It shows as undefined. Can anybody help me! ------------------------------------------------------------------------------------------------------------------ <?php class Car { public $ime="ne defenirana"; public $marka="ne defenirana"; public $model="ne definiran"; public $color="not defined"; public function __construct($ime) { $this->ime=$ime;} public function start($time) { echo $ime." starts at ".$time.".";} } $myCar=new Car(); $myCar->ime="My car"; $myCar->marka="volkswagen"; $myCar->model="golf"; $myCar->color="grey"; $time=12.00; $myCar->start($time); echo "<br>"; echo "The color of my car is ".$myCar->color; echo "<br>"."The brand of my car is ".$myCar->marka."<br>"; $myBrothersCar=new Car(); $myBrothersCar->ime="My brother's car"; $myBrothersCar->marka="volkswagen"; $myBrothersCar->model="passat"; $myBrothersCar->color="green"; $time=14.00; $myBrothersCar->start($time); echo "The car of my brother is ".$myBrothersCar->marka." ".$myBrothersCar->model." with color ".$myBrothersCar->color."."; ?> --------------------------------------------------------------------------------------------------------------------------------------------------- Warning: Missing argument 1 for Car::__construct(), called in C:xampphtdocsuploadtest.php on line 13 and defined in C:xampphtdocsuploadtest.php on line 7Notice: Undefined variable: ime in C:xampphtdocsuploadtest.php on line 8Notice: Undefined variable: ime in C:xampphtdocsuploadtest.php on line 10starts at 12.The color of my car is greyThe brand of my car is volkswagenWarning: Missing argument 1 for Car::__construct(), called in C:xampphtdocsuploadtest.php on line 25 and defined in C:xampphtdocsuploadtest.php on line 7Notice: Undefined variable: ime in C:xampphtdocsuploadtest.php on line 8Notice: Undefined variable: ime in C:xampphtdocsuploadtest.php on line 10starts at 14.The car of my brother is volkswagen passat with color green.
  12. Pavlin24

    create class

    Yes. The name of the function was the problem. Thank you.
  13. Pavlin24

    create class

    Hallo. I need some help on creating class in PHP. I tried to create a class with two properties and one method. Here is the code: <?php class Animal { private $vid; public $color; public function __construct ($vid){ $this->vid=$vid;} public function Print(){ echo $this->vid;} } $obj=new Animal; echo $obj->vid." "; echo $obj->color; ?> And here is the error message: Parse error: syntax error, unexpected T_PRINT, expecting T_STRING in /var/www/packet3/pavlin-angelov.net/htdocs/upload/test.php on line 7 What might be the problem?
  14. OK! Thank you! Colomn names must be with backticks or with nothing.
  15. Yes. I use single quotes.(second key, right to left, from third row of the keyboard.)
  16. HI aggain. I have problems with inserting data into table again. This is the error message: From: pavlin668Email: rtrrtrtrtrtrtrbbbbbbbbbbbbbbbYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''name','email', 'text') VALUES ('pavlin668','rtr', 'rtrtrtrtrtrbbbbbbbbbbbbbbb')' at line 1 And this is the code: <?php$email = $_POST["meil"];$message = $_POST["area"];$ime= $_POST["ime"];echo "From: ".$_POST["ime"]."<br>";echo "Email: ".$_POST["meil"]."<br>";echo $_POST["area"]."<br>";// Create connection$con=mysql_connect("sql5-host.dir.bg","U363_DB1007269","mishon24");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("DB1007269");if (!mysql_query("INSERT INTO backform ('name','email', 'text')VALUES ('$ime','$email', '$message')",$con)){exit(mysql_error($con));}else{echo "данните са въведени успешно";}mysql_close($con);show_source("mes.php");?> What might be thr reason for mistake?
  17. Hallo. I need some help. I am trying to create table in DB. It appears an error, and I can not find what is wrong. Here is the code: <?phpini_set('display_errors', 1); error_reporting(E_ALL); $con=msql_connect("localhost","pavlinan_db","mishon24");mysql_select_db("pavlinan_db");$sql="CREATE TABLE rabotna(id int not null auto_increment,col1,col2,col3,PRIMARY KEY(id));if(mysql_query($sql,$con)){echo "Таблицата е създадена успешно";}else{echo "Грешка при създаването на таблицата ".mysql_error($con);}?> And here is the error message: Parse error: in /home/pavlinan/public_html/upload/test.php on line 11
  18. At last success !! Thank you very mach! This is the final code: <?php$email = $_POST["meil"];$message = $_POST["area"];$ime= $_POST["ime"];echo "From: ".$_POST["ime"]."<br>";echo "Email: ".$_POST["meil"]."<br>";echo $_POST["area"]."<br>";// Create connection$con=mysql_connect("localhost","pavlinan_db","mishon24");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("pavlinan_backform");if (!mysql_query("INSERT INTO backform (`name` , `email` , `text` )VALUES ('$ime', '$email', '$message')",$con)) { exit(mysql_error($con));}mysql_close($con);show_source("mes.php");?>
  19. I inserted this code and this is what happened: "From: some personEmail: email@abv.bgsome textUnknown column 'some person' in 'field list'" "some person" comes from user input for $_POST["ime"]; This is the code: <?php$email = $_POST["meil"];$message = $_POST["area"];$ime= $_POST["ime"];echo "From: ".$_POST["ime"]."<br>";echo "Email: ".$_POST["meil"]."<br>";echo $_POST["area"]."<br>";// Create connection$con=mysql_connect("localhost","pavlinan_db","mishon24");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("pavlinan_backform");mysql_query("INSERT INTO backform (`name` , `email` , `text` )VALUES (`$ime`, `$email`, `$message`)",$con);if (!mysql_query("INSERT INTO backform (`name` , `email` , `text` )VALUES (`$ime`, `$email`, `$message`)",$con)) { exit(mysql_error($con));}mysql_close($con);show_source("mes.php");?>
  20. Hi I try to insert data into data base. This is a kind of feed form for back information from users. This is the code of php-file from which I try to send data to database on the server.: <?php$email = $_POST["meil"];$message = $_POST["area"];$ime= $_POST["ime"];echo "From: ".$_POST["ime"]."<br>";echo "Email: ".$_POST["meil"]."<br>";echo $_POST["area"]."<br>";// Create connection$con=mysql_connect("localhost","pavlinan_db","mishon24");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("pavlinan_backform");mysql_query("INSERT INTO backform (`name` , `email` , `text` )VALUES (`$ime`, `$email`, `$message`)",$con);mysql_close($con);show_source("mes.php");?> Now the file is runing good, no error messages, but when I go to databasa with MyPhpAdmin no data there. Database is named:pavlinan_backform. Table is named: backform.
  21. Thank you! That was the problem.
  22. Hallo, what might mean this message of error: "Parse error: syntax error, unexpected end of file in /home/pavlinan/public_html/mes.php on line 22" Here is the code: <?php$email = $_POST["meil"];$message = $_POST["area"];$ime= $_POST["ime"];echo "From: ".$_POST["ime"]."<br>";echo "Email: ".$_POST["meil"]."<br>";echo $_POST["area"]."<br>";// Create connection$con=mysql_connect("localhost","pavlinan_db","mishon24");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("pavlinan_backform");mysql_query("INSERT INTO `backform` (`name` , `email` , `text` )VALUES (`$ime`, `@email`, `$message`)`,$con);mysql_close($con);?>
×
×
  • Create New...