Jump to content

Search the Community

Showing results for tags 'php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Job Boards
    • Jobs
  • Community Lounge and FAQ
    • Forum News
    • Open Forum
    • New Members Forum - Start Here!
  • Entrepreneurship, Business and Marketing
    • Social Media Marketing & Web Marketing
    • Entrepreneurship
    • Career Questions - Asked and Answered
  • StudioWeb
    • StudioWeb
    • StudioWeb News
    • StudioWeb Projects
  • Programming
    • Python
    • Javascript
    • PHP
  • Web Design
    • Beginners Web Design
    • HTML/XHTML
    • Dreamweaver
    • CSS
    • Advanced Web Design
    • Business of Web Design
    • Web Design News
  • Miscellaneous
    • Cybersecurity
    • Miscellaneous Software
    • Blogs and CMS
    • Web Accessibility
    • Peer-to-Peer Reviews
    • Website Templates
    • Web Design Jobs
    • Test Forum
  • Archives
    • Beginners Web Design
    • Course: The Complete Entrepreneur
    • Web Accessibility
    • Photoshop
    • CSS
    • Forum Rules and Etiquette
    • Flash
    • ASP
    • General Programming
    • Expression Web
    • Beginners Ruby
    • Killersites University
    • Actionscript

Calendars

  • Community Calendar

Categories

There are no results to display.

There are no results to display.

Product Groups

  • Business & Entrepreneur Courses

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website


LinkedIn


Facebook


Twitter


AIM


Yahoo


Other


Location


Interests

  1. Hi, I am trying to download xml file from URLs containing feeds using CURL using the following code. The code downloads the xml file for LINK1 (below, for RSS feeds). The code downloads a HTML file (instead of xml) for LINK2 (below, for Atom feeds). If I open LINK2 in a browser I can save it as a xml file. I do not understand why the code cannot download the xml file for LINK2. Any help will be highly appreciated. //$url = 'https://rss.sciencedirect.com/publication/science/00221694'; //LINK1 $url = 'https://onlinelibrary.wiley.com/feed/25780727/most-recent'; //LINK2 $curl = curl_init($url); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $resp = curl_exec($curl); curl_close($curl); $myfile = fopen('x.xml', "w") or die("Unable to open file!"); fwrite($myfile, $resp); fclose($myfile);
  2. I always get confused on this part. I am playing with a mySql Maria DB. in my localhost PC.... ohhh am using PDO Am I just checking for "0" failure and "1" Success return? some extra code to see how many rows effected .. in DB2 a return code of 100, meant no records were found but it was a successful execution. What kinda things do i need to check for? do the all return a code? What is the DB goes down? will my query return a code? or will it fail in another place? Besides a down DB what else must i look for? Thanks
  3. I had a difficult time solving this bug, and finally solved it. I'm posting it here to help others who might be struggling with the same situation. Code Source: This code is from the Simple PHP Login System, Lesson 17 & 18. My Setup: Machine: Windows 10 WAMP PHP version: 7.4.9 Code Editor: VS Code Here is my error notice: Notice: Only variables should be passed by reference in C:\wamp64\www\phplogin-parts17-18-projectfiles\register.php on line 144 I got that error message when I tried to register a member. The problem lies in LINE 144 SOLUTION: You need to create a new variable that represents... md5($input['pass'] . $config['salt']) Let's call that variable $salty.... $salty = md5($input['pass'] . $config['salt']); ...and then insert that new variable $salty into ... $stmt->bind_param(x, x, x, x, $salty); The code should look like this: if ($stmt = $mysqli->prepare("INSERT members (username, email, type, password) VALUES (?,?,?,?)")) { $salty = md5($input['pass'] . $config['salt']); $stmt->bind_param("ssss", $input['user'], $input['email'], $input['type'], $salty); $stmt->execute(); $stmt->close(); Hope that helps! Stephen
  4. Hey guys! So far my website is looking great! Just trying to get this contact form to function. Wondering if everything lines up: HTML code: <!--contact-form-------------------> <section id="contact-form"> <form> <!--left---------------------------------------> <div class="contact-left"> <h1 class="c-l-heading"><font style="border-bottom: 3px solid #1ED98B;">Writ</font>e Me</h1> <!--name--------> <div class="f-name"> <font >Name</font> <input type="text" placeholder="Full Name"/> </div> <!--email--------> <div class="f-email"> <font >Email</font> <input type="email" placeholder="Example@gmail.com"/> </div> </div> <!--right-------------------------------------------> <div class="contact-right"> <!--message--------> <div class="message"> <font >Message</font> <textarea name="message" rows="5" cols="20" placeholder="Write Message..."></textarea> </div> <!--submit-btn------------> <button>submit</button> </div> </form> </section> php: ?php $name = $_POST['name']; /*this will display the name of the users */ $visitor_email = $_Post['email']; /*this will display the email of the user */ $message = $_POST['message']; /*this will store the message */ $email_from = 'Ryan-vand@outlook.com' /*I will receive this via this line of code */ $email_subject = "new form submission"; $email_body = "User Name: $name.\n"."User Email: $visitor_email.\n"."User Message: $message.\n"; $to = "Ryan-vand@outlook.com"; $headers = "From: $email_from\r\n"; mail($to,$email_subject,$email_body,$headers); header("Location: firstdraft.html"); ?>
  5. Hello guys, I just wanted to see the path that you guys take when making functionality changes in wordpress. In other words, how do you trace a specific functionality from the front end to the code responsible for it in the back end. Any suggestion will be appreciated!!
  6. The var_dump of the $cart_items array is supposed to show an array of $cart_items with the quantities added together for the same id but it doesn't even show an array, it just shows one value. session_start(); $cart_items = $_SESSION["cart_items"]; if ( $cart_items == null ) { $cart_items = array(); } if ( isset($_REQUEST["element_id"]) ) { $id = $_REQUEST["element_id"]; } if ( isset($_REQUEST["quantity"]) ) { $quantity = $_REQUEST["quantity"]; } if ( isset($id) && isset($quantity) ) { if (isset($cart_items[$id])) { $cart_items[$id] += $quantity; } else { $cart_items[$id] = $quantity; } } var_dump($cart_items);
  7. I've been studying SQL and PHP, but something isn't clicking in my brain about how to use then together. Could someone explain the connection and formatting PHP code with SQL queries or refer me to a tutorial please?
  8. Hi, I'm currently doing the shopping cart tutorial in studioweb projects. Minor errors appear whenever I add items to the cart and i'm using php 7.2.10. I'll add the screenshot below. I've tried to solve it but the errors won't go away.
  9. Hey, I just completed the Form Validation Project on Studioweb and I would really appreciate help regarding my doubts: 1. If we are enabling Server side validation as well as client side validation, and javascript is on, meaning validate plugin works so does the server side validation automatically turns off? in the tutorials and through my testing, its clear that PHP validation doesn't work when Validate plugin but why? Shouldn't both of them working at the same time? 2. Why do we need sessions in PHP if we can create and use associative arrays like $form['name'], $error['name'] etc. and then use them among different PHP pages? Thank you
  10. How could I find a reliable and affordable PHP web Development company.
  11. Hey guys and gals, before I ask, I do want to point out that PHP and JS seems very AWESOME to me and I really want to learn it. LIKE REALLY BAD. I am willing to do whatever I can to learn what I need to learn! So I just finished the 3rd project. Which is PHP Tag Cloud. And I am still having some trouble understanding what's going on within the code. For example, I am understanding the concepts of a 'loop' or 'if' and 'else', and 'while.' I get what they are doing. But, when it comes to the code itself(syntax), I am still pretty lost. In this example below, I am totally lost as far as the syntax, but I understand what we are trying to achieve. (this is a snippet of code from the downloaded zip file, not from my version of code) function get_tags() { $this->tags = array(); $this->largest = 0; // get tag id, tag name and the number of times the tag has been used $result = $this->mysqli->query("SELECT posts_to_tags.tag_id, tags.name, COUNT(posts_to_tags.tag_id) AS total FROM tags, posts_to_tags WHERE posts_to_tags.tag_id = tags.id GROUP BY posts_to_tags.tag_id"); if ($result->num_rows > 0) { while ($row = $result->fetch_object()) { // figure out which tag has been used the most often. However many times that tag was // used will be placed within $this->largest for later use if ($row->total > $this->largest) { $this->largest = $row->total; } // add tag to array $this->tags[] = array('id' => $row->tag_id, 'name' => $row->name, 'total' => $row->total); } // sort tags usort($this->tags, array('tagcloud_model', 'compare_names')); } else { // if there are no results to display $this->tags = FALSE; } } // used by the usort function within get_tags() above function compare_names($a, $b) { return strcmp($a['name'], $b['name']); } I should mention I have only been learning PHP for few days all together, only from Stef's course and these projects. Any tips, advice, or ideas on how to grasp it better?(obviously I am going to continue my learning process, videos, tutorials.) I just want to see if maybe I can understand these projects a bit better as I am learning them. Do you think I should continue the projects and trust the process as I go, or take a detour and try and understand some things more before I finish the projects? THANK YOU FOR ANY RESPONSES.
  12. I feel like an idiot. I put the class php files in the C:\MAMP\htdocs. When I show them in crome I see all the code. I do not know what I am doing wrong.
  13. Hello, After following along and successfully completing Ben's tutorial of the Online Shopping Cart, I figured I would try and make my own. The first major problem I am having is being able to display my products from my database in my index.php page. The goal is to actually see the images of each product displayed in index.php (like in the tutorial). This would then enable me to add my products to the cart.php page. I've checked the database connection and it does exist. My guess would be that I am using the wrong syntax to display my products in the "fetch_all_products()" method. *** M_PRODUCTS.PHP *** <?php class Products { private $Conn; private $db_table = "toys"; function __construct() { // here we're making sure that the connection from $conn in "init.php" is transferred // into our own private $conn property for usage in this object global $Conn; $this->Conn = $Conn; } // fetches and displays all products from db public function fetch_all_products($id = NULL) { if ($id = NULL) { $data = "<li>"; if ($result = $this->conn->query("SELECT * FROM " . $this->db_table . " ORDER BY name")) { if ($result->num_rows > 0) { while ($row = $result->fetch_array()) { $data .= array( "id" => $row["product_id"], "name" => $row["name"], "price" => $row["price"], "image" => $row["image"] ); } $data .= "</li>"; return $data; } else { return "<h1>Oops... Something went wrong!</h1>"; } } } } } *** INIT.PHP *** <?php // db connection $host = "localhost"; $user = "root"; $pass = "root"; $db = "cart"; $Conn = new mysqli($host, $user, $pass, $db); // error reporting ini_set("display_errors", 1); mysqli_report(MYSQLI_REPORT_ERROR); // constants define("shop_name", "Tremendous Toys"); define("main_path", "localhost/web_apps/shopping_cart/"); define("image_path", "localhost/web_apps/shopping_cart/images/"); // includes include("models/m_shopping_cart.php"); include("models/m_products.php"); // object integrations $Shopping_Cart = new Shopping_Cart(); $Products = new Products(); // session initialisation session_start(); *** INDEX.PHP *** <?php include("init.php") ?> <link rel="stylesheet" href="visual/style.css" type="text/css"> <body> <div id="whitespace"> <h1><?php echo shop_name ?></h1> <?php $Products->fetch_all_products(); ?> </div> </body>
  14. Hello! I just finished studioWeb JavaScript course and so far its been a great experience, really good course and easy to follow but i dont feel ready to jump to PHP , i feel like i need to learn more JavaScript what you suggest me to do, i want to learn more JS but I don't know exactly what to learn , should i learn more vanilla JS or start learning a framework lile vue or react. Thanks!
  15. Guest

    PHP Login System

    So, I have followed the instructions to a 'T,' yet I get a notice after I update the password. I thought I might be missing something from the videos, so I cut what I typed out and copied and pasted the source code files for the video section in it, but the exact same notice rendered in the browser. Any idea what's up with the notice? Does it have to do with deprecated code from previous versions, since Ben's browser was not rendering the same notice? else { // insert into database if ($stmt = $mysqli->prepare("UPDATE members SET password = ? WHERE id = ?")) { $stmt->bind_param("ss", md5($input['pass'] . $config['salt']), $_SESSION['id']); $stmt->execute(); $stmt->close(); // add alert and clear form values $error['alert'] = 'Password updated successfully!'; $input['current_pass'] = ''; $input['pass'] = ''; $input['pass2'] = ''; // show form include('views/v_password.php'); } else { echo "ERROR: Could not prepare MySQLi statement."; } }
  16. What does mean that variable is set or not set? (in PHP or general) Does that means: // no var declared $var; $var = 'Some fancy string'; $var = ""; //(empty string) I dont know all fancy terms, but I do know when variable is defined, declared and all that, but I dont know what variable is set means. Thanks in advance, nerdz!
  17. Hi there I've just started a fresh website for a non-profit organisation (meaning I won't get paid), so my options are: doing it as fast as possible, with minimum costs, standard interface, easy maintenance, strong community support. Therefore, being pragmatic, I've chosen WordPress (but i struggled finding out an appropriate free plugin... so I need to code it: PHP + mysqli). Now, this npo asked me for me a simple booking system for their training sessions. The business rules are: 1) several sessions available: A, B, C and D 2) A B C and D happen several times in a week 3) each user can book all 4, but can only book 1x (for the each session) 4) limit of seats per session: 20 5) total users : 100 (some will be left out, as soon as limit has been reached). 6) priority : FIFE (first in , first ENROLLED) 4) no payments involved My question is: which "tools" would you advise me? a ) create a new page OUT of WordPress with PHP? + mysqli? b ) create a new page OUT of WordPress with JAVASCRIPT? c ) create a new page WITH of WordPress with existing PLUGIN? nope, I couldn't find any suitable! d ) any other suggestion? Having done my research, many suggestions and recommendations show up...but I'd like your opinion according to your own experience. Txs
  18. Hi Thanks for the great tutorial! In medias res - just the way I like it. I thought I'd post questions as they come up, for a starter here's this: "Another convention is that getter and setter names should match the property names" Is this really just a convention or the class would not work at all otherwise? In other words do I need "var $name;" in order to set (and get) the value of "$this->name"?
  19. A question about MySQL beginners course, part of connecting mysql with php, the video was very quickly and i didnt understand well. 1) Is there any simple way to connect a user to a database without such apps such cPanel? (from MyAdmin) 2)You told - "I am just using cPanel to connect a user with a database". Is there some free cPanel alternative that would work good on both mac and windows operating systems? For example i found some alternatives but on the download page i didnt see macos supported.
  20. I just started Beginners PHP course, when i use echo to display the result, it shows nothing. When i open beginners course file with forms it doesnt display echo on the screen as well. Can someone help me solve this problem?
  21. Hi everyone, I'm currently on Chapter 4 of the PHP course and I'm having problems following up everything since I'm using ubuntu linux instead of a mac or windows pc. As a result, I can't install MAMP and I've had to try a couple of alternatives (LAMP and XAMPP) but neither seem to be similar enough to the MAMP that Stef uses in his videos (LAMP doesn't seem to have a user interface at all and XAMPP doesn't have a simple user friendly UI like MAMP does, which allows you to search files , like Stef does in lesson 2 chapt. 4 in order to find php.ini). Is there a better MAMP alternative for ubuntu? Also, when I search my computer, I have 3 different php.ini files in the following directories: /opt/lampp/etc /etc/php/7.0/apache2 /etc/php/7.0/cli Which one of the three am I meant to modify so that I can enable error messages? All of them have restricted writing permissions ("You are not the owner so you cannot change these permissions"). Any advice will be appreciated. Thanks in advance.
  22. Hi people! Since I couldnt get answers from Stackoverflow I desiced to ask you. Can someone explain how does these 2 functions work: class_exists() spl_autoload_register() Class exist function if(class_exists('User')){ echo "It does exists"; } class User { /* Some code here */ } // the output of file is "It does exists" So how does this function works? Scans whole file? Whole directory? I mean its called before I defined class. Spl autoload register function include 'functions.php'; // <- file where is the function class_exist('User') and spl_autoload_register() include 'db_config.php'; include 'database.php'; include 'user.php'; // <- Here is the class (User) So how does this function work? Its before any of those files that are included, and still it does it work? Does it scans whole directory where it is or what? I am really confused. Thanks peeps!
  23. Hi i have encountered one quirk in PHP, and I was wandering if anyone can explain it to me. So writing this code gives me infinite loop public static function find_this_query($sql){ global $Database; $result_set = $Database->queryFunction($sql); $theObjectArray = array(); $var = $result_set->fetch_assoc(); // I put the whole array in $var while($row = $var){ // and then I put that here // some code here } return $theObjectArray; } Buuuut this doesnt public static function find_this_query($sql){ global $Database; $result_set = $Database->queryFunction($sql); $theObjectArray = array(); while($row = $result_set->fetch_assoc()){ // here I just put method and everything works fine // some code here } return $theObjectArray; } So I just wanna know why. Thanks nerdzzzz!
  24. PHP form --> convert to WP form Hi there, I have several (legacy) php forms I'd like to re-use in my wp site. No way I will retype them again... therefore I'm looking for a way to import them directly into wp. Would you recommend any plugin? I understand pasting the original php code into the text editor will save me a lot of time, but it won't be final, since a lot of validation has to be done, etc... Do you have any experience with importing php forms into wp with a kind of 1-click solution? WP's plugins repository is not obvious on this matter...or maybe I've just missed it. txs
  25. Okay this is a newbie question but I know how it works but I just want to know how. So this code for example: if(isset($_POST['submit'])){ // do some stuff } else { // do some else stuff } This if statement will only do its code block if submit button is clicked or in nerds language if $_POST['submit'] is set. So thats means that value of that submit button is NULL before clicking, but when we click that submit button we are giving it a value? For example <input type="submit" name="submit" value="someAwesomeValue"> if I click this button its value will be 'someAwesomeValue' which means I set $_POST['submit'] value to 'someAwesomeValue' or in other words $_POST['submit'] = 'someAwesomeValue' Thanks!
×
×
  • Create New...