PHP - Moved: Best Place To Start Learning Php
This topic has been moved to Miscellaneous.
http://www.phpfreaks.com/forums/index.php?topic=334133.0 Similar TutorialsThis topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=346785.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=331627.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=319527.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=346405.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=334480.0 I have a copy of the Developer's Library book PHP and MySQL Web Development. It teaches PHP 5.3 and MySQL 5.1. It is an extensive book of almost 1000 pages. I know that PHP is now at 5.5, but is this still good enough to learn the basics or are there major differences?
Thanks.
Hello, I'm Dustin I going back to school for software development. this semester I am taking PHP and Javescript.
I just decided to start up on OOP, and it seems quite fun (yes, I find programming fun). But, I'm having trouble on this test OOP page. This is suppose to return the private variable $name, and if it's empty, it's suppose to echo the no name to return message. Code: <?php class findName { private $name; public function setName($sname) { if(!$sname) { $this->name = "There is no name to return."; } else { $this->name=$sname; } } public function getName() { return $this->name; } } $n = new findName(); $n->getName(); ?> If there is an easier way to do this, please let me now! Hello everybody, I'm Nishio and I started to program like a month ago, my basic idea was to be able to create websites and to work as a freelancer, I know HTML and CSS from what I can design a simple website, but most of the people who look for freelancers also look for PHP/ASP knowledge, and I know some basics of PHP, like variables, booleans and NULL, constants, arrays, if statement, but I don't know how to acctualy do anything a little more complex with it. So I guess what I am asking for is a mentor, somebody who would tell and show me how do I connect PHP with web design I already know. And no I do not have any money, so I am basicly asking for somebody who has nothing to do for 1/2 hours a day and knows PHP. Thanks in advance, and sorry if I posted in a wrong section. Hi, I am wanting to build a small internal web portal, hopefully in php, however I just want to check that I can do a few key things before I go down this road. This is for work, so rather than waste a bunch of time, I've got a few quick questions hopefully someone can answer for me. 1) Is it possible to grab NT login information such as NTSID, Domain username, Full name based on domain login 2) show/hide objects based on above login The portal is meant to be a front end access to a bunch of reports, and the ntsid and username are used as authentication for these reports. The idea is that a user navigates to the site, it says Hi John, here are the reports you have access to. The only part I really need to worry about is the hiding and showing of the reports, since they have their own built in security. I'll also want to have an add user page, which will mean i'll need a button that grabs an ntsid based on a username entered in a field. Are these things possible? Regards, Matt Can't figure out what is wrong with my function getVars here is my code Code: [Select] <?php echo"<?xml version=\1.0\"encoding=\UFT-8\"\x3f>"; echo"\n"; ?> <!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"lang="en"> <head> <title>My third PHP Generated Document</title> </head> <body> <h2> My Third PHP Document </h2> <?php echo "<h3>Today is ".date('l, F d, Y')."</h3>"; ?> <?php //calculate the area of an equilateral triangle function calcTriangle($cVal) { $halfSide = $cVal/2; $otherSide = sqrt(($cVal*$cVal) - ($halfSide*$halfSide)); $area = $otherSide * $halfSide; echo "<p>The area of an equilateral triangle whose sides are {$calcValue} is {$areaValue}.</p>\n"; } //calculate the area of a circle function calcCircle($cVal) { $areaValue = $calcValue * $calcValue * pi(); echo "<p>The area of a circle whose radius is {$calcValue} is {$areaValue}.</p>\n"; } //calculate the area of s square function calcSquare($cVal) { $areaValue = $calcValue * $calcValue; echo "<p>The area of a square whose sides are {$calcValue} is {$areaValue}.</p>\n"; } //function to test variables function testVars() { global $_POST; if (empty($_POST['vfld'])) { echo "<h3>Error</h3>"; echo "<p>You must enter a value!</p>\n"; return "no"; } else { return "yes"; } } //function to get variables function getVars(&$a, &$b, &$c) { global $_POST; $a->$workValue = $_POST['vfld']; $b->$workType = $_POST['tfld']; $c->$calcValue = (float) $workValue; return; } $workValue = (isset($_POST['vfld']))?$_POST['vfld']:''; $workType = (isset($_POST['tfld']))?$_POST['tfld']:''; if (isset($_POST['submit'])) { if ($_POST['submit'] == "Clear") { clearVars(); } elseif ($_POST['submit'] == "Calculate") { getVars(); $continue = testVars(); if ($continue == "yes") { switch ($workType) { case "circle": calcCircle($workVal); break; case "square": calcSquare($workVal); break; case "triangle": calcTriangle($workVal); break; } } } } <form method="post" action="hw06.php" id="form1" name="form1"> <p> Enter a number here : <input type="text" id="vfld" name="vfld" value="<?php echo $workValue; ?>"/> </p> <p> This number is: <br /> <input type="radio" name="tfld" value="circle" <?php if ($workType == "circle") { echo 'checked="checked"'; } ?> /> : the radius of a circle <br /> <input type="radio" name="tfld" value="square" <?php if ($workType == "square") { echo 'checked="checked"'; } ?> /> : the length of one side of a square <br /> <input type="radio" name="tfld" value="triangle" <?php if ($workType == "triangle") { echo 'checked="checked"'; } ?> /> : the length of one side of an equilateral triangle </p> <p> <input type="submit" name="submit" value="Calculate" /> <input type="submit" name="submit" value="Clear" /> </p> </form> <div id="footer"> </div> </body> </html> and here are my errors Warning: Missing argument 1 for getVars(), called in /studfs1/homepage/CISS-225/hw06.php on line 69 and defined in /studfs1/homepage/CISS-225/hw06.php on line 55 Warning: Missing argument 2 for getVars(), called in /studfs1/homepage/CISS-225/hw06.php on line 69 and defined in /studfs1/homepage/CISS-225/hw06.php on line 55 Warning: Missing argument 3 for getVars(), called in /studfs1/homepage/CISS-225/hw06.php on line 69 and defined in /studfs1/homepage/CISS-225/hw06.php on line 55 Notice: Undefined variable: workValue in /studfs1/homepage/CISS-225/hw06.php on line 57 Fatal error: Cannot access empty property in /studfs1/homepage/CISS-225/hw06.php on line 57 Any help would be greatly appreciated please explain too Hey sorry that I am asking this question, though I have gotten around to learn connecting to a database and also do the retrieve, yet I am not necessarily getting to learn doing INSERT, UPDATE and DELETE the proper way.
The tutorials available are often not best, I have found a good book ("Object Oriented Programming in PHP5") which teaches SELECT, yet not necessarily INSERT, UPDATE and DELETE.
I am really wondering how does one get to learn CRUD with PHP OOP, how did you people learn this? How can I learn INSERT, UPDATE and DELETE as well with PHP OOP? I feel like paying for this on Elance or Fiverr. I am not sure how else to learn this by now, I have tried quite a bit, I have looked at scripts and tutorials and books. And it has just gotten as far as connecting to the database and doing the "fetching" ("SELECT", or also "retrieve"). Too bad that what is available is not necessarily best. Otherwise I would say one could understand the principle quickly and also pick up on a programming language quickly. Please bear with me, I would appreciate suggestions. Hey people!
I'm new here and I desperately need your help! I have my PHP exam on monday so I'm practicing with codeacademy. I know it's easy stuff for you, but don't judge and help a girl out please!
These are the instructions:
Create a class called Cat.
Add two public properties to this class: $isAlive ought to store the value true and $numLegsshould contain the value 4.
Add a public $name property, which gets its value via the__construct()or.
Add a public method calledmeow(), which returns "Meow meow".
Create an instance of the Catclass, which has the $name "CodeCat".
Call the meow() method on thisCat and echo the result.
This is my code:
<?php
I know this function will get one result, I suspect foreach is the wrong loop to use, should I be using a loop at all? Can someone correct me please. public function getSites($site) { $sql = "SELECT * FROM website WHERE website_id = ?"; $stmt = $this->connect()->prepare($sql); $stmt->execute($site) $siten = $stmt->fetch(); foreach ($siten as $row) { $title = $row["website_title"]; $wname = $row["website_name"]; $image1 = "header.jpg"; $metadesc = $row["website_description"]; $wurl = $row["website_url"]; $gtag = $row["website_gtag"]; $gmap = $row["website_map"]; $wcss = $row["website_css"]; } } Edited February 23 by guymclarenza At the moment I have <input type="hidden" name="iput-time1" value="2021-06-21 01:00"> and the time gets put in the script by $IpTime= $_POST['iput-time1']; So how can I get the time that I would put in <td>01:00</td> and do away with the hidden input bit. I have no idea even if I explained that right When I say I'm a noobie, I'm not kidding!
I'm using a hosting service (Bluehost) that offers PHP 5.4.30 and mySQL 5.5.37 and am trying to work through a beginners tutorial. Using the service's PHPMyAdmin tool, I have no trouble creating a database and table that I can manipulate using this tool. My problem is with my very first php command:
$db = new mysqli(localhost, 'me', 'pw', 'RR');
'me' and 'pw' are my Bluehost signon credentials that were also required to get into the PHPMyAdmin tool. 'RR' is the actual name of the database I'd created. I'm not sure if these are what mySQL is looking for. I also tried 'root' and a null password as done in the tutorial, but that didn't help. The message I get is:
Connect failed: Access denied for user 'me'@'localhost' to database 'RR'
I'd love to get somewhat proficient on PHP/mySQL. Please help.
So i've been wanting to expand my php horizons if you will and finally break of my fear of OOP. Here's a simple connection script i built, however i'm kind of stuck on a part of it. user passes username/password. i instantiate the mysqlcon class and call the connect function. the connect function attempts a connection to the database. if successful, pass on the username and password to the authenticator class. call the authenticate function. select user based on username/passwrod criteria. if found return "Confirmed" otherwise "Denied" here's my issue, i'm assuming that my Code: [Select] return $this->ok variable is returned back to the mysqlcon class. however how can i return that variable once more back outside of the object class so that i can continue with my script assuming authentication was confirmed. Here's my code... thanks for the help! <?php ## OOP PRACTICE ## class mysqlcon { function connect($user,$pass) { //Note: Connect to the database $db = mysql_connect("localhost", "usr","psw") or die(mysql_error()); if(mysql_select_db("database",$db) or die(mysql_error())) { $auth = new authenticator(); $auth->authenticate($user,$pass); } } } class authenticator { var $ok = "Confirmed"; var $ex = "Denied"; function authenticate($user,$pass) { //Note: User user and pass variables to check for user in table $qry = "SELECT * FROM users WHERE username = '$user' AND password = '$pass'"; $sql = mysql_query($qry) or die(mysql_error()); $cnt = mysql_num_rows($sql); if($cnt > 0) { return $this->ok; } else { return $this->ex; } } } $con = new mysqlcon(); $con->connect($_POST['username'],$_POST['password']); ?> PS: the classes are in class.php and the instantiation are in index.php. I just placed them together for easy of viewing. Hello This is what I am wanting to do can it be done in php without database or mysql? Basically what I would like to do is from a seach box on my site I would like to take the search term that the user inputs into that search box and then place that seach term on a php page that is automatically generated with the filename search-term.php and is added to a sidebar. The keyword would also be placed on the webpage with a tag %searchterm% so I can have text "you searched for %searchterm%" and it will echo the users search term that they put into the search box. Like I said I am new to php coding so this is a project that I would like to try. It will involve auto generating php files and auto adding links to pages and keyword grabbing. I would like to do this with out mysql or databases. Hi I'm attempting to learn more advanced PHP, such as OOP and the integration of XML, by making a browser-based version of the old Richard Garfield card game "Netrunner". I have a few years experience with pretty basic (bordering on intermediate) PHP. I've done some very basic coding for the game with PHP forms and I've researched some OOP (classes, objects, methods, etc.) but I'm not finding the beginner tutorials that I need. Everything I find has terminology and code that is beyond me. Does anyone have any book or website suggestions for me? I've tried the PHP online manual, but even that throws in advanced stuff all over the place. My goal is to better learn how to use PHP (because I've already put time into it) to create browser based games. Many thanks, Andy need help. am learning php oop. Logic below breaks when processing second parent. $db was defined a second time? Suggestions? Do i need to define new database for child??? $db = new Database; $Query = ('Select parentId from PARENT'); $db->query($Query); while ($db->nextRecord()){ $PARENT_ID = $db->Record['PARENT_ID']; $PARENT_NAME = $db->Record['PARENT_NAME']; $Query = ('Select * from CHILD where CHILD_PARENT_ID = $PARENT_ID'); $db->query($Query); while ($db->nextRecord()){ print "child name: $db->Record['CHILD_NAME']; } } |