<?xml version="1.0"?>
<rss version="2.0"><channel><title>Beginners PHP Videos Latest Topics</title><link>https://www.killersites.com/community/index.php?/forum/37-beginners-php-videos/</link><description>Beginners PHP Videos Latest Topics</description><language>en</language><item><title>object oriented</title><link>https://www.killersites.com/community/index.php?/topic/30808-object-oriented/</link><description><![CDATA[<p>
	where is the error object oriented step 16 page 3?
</p>
]]></description><guid isPermaLink="false">30808</guid><pubDate>Tue, 18 Oct 2022 11:35:13 +0000</pubDate></item><item><title>Vue.js, Laravel commenting system pagination</title><link>https://www.killersites.com/community/index.php?/topic/27700-vuejs-laravel-commenting-system-pagination/</link><description><![CDATA[<p style="background-color:#ffffff;color:#222222;font-size:15.008px;">
	I am building blog commenting system, using laravel 5.8 and vue.js. I want to add paginate function to comments as per instructions<span> </span><a href="https://adevait.com/laravel/laravel-overwriting-default-pagination-system" rel="external nofollow">https://adevait.com/laravel/laravel-overwriting-default-pagination-system</a>.
</p>

<p style="background-color:#ffffff;color:#222222;font-size:15.008px;">
	Now I can display five comments, and after I click load more,
</p>

<p style="background-color:#ffffff;color:#222222;font-size:15.008px;">
	I want to show next five comments.
</p>

<p style="background-color:#ffffff;color:#222222;font-size:15.008px;">
	I have no idea how to accomplish. I am glad if someone helps me out.
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">comments.vue

user
Cancel Comment

{{ comment.user.name }}
{{ comment.body }}</span></pre>

<div style="background-color:#ffffff;color:#222222;font-size:15.008px;">
	<div>
		<div>
			<div>
				<div>
					<p>
						<span style="background-color:#ffffff;color:#222222;font-size:15.008px;">commentsController.php</span>
					</p>
				</div>
			</div>
		</div>
	</div>
</div>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">public function index(Post $post)
{
return $post-&gt;comments()-&gt;with(‘user’)-&gt;paginate(5);
}
ResultsController.php</span></pre>

<p style="background-color:#ffffff;color:#222222;font-size:15.008px;">
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">public function show(Post $post)
{
$recommended_posts = Post::latest()
-&gt;whereDate(‘date’,’&gt;’,date(‘Y-m-d’))
-&gt;where(‘category_id’,’=’,$post-&gt;category_id)
-&gt;where(‘id’,’!=’,$post-&gt;id)
-&gt;limit(7)
-&gt;get();

// load the post comments here
$post-&gt;load('comments');
$posts['particular_post'] = $post;
$posts['recommended_posts'] = $recommended_posts;

return view('posts.show',compact('posts'));
}
show.blade.php</span></pre>

<p style="background-color:#ffffff;color:#222222;font-size:15.008px;">
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Route::get(‘results/{post}’, ‘ResultsController@show’)-&gt;name(‘posts.show’);
Route::get(‘results/{post}/comments’, ‘CommentsController@index’);</span></pre>

<p>
	 
</p>
]]></description><guid isPermaLink="false">27700</guid><pubDate>Tue, 19 Oct 2021 13:05:09 +0000</pubDate></item><item><title>Sublime text 3 view in browser not working</title><link>https://www.killersites.com/community/index.php?/topic/24123-sublime-text-3-view-in-browser-not-working/</link><description><![CDATA[<p>
	Managed to get server set up so issue resolved now.
</p>]]></description><guid isPermaLink="false">24123</guid><pubDate>Thu, 09 Jul 2020 11:37:11 +0000</pubDate></item><item><title>.php file won't open in browser?</title><link>https://www.killersites.com/community/index.php?/topic/22631-php-file-wont-open-in-browser/</link><description><![CDATA[<p>
	Using XAMPP, I have placed the file in htdocs, but when trying to open there isn't a browser option. The default is my code editor, so it just returns the code instead of running the code and displaying the result.Any suggestions?
</p>]]></description><guid isPermaLink="false">22631</guid><pubDate>Wed, 21 Nov 2018 01:22:45 +0000</pubDate></item><item><title>Studio web projects - PHP courses</title><link>https://www.killersites.com/community/index.php?/topic/23345-studio-web-projects-php-courses/</link><description><![CDATA[
<p>
	Hi! I have gone through the web foundations courses and they were great!
</p>

<p>
	Now I am starting with hte Studio Web projects. Since the courses are recorded in 2010 or so, is there a risk that we learn old standards?
</p>

<p>
	I have gone through "Form Validation JS, PHP", "Crud Basics MySqli PHP" and now starting at "PHP Tag cloud". I had not seen the "var" keyword before ( I started learning PHP in 2018) so I had to look it up.
</p>

<p>
	On Stackoverflow where someone replied: It's for declaring class member variables in PHP4, and is no longer needed. It will work in PHP5, but will raise an E_STRICT warning in PHP from version 5.0.0 up to version 5.1.2, as of when it was deprecated. Since PHP 5.3, var has been un-deprecated and is a synonym for 'public'.
</p>

<p>
	I guess the general content and principles are still valid but my plan is to go throuh the courses to get the general idea and then create PHP7 apps of my own to learn what is current standards.
</p>

<p>
	Or are there any plans in updating the videos??
</p>
]]></description><guid isPermaLink="false">23345</guid><pubDate>Fri, 03 Jan 2020 17:22:13 +0000</pubDate></item><item><title>Override Parent Class</title><link>https://www.killersites.com/community/index.php?/topic/23012-override-parent-class/</link><description><![CDATA[
<p>
	I need to add more code to an existing function located inside the parent class. I'm using code like this but can't get it working <span>:</span>
</p>

<p>
	 
</p>

<pre class="ipsCode prettyprint lang-php prettyprinted">
<span class="com">// Parent</span><span class="pln">

</span><span class="kwd">class</span><span class="pln"> </span><span>Default_Fields</span><span class="pln"> </span><span class="pun">{</span><span class="pln">

    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> fields</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">

        $this</span><span class="pun">-&gt;</span><span class="pln">_fields </span><span class="pun">=</span><span class="pln"> array</span><span class="pun">()</span><span class="pln">
            
        </span><span class="com">// Default Code</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">

</span><span class="pun">}</span><span class="pln">


</span><span class="com">// Child</span><span class="pln">

</span><span class="kwd">class</span><span class="pln"> </span><span>More_Fields</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span>Default_Fields</span><span class="pln"> </span><span class="pun">{</span><span class="pln">

    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> fields</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">

        $this</span><span class="pun">-&gt;</span><span class="pln">_fields </span><span class="pun">=</span><span class="pln"> array</span><span class="pun">()</span><span class="pln">
            
        </span><span class="com">// Modified Code</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">

</span><span class="pun">}</span><span class="pln">


$new </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span>More_Fields</span><span class="pun">;</span><span class="pln">

$new</span><span class="pun">-&gt;</span><span class="pln">fields</span><span class="pun">();</span></pre>

<p>
	<span>The modified code in the child class is an extended version of whats in the parent. There's no errors but the additional code is not printing. </span>
</p>

<p>
	<span>I can link to the complete file containing all the parent code if needed.</span>
</p>
]]></description><guid isPermaLink="false">23012</guid><pubDate>Sat, 28 Sep 2019 07:45:07 +0000</pubDate></item><item><title>PHP echo doesnt print the result on screen</title><link>https://www.killersites.com/community/index.php?/topic/22382-php-echo-doesnt-print-the-result-on-screen/</link><description><![CDATA[<p>
	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?
</p>]]></description><guid isPermaLink="false">22382</guid><pubDate>Fri, 16 Mar 2018 18:41:13 +0000</pubDate></item><item><title>Raspberry Pi Server</title><link>https://www.killersites.com/community/index.php?/topic/22491-raspberry-pi-server/</link><description><![CDATA[
<p>
	I'm posting this in ecstacy!
</p>

<p>
	I'm using my Raspberry Pi as my Web server instead of loading MAMP on my desktop.
</p>

<p>
	I wasn't sure, where in the Linux file system to place htdocs, so I Googled and found out that you place it the same place you place your web pages in /var/www/html.
</p>

<p>
	So, now, to view my php pages, i just open Chrome and in the address bar type 10.0.0.238//phpfilename.php.
</p>

<p>
	It works like a charm.
</p>

<p>
	-Mike
</p>
]]></description><guid isPermaLink="false">22491</guid><pubDate>Sat, 02 Jun 2018 05:27:34 +0000</pubDate></item><item><title>Using Git with MAMP, XAMPP etc.</title><link>https://www.killersites.com/community/index.php?/topic/22486-using-git-with-mamp-xampp-etc/</link><description><![CDATA[
<p>
	I'm new to PHPland, but not to Git. I use version control all the time with my NodeJS/React apps, but I'm thrown off a bit with having to use a dedicated folder inside MAMP to run my PHP site during the <strong>CRUD Basics with MySQLi &amp; PHP</strong> course. The way I'm used to doing things is I have a large GitHub folder with all my projects inside of it, and I would just `cd` into the project folder with my terminal and run a localhost server with a script.
</p>

<p>
	Is MAMP just a GUI tool for noobs who avoid the terminal? What are the best practices here? Do I `git init` inside the MAMP/htdocs directory or better yet, inside MAMP/htdocs/projectFolder ? Or do I change MAMP's default location for htdocs with each new project?
</p>

<p>
	 
</p>

<p>
	Thanks,
</p>

<p>
	 
</p>

<p>
	Alex
</p>
]]></description><guid isPermaLink="false">22486</guid><pubDate>Thu, 24 May 2018 03:34:04 +0000</pubDate></item><item><title>Over Use of constants.... in OOP</title><link>https://www.killersites.com/community/index.php?/topic/22460-over-use-of-constants-in-oop/</link><description><![CDATA[
<p>
	Am new to PHP, and OOP but....<br><br>
	Is it possible to over use Constants? 
</p>

<p>
	const = "77";
</p>

<p>
	<span style="background-color:#ffffff;color:#000000;font-size:16px;">define("CONTACT_URL", "localhost/contact.html?");<br><br>
	Specially in OOP?.... <br><br>
	What about something like current Customer ID, status, current loaded URL? .... I changes from Page load to page load but it is constant during a page load</span>
</p>

<p>
	<span style="background-color:rgb(255,255,255);"><font color="#000000"><span style="font-size:16px;">These things are retrieves and validated at very start of a page load. I am just wondering why I don't see more scrips with Constants</span></font></span>
</p>
]]></description><guid isPermaLink="false">22460</guid><pubDate>Sat, 05 May 2018 14:15:26 +0000</pubDate></item><item><title>Strict standards: Only variables should be passed by reference</title><link>https://www.killersites.com/community/index.php?/topic/22116-strict-standards-only-variables-should-be-passed-by-reference/</link><description><![CDATA[
<table border="1" cellpadding="1" cellspacing="0" dir="ltr" width="975" style="height:128px;"><tbody>
<tr>
<th align="left" bgcolor="#f57900" colspan="5">
				<font size="1">Strict standards: Only variables should be passed by reference in C:\wamp64\www\oop_php_login_projectfiles\models\m_auth.php on line <i>30</i></font>
			</th>
		</tr>
<tr>
<th align="left" bgcolor="#e9b96e" colspan="5">
				<font size="1">what does the above mean</font>
			</th>
		</tr>
<tr>
<th align="center" bgcolor="#eeeeec">
				<font size="1">#</font>
			</th>
			<th align="left" bgcolor="#eeeeec">
				<font size="1">Time</font>
			</th>
			<th align="left" bgcolor="#eeeeec">
				<font size="1">Memory</font>
			</th>
			<th align="left" bgcolor="#eeeeec">
				<font size="1">Function</font>
			</th>
			<th align="left" bgcolor="#eeeeec">
				<font size="1">Location</font>
			</th>
		</tr>
<tr>
<td align="center" bgcolor="#eeeeec">
				<font size="1">1</font>
			</td>
			<td align="center" bgcolor="#eeeeec">
				<font size="1">0.0010</font>
			</td>
			<td align="right" bgcolor="#eeeeec">
				<font size="1">251576</font>
			</td>
			<td bgcolor="#eeeeec">
				<font size="1">{main}( )</font>
			</td>
			<td bgcolor="#eeeeec" title="C:\wamp64\www\oop_php_login_projectfiles\login.php">
				<font size="1">...\login.php<b>:</b>0</font>
			</td>
		</tr>
<tr>
<td align="center" bgcolor="#eeeeec">
				<font size="1">2</font>
			</td>
			<td align="center" bgcolor="#eeeeec">
				<font size="1">0.0180</font>
			</td>
			<td align="right" bgcolor="#eeeeec">
				<font size="1">288400</font>
			</td>
			<td bgcolor="#eeeeec">
				<font size="1">Auth-&gt;validateLogin( )</font>
			</td>
			<td bgcolor="#eeeeec" title="C:\wamp64\www\oop_php_login_projectfiles\login.php">
				<font size="1">...\login.php<b>:</b>21</font>
			</td>
		</tr>
</tbody></table>
<p><a class="ipsAttachLink" href="//www.killersites.com/community/applications/core/interface/file/attachment.php?id=528">login.php</a></p>
<p><a class="ipsAttachLink" href="//www.killersites.com/community/applications/core/interface/file/attachment.php?id=529">m_auth.php</a></p>
]]></description><guid isPermaLink="false">22116</guid><pubDate>Mon, 23 Oct 2017 14:18:28 +0000</pubDate></item><item><title>Tiny_mce: Image uploading How To?</title><link>https://www.killersites.com/community/index.php?/topic/6132-tiny_mce-image-uploading-how-to/</link><description><![CDATA[
<p>Hey guys <img src="https://www.killersites.com/community/uploads/emoticons/default_smile.png" alt=":)" data-emoticon="" srcset="https://www.killersites.com/community/uploads/emoticons/smile@2x.png 2x" width="20" height="20"></p>
<p> </p>
<p>I am following Bens video tutorial on building CMS!</p>
<p>Everything works just fine! btw awesome tutorial! easy to follow to!</p>
<p> </p>
<p>The thing is.. i am working on a site for a customer!</p>
<p>The point with this site is that the customer should be able to update his site </p>
<p>with images and text himself!</p>
<p> </p>
<p>And for that i have tiny_mce installed! (as in the video tutorial ).</p>
<p>But how do i upload images into tiny_mce? </p>
<p>Is there a way to upload images right from a desktop on the computer?</p>
<p> </p>
<p>Thanks !</p>
]]></description><guid isPermaLink="false">6132</guid><pubDate>Wed, 21 Sep 2011 08:43:17 +0000</pubDate></item><item><title>Error Using Mail Function Of  Php</title><link>https://www.killersites.com/community/index.php?/topic/21402-error-using-mail-function-of-php/</link><description><![CDATA[
<p>Hi,</p>
<p>I am trying to test if I can send an email from my php form to my email to send some information which I fill in my html form.</p>
<p>by clicking on submit button i receive the Waring:</p>
<p> </p>
<p>"Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\projectinteractive\process.php on line 24"</p>
<p>and I get no email with information </p>
<p> </p>
<p>I have searched for php.ini file but I couldent find it.</p>
<p> </p>
<p>do you have any idea?</p>
<p> </p>
<p>thanks</p>
]]></description><guid isPermaLink="false">21402</guid><pubDate>Sat, 25 Jan 2014 23:11:02 +0000</pubDate></item><item><title><![CDATA[Notice: Undefined Variable: <Variable> In C:\...]]></title><link>https://www.killersites.com/community/index.php?/topic/17445-notice-undefined-variable-in-c/</link><description><![CDATA[
<p>I am new to PHP, and while following the tutorial from the videos (MySQL, SQL &amp; PHP) I kept on getting the following error message:</p>
<p> </p>
<p><span style="text-decoration:underline;"><strong>Notice: undefined variable: </strong></span><span style="text-decoration:underline;"><strong><strong>my_rows</strong></strong></span><span style="text-decoration:underline;"><strong> in c:\...</strong></span></p>
<p> </p>
<p>However, the variable 'my_rows' has been declared, as shown on the code below. I have made change on the php.ini (error_reporting) without success. Can anyone help???</p>
<p> </p>
<p>$query = "SELECT * FROM people";</p>
<p>$result = mysql_query($query);</p>
<p>$my_rows;</p>
<p>while($row = mysql_fetch_array($result, MYSQL_ASSOC))</p>
<p>{</p>
<p>    $my_rows = $my_rows . "Name : {$my_rows['name']} &lt;br&gt;" . "id : {$row['id']} &lt;br&gt;&lt;br&gt;";</p>
<p>}</p>
<p>mysql_close($my_connection);   </p>
<p>?&gt;</p>
<p>&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;?php echo $my_rows; ?&gt;</p>
]]></description><guid isPermaLink="false">17445</guid><pubDate>Tue, 10 Sep 2013 05:55:53 +0000</pubDate></item><item><title>How To Delete And Edit</title><link>https://www.killersites.com/community/index.php?/topic/17319-how-to-delete-and-edit/</link><description><![CDATA[
<p>i dont have a idea how to delete and edit but i try to delete but when i delete it deleted all. without using MYSQL</p>
<p><strong> </strong></p>
<p><strong>index.php</strong></p>
<p> </p>
<p>&lt;html&gt;</p>
<p>&lt;head&gt;&lt;title&gt; PROJECT &lt;/title&gt;</p>
<p>&lt;/head&gt;</p>
<p>&lt;body bgcolor="#B0FF30"&gt;</p>
<p>&lt;div align="center" style="border:100px solid black"&gt;&lt;/br&gt;</p>
<p>&lt;h2 style = "background-color:yellow;"&gt;PROJECT&lt;/h2&gt;</p>
<p>&lt;/div&gt;&lt;/br&gt;</p>
<p> </p>
<p>&lt;form action="add.php" method="post"&gt;</p>
<p>&lt;font color="red"&gt;</p>
<p>&lt;strong&gt;ID&lt;/strong&gt;&lt;input type= 'text' name = 'id'&gt;</p>
<p>&lt;h6 style="font-family:verdana;"&gt;Name&lt;/h6&gt;&lt;input type="text" name="name"&gt;&lt;br&gt;</p>
<p>&lt;h6 style="font-family:verdana;"&gt;Telephone&lt;/h6&gt;&lt;input type="text" name="telephone"&gt;&lt;br&gt;</p>
<p>&lt;input type="submit" value="Add"&gt;</p>
<p>&lt;input type="reset" value="Clear"&gt;</p>
<p>&lt;/font&gt;</p>
<p>&lt;/form&gt;	</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p>
<p> </p>
<p> </p>
<p><strong>add.php</strong></p>
<p><strong> </strong></p>
<p>&lt;?php</p>
<p> </p>
<p>$fn = "file.txt";</p>
<p>$mode = "a";</p>
<p>$content = $_POST['id']." ".$_POST['name']." ".$_POST['telephone'].PHP_EOL;</p>
<p> </p>
<p> </p>
<p>if($mode == 'w' || $mode == 'a'){</p>
<p>$file = fopen ($fn, $mode) or exit ("ERROR!!!!");</p>
<p>fwrite ($file, $content)."&lt;/br&gt;";</p>
<p>}</p>
<p>else {</p>
<p>$file = fopen ($fn,$mode) or exit ("ERROR!!!!");</p>
<p>while (!feof($file)){</p>
<p>echo fgets ($file);</p>
<p>}</p>
<p>}</p>
<p>fclose($file);</p>
<p>echo "&lt;script&gt;window.location.href='view.php';&lt;/script&gt;";</p>
<p> </p>
<p>?&gt;</p>
<p> </p>
<p><strong>view.php</strong></p>
<p><strong> </strong></p>
<p>&lt;html&gt;</p>
<p>&lt;body bgcolor="#FFFF00"&gt;</p>
<p>&lt;div align="center" style="border:80px solid red"&gt;</p>
<p>&lt;/div&gt;&lt;/br&gt;</p>
<p>&lt;/br&gt;&lt;center&gt;</p>
<p>&lt;?php</p>
<p>$fn = "file.txt";</p>
<p>$mode = "r";</p>
<p> </p>
<p>$file = fopen ($fn,$mode);</p>
<p>?&gt;</p>
<p> </p>
<p>&lt;table border="12"&gt;</p>
<p>&lt;tr&gt;</p>
<p>&lt;td&gt;ID&lt;/td&gt;&lt;td&gt;Name&lt;/td&gt;&lt;td&gt;Telephone&lt;/td&gt;&lt;td&gt;Action&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p> </p>
<p>	&lt;tr&gt; </p>
<p>&lt;?php</p>
<p>while(!feof($file)){</p>
<p>$content = fgets($file);</p>
<p>$val = explode(" ",$content);</p>
<p>?&gt;</p>
<p> </p>
<p>&lt;td&gt;&lt;?php echo $val[0];?&gt;&lt;/td&gt;</p>
<p>&lt;td&gt;&lt;?php echo $val[1];?&gt;&lt;/td&gt;</p>
<p>&lt;td&gt;&lt;?php echo $val[2];?&gt;&lt;/td&gt;</p>
<p>    	&lt;td&gt;&lt;a href="update.php?id=&lt;?=$row['id']?&gt;"&gt;[Edit]&lt;/a&gt; &lt;a </p>
<p> </p>
<p>href="del.php?id=&lt;?=$row['id']?&gt;"&gt;[Delete]&lt;/a&gt;&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p>&lt;?php }?&gt;</p>
<p>&lt;tr&gt;&lt;td colspan="16"&gt;&lt;a href="index.php" &gt;Add New Record&lt;/a&gt;</p>
<p>&lt;/td&gt;&lt;/tr&gt;</p>
<p>&lt;/center&gt;</p>
<p>&lt;/table&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;</p>
<p> </p>
<p>&lt;div align="center" style="border:80px solid red"&gt;</p>
<p>&lt;/div&gt;&lt;/br&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p>
<p> </p>
<p> </p>
<p><strong>edit.php</strong></p>
<p><strong> </strong></p>
<p>&lt;?php</p>
<p>  $fn = "file.txt";</p>
<p>	$mode = "a";</p>
<p>$content= $POST_['name']."&lt;br&gt;".$_POST['telephone'];</p>
<p> </p>
<p> </p>
<p>$name= ($_POST['name'])?$_POST['name']:'';</p>
<p>$age= ($_POST['telephone'])?$_POST['telephone']:'';</p>
<p>$id	= ($_POST['id'])?$_POST['id']:'';</p>
<p> </p>
<p>if($name=="" || $telephone==""){</p>
<p>	echo "&lt;script&gt;alert('Succesfully Verified');history.back();&lt;/script&gt;";</p>
<p> </p>
<p>}else{</p>
<p>	$content("update users set name='".$name."', telephone='".$telephone."' where id='".$id."'");</p>
<p>	echo "&lt;script&gt;alert('Record successfuly updated.');window.location.href='view.php';&lt;/script&gt;";</p>
<p>}</p>
<p>?&gt;</p>
<p> </p>
<p>&lt;a href='view.php'&gt; ==&gt; Back to Home&lt;==&lt;/a&gt;</p>
<p> </p>
<p> </p>
<p><strong>update.php</strong></p>
<p><strong> </strong></p>
<p>&lt;?php</p>
<p>$fn = "file.txt";</p>
<p>$mode = "a";</p>
<p>$file = fopen($fn, $mode);</p>
<p>$name= ($_GET['id'])?$_GET['id']:'';</p>
<p>$telephone= ($_GET['id'])?$_GET['id']:'';</p>
<p>$id = ($_GET['id'])?$_GET['id']:'';</p>
<p>?&gt;</p>
<p> </p>
<p>&lt;html&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;div style="border:1px solid;"&gt; </p>
<p> </p>
<p>&lt;form action="edit.php" method="post"&gt;</p>
<p>&lt;input type='hidden' name="id" value="&lt;?=($_GET['id'])?$_GET['id']:''?&gt;"&gt;&lt;/br&gt;</p>
<p>Name &lt;input type="text" name="name" value="&lt;?php $_GET['$name'];?&gt;"&gt;&lt;/br&gt;</p>
<p>Telephone &lt;input type="text" name="telephone" value=""&lt;?php echo $_GET['$age'];?&gt;"&gt;&lt;/br&gt;</p>
<p>&lt;input type="submit" value="Update"&gt;</p>
<p>&lt;input type="reset" value="Reset"&gt;</p>
<p>&lt;/form&gt;	</p>
<p>&lt;a href="view .php" &gt;==&gt;View Record List&lt;==&lt;/a&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p>
<p> </p>
<p><strong>del.php</strong></p>
<p>&lt;?php</p>
<p>$fn = "file.txt";</p>
<p>$am = "w";</p>
<p>$file = fopen($fn, $am);</p>
<p>$delete_record=$_GET['id'];</p>
<p>if (isset($_GET['deleteid'])){</p>
<p>$content("delete from users where id='$delete_record'");</p>
<p>echo $delete_record.'Done deleted.';</p>
<p>} </p>
<p> </p>
<p>echo "&lt;script&gt;alert('Allright Na Delete.');window.location.href='view.php';&lt;/script&gt;";</p>
<p>?&gt;</p>
<p> </p>
<p> </p>
<p>and</p>
<p> </p>
<p>a notepad no text saved as file.txt</p>
<p> </p>
<p>sorry i can't reply for you andrea so i put my message here i used file.txt for displaying the to the notepad and viewing to that file.txt and you can view it in view.php</p>
]]></description><guid isPermaLink="false">17319</guid><pubDate>Sun, 18 Aug 2013 13:31:47 +0000</pubDate></item><item><title>If Returns False Even Though True</title><link>https://www.killersites.com/community/index.php?/topic/15637-if-returns-false-even-though-true/</link><description><![CDATA[
<p>I have been trying to solve this for hours and have ran out of ideas.</p>
<p>i have two variables,  </p>
<p>db_pw holding the hashed value of password from the database and cp which holds the hashed (password plus salt) entered by the user.</p>
<p> </p>
<p>This is the if statement</p>
<p> </p>
<p>if ($db_pw != $cp)</p>
<p>  set alerts:Current password is incorrect! echo vars to check, load view etc</p>
<p>else </p>
<p>  carry on </p>
<p> </p>
<p>this is the alert I get when the statement runs, i have echoed the two variables</p>
<p> </p>
<p>Current password is incorrect!</p>
<p>database password value  : 290662176e3fece19eba2b3c1a032ee3</p>
<p>form password value      : 290662176e3fece19eba2b3c1a032ee3</p>
<p> </p>
<p>what am i missing ? surely this should return false as the values are equal and hence drop to the else</p>
<p> </p>
<p>any help would be much appreciated thanks.</p>
]]></description><guid isPermaLink="false">15637</guid><pubDate>Fri, 03 May 2013 20:52:43 +0000</pubDate></item><item><title>Php Login Part 14</title><link>https://www.killersites.com/community/index.php?/topic/10509-php-login-part-14/</link><description><![CDATA[
<p>Hello,</p>
<p> </p>
<p>I don't know what I did wrong with the code. Here is the PHP Code:</p>
<p> </p>
<p></p>
<pre class="ipsCode">&lt;?php

// start the session &amp; load configs
session_start();
include 'includes/config.php';
include 'includes/db.php';

// form defaults
$error['alert'] = '';
$error['email']  = '';
$error['pass']  = '';
$error['pass2']  = '';

$input['email']  = '';
$input['pass']  = '';
$input['pass2']  = '';

if(isset($_GET['key'])) {
   // User enter a new password

} else {
   // User is reqesting new password
   if(isset($_POST['submit'])) {
       // process the form
       $input['email'] = htmlentities($_POST['email'], ENT_QUOTES);

       if($_POST['email'] == '') {
           $error['email'] = 'required!';
           $error['alert'] = "Please fill in all the required fields!";

           include 'views/v_reset_pw.php';
       } elseif(!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/', $input['email'])) {
           // email is not valid
           $error['email'] = 'Please enter an valid email.';

           // show form
           include 'views/v_reset_pw.php';
       }
   } else {
       // check that the email exists in the database
       $check = $mysqli-&gt;prepare("SELECT email FROM users WHERE email = ?");
       $check-&gt;bind_param('s', $input['email']);
       $check-&gt;execute();
       $check-&gt;store_result();
       if($check-&gt;num_rows == 0) {
           // display an error - email isn't in the database
           $error['alert'] = "Please check for typos. This email doesn't exist in the database!";
           include 'views/v_reset_pw.php';
           $check-&gt;close();
       } else {
           // create key
           $key = randomString(16);

           // create the email
           $subject = 'Password reset request from ' . $config['site_name'];

           $message = "&lt;html&gt;&lt;body&gt;";
           $message .= "&lt;p&gt;Hello, &lt;/p&gt;";
           $message .= "&lt;p&gt;You (or someone claiming to be you) recently asked that your " . $config['site_name'] . " password be reset. If so, please click on the link below to reset your password. If you do not want to reset your password, or if the request was in error, please ignore this message&lt;/p&gt;";
           $message .= "&lt;a href='" . $config['site_url'] . "/reset_password.php?key=" . $key . "'&gt;" . $config['site_url'] . "/reset_password.php?key=" . $key . "&lt;/a&gt;";
           $message .= "&lt;p&gt;Thanks, &lt;br /&gt;The Administrator, " . $config['site_name'];
           $message .= "&lt;/body&gt;&lt;/html&gt;";

           // create email headers
           $header = "MIME-Version : 1.0" . "\r\n";
           $header .=  "Content-Type: text/html; charset=iso-8859-1" . "/r/n";
           $header .= "From: " . $config['site_name'] . " &lt;noreply@" . $config['site_domain'] . "&gt;\r\n";
           $header .= "X-Sender: &lt;noreply@" . $config['site_domain'] . "&gt;\r\n";
           $header .= "Reply-To: &lt;noreply@" . $config['site_domain'] . "&gt;\r\n";

           // send mail
           mail($input['email'], $subject, $message, $header);

           // update the database
           $stmt = $mysqli-&gt;prepare("UPDATE users SET pw_reset = ? WHERE email = ?");
           $stmt-&gt;bind_param('ss', $key, $input['email']);
           $stmt-&gt;execute();
           $stmt-&gt;close();

           // add alert and clear form values
           $error['alert'] = 'Password resent sent successfully. Please check your email inbox.';
           $input['email'] = '';
           include 'views/v_reset_pw.php';
       }
   }
}

function randomString($lenght) {
   $charakters = '0123456789abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ';
   $string = '';

   for($p = 0; $p &lt; $lenght; $p++) {
       $string .= $charakters[mt_rand(0, strlen($charakters)-1)];
   }

   return $string;
}

$mysqli-&gt;close();</pre>
<div></div>
<p></p>
<p> </p>
<p>And the Form in HTML:</p>
<p></p>
<pre class="ipsCode">            &lt;form action="" method="post"&gt;
               &lt;div&gt;
                   &lt;?php
                   if ($error['alert'] != '') {
                       echo "&lt;div class='alert'&gt;" . $error['alert'] . "&lt;/div&gt;";
                   }
                   ?&gt;

                   &lt;p&gt;Fotget your password? Enter your email below, and we will email you a link to resert your password&lt;/p&gt;

                   &lt;label for="email"&gt;Email: *&lt;/label&gt;
                   &lt;input type="text" name="email" value="&lt;?php echo $input['email'] ?&gt;" /&gt;
                   &lt;div class='error'&gt;&lt;?php echo $error['email']; ?&gt;&lt;/div&gt;

                   &lt;p class="required"&gt;All fields marked with * are required!&lt;/p&gt;
                   &lt;input type="submit" name="submit" class="submit" value="Submit" /&gt;
               &lt;/div&gt;
           &lt;/form&gt;</pre>
<div></div>
<p></p>
<p> </p>
<p>When I'm going to the URL reset-password.php the first alert what I see is: Please check for typos. This email doesn't exist in the database! It's directly there if i'm just entering the url with params. What did I do wrong?</p>
<p> </p>
<p>Sorry for bad english, I'm just 15 and from Germany <img src="https://www.killersites.com/community/uploads/emoticons/default_wink.png" alt=";)" data-emoticon="" srcset="https://www.killersites.com/community/uploads/emoticons/wink@2x.png 2x" width="20" height="20"></p>
]]></description><guid isPermaLink="false">10509</guid><pubDate>Thu, 13 Dec 2012 11:30:35 +0000</pubDate></item><item><title>Function-Problem</title><link>https://www.killersites.com/community/index.php?/topic/11434-function-problem/</link><description><![CDATA[
<p>i get problem with 'insert' in this function. logically, i think its ok but....</p>
<p> </p>
<p>function iInsert($list_tbl=array(), $postData = array()){</p>
<p>		$res = count($list_tbl);</p>
<p>			for($i=0; $i&lt;$res; $i++){</p>
<p>			$q = "DESC $list_table[$i] ";</p>
<p>			$q = mysql_query($q);</p>
<p> </p>
<p>			$getFields = array();</p>
<p> </p>
<p>			while ($field = mysql_fetch_array($q)){</p>
<p>				$getFields[sizeof($getFields)] = $field['Field'];</p>
<p>			}</p>
<p> </p>
<p>			$fields = "";</p>
<p>			$values = "";</p>
<p> </p>
<p>			if (sizeof($getFields) &gt; 0){				</p>
<p>				foreach($getFields as $k){</p>
<p>					if (isset($postData[$k])){</p>
<p>						$postData[$k] = htmlspecialchars($postData[$k]);</p>
<p> </p>
<p>						$fields .= "`$k`, ";</p>
<p>						$values .= "'$postData[$k]', ";</p>
<p>					}</p>
<p>				}</p>
<p> </p>
<p>				$fields = substr($fields, 0, strlen($fields) - 2);</p>
<p>				$values = substr($values, 0, strlen($values) - 2);</p>
<p> </p>
<p>				//$insert = "INSERT INTO $table ($fields) VALUES ($values)";	</p>
<p>		             $q1=" INSERT INTO ($list_table[$i]) ($fields) VALUES ('$values')";		</p>
<p>				if (mysql_query($q1)){</p>
<p>					return true;</p>
<p>				}else{</p>
<p>					echo mysql_error();</p>
<p>					return false;</p>
<p>				}</p>
<p>			}else{</p>
<p>				return false;</p>
<p>			}</p>
<p> </p>
<p>	    }</p>
<p>		 return true;</p>
<p> </p>
<p>	}</p>
]]></description><guid isPermaLink="false">11434</guid><pubDate>Wed, 06 Feb 2013 11:28:46 +0000</pubDate></item><item><title>Insert Statement</title><link>https://www.killersites.com/community/index.php?/topic/9194-insert-statement/</link><description><![CDATA[
<p>How to Insert table1.id, table2.id in table3</p>
<p> </p>
<p>Explanation: I would like to monitor users activity like which user added which product so just wants to get user id and product id.</p>
<p> </p>
<p>users table = table1</p>
<p>products table = table2</p>
<p>user activity table = table3</p>
<p> </p>
<p>I have 10 column in table1 and 10 columns in table2 what I need is how to get table1.id and table2.id to insert in table3.userID, table3.productID based on sessions.</p>
<p> </p>
<p> </p>
<p>Thanks &amp; Regards,</p>
<p>Asrar.</p>
]]></description><guid isPermaLink="false">9194</guid><pubDate>Thu, 25 Oct 2012 17:53:05 +0000</pubDate></item><item><title>Write a function to return a list of people</title><link>https://www.killersites.com/community/index.php?/topic/8494-write-a-function-to-return-a-list-of-people/</link><description><![CDATA[
<p>Hi,</p>
<p>I have been given a excercise to do but am strugling with it the question is below if some one could enlighten me on how it could be done.</p>
<p> </p>
<p> </p>
<p> </p>
<p>Write a function to return a list of people</p>
<p>This function should accept an array of people's names as an argument and return a string list of these names.</p>
<p>If there is a single person, the name should be returned as is.</p>
<p>If there are two people, the two names should be separated by the word ‘and’.</p>
<p> </p>
<p>If there are more than two people, the last two names should be separated with the word ‘and’, and all previous names separated with a comma.</p>
<p> </p>
<p>Test the function with the following arrays:</p>
<p> $test1 = array('Person One');</p>
<p> $test2 = array('Person One', 'Person Two');</p>
<p> $test3 = array('Person 1', 'Person 2', 'Person 3');</p>
<p> $test4 = array('Person 1', 'Person 2', 'Person 3', 'Person 4'</p>
<p> 'Person 5', 'Person 6');</p>
]]></description><guid isPermaLink="false">8494</guid><pubDate>Tue, 02 Oct 2012 18:54:40 +0000</pubDate></item><item><title>Is the Shopping Cart with Paypal tutorial good for live sites?</title><link>https://www.killersites.com/community/index.php?/topic/7888-is-the-shopping-cart-with-paypal-tutorial-good-for-live-sites/</link><description><![CDATA[
<p>Hi,</p>
<p> </p>
<p>If i pay to watch the Php Shopping Cart with Paypal tutorial will i be able to use it on a live site? Or is it just good for demonstration purposes?</p>
<p> </p>
<p>And is there any recommendations to continue learning about shopping carts with paypal after that?</p>
<p> </p>
<p>Thanks in advance</p>
]]></description><guid isPermaLink="false">7888</guid><pubDate>Tue, 26 Jun 2012 16:02:20 +0000</pubDate></item><item><title>Allowing users to edit their own entries on php form</title><link>https://www.killersites.com/community/index.php?/topic/7645-allowing-users-to-edit-their-own-entries-on-php-form/</link><description><![CDATA[
<p>I am undertaking a project in wordpress whereby I am running a tennis website where players input their scores on a webform. This data is then exported to a googledocs spreadsheet that calculate a players score and ranking.</p>
<p> </p>
<p>However, i am trying to code a form that enables a user to edit their entries. I would like to have a form where players enter their score and then have a chance to change their scores if they made an error. I have tried doing this using a php form. However, i do not know how to program the ability of players to only change their scores and not other players scores. <a href="http://testghtennis.stac.biz/wordpress/form.php" rel="external nofollow">Here is a what i have achieved so far</a>.</p>
<p> </p>
<p><a href="http://testghtennis.stac.biz/wordpress/form.php" rel="external nofollow">http://testghtennis.stac.biz/wordpress/form.php</a></p>
<p> </p>
<p> I want to have a system where once users enter their information in the above form, they can press a button that shows them their populated fields. They can then change their values if they wish and resubmit the form. Once the form is resubmitted, the mysql table will capture the latest data from the player.</p>
<p> </p>
<p>I was wondering whether you know how this can work or you have some piece of php code that enables this functionality. I am a novice in php and that is why i wanted to talk to someone with further experience than me on this topic.</p>
<p> </p>
<p>Thanks and look forward to your response.</p>
]]></description><guid isPermaLink="false">7645</guid><pubDate>Wed, 25 Apr 2012 14:59:23 +0000</pubDate></item><item><title>php login error msg</title><link>https://www.killersites.com/community/index.php?/topic/7630-php-login-error-msg/</link><description><![CDATA[
<p>Hi There, I'm following the oop cms tutorial and am trying to get the login/logout working before I go any further.</p>
<p> </p>
<p>The error I get is</p>
<p>'Fatal error: Call to undefined function getAlerts() in /Applications/MAMP/htdocs/login/views/v_login.php on line 16'</p>
<p> </p>
<p>Line 16 of v_login is:</p>
<p> </p>
<p></p>
<pre class="ipsCode">&lt;?php
				$alerts = $this-&gt;getAlerts();
				if ($alerts != '') { echo '&lt;ul class="alerts"&gt;' . $alerts . '&lt;/ul&gt;'; }
			?&gt;</pre>
<div></div>
<p></p>
<p> </p>
<p>In the m_templates file the getAlerts function had alerts as alert, so I changed that and the error msg in netbeans went away, but my browser is still giving me the error.</p>
<p> </p>
<p>Curious if anyone has run into this.</p>
<p> </p>
<p>Jessica</p>
]]></description><guid isPermaLink="false">7630</guid><pubDate>Fri, 20 Apr 2012 20:29:20 +0000</pubDate></item><item><title>php contact form error</title><link>https://www.killersites.com/community/index.php?/topic/7446-php-contact-form-error/</link><description><![CDATA[
<p>Hello All,</p>
<p> </p>
<p> </p>
<p>I'm hoping someone can help me with this....</p>
<p> </p>
<p>Have just been through the php videos in the webdesigners course.</p>
<p> </p>
<p> </p>
<p>I'm trying to apply the php stuff by making the contact form on my website usable.</p>
<p> </p>
<p>I pointed the form (eg when a user clicks on "send" on the webpage) to a page called contactprocess.php, with this code on it:</p>
<p> </p>
<p>&lt;?php</p>
<p>//Contact form processing code</p>
<p> </p>
<p> </p>
<p>$yourname = $_POST['name'];</p>
<p>$youremail = $_POST['email'];</p>
<p>$yoursubject = $_POST['subject'];</p>
<p>$yourmessage = $_POST['message'];</p>
<p> </p>
<p>$emailmessage = "yourname: {$yourname} with an email of: {$youremail} and message of: {$yourmessage}";</p>
<p> </p>
<p>print "Your message has been sent";</p>
<p> </p>
<p>mail('info@logbookcarloan.org.uk', $yoursubject, $emailmessage);    </p>
<p> </p>
<p> </p>
<p>?&gt;</p>
<p> </p>
<p>When I input the contact_us.php page (pointing to contactprocess.php) from localhost I get the following erro:</p>
<p> </p>
<p>Your message has been sent</p>
<p> Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\contactprocess.php on line 21</p>
<p> </p>
<p> </p>
<p>Line 21 is this one here:</p>
<p> </p>
<p>mail('info@logbookcarloan.org.uk', $yoursubject, $emailmessage);</p>
<p> </p>
<p> </p>
<p>What do I need to do to get this to work?</p>
<p> </p>
<p> </p>
<p>Kind regards</p>
<p> </p>
<p> </p>
<p>Frank</p>
]]></description><guid isPermaLink="false">7446</guid><pubDate>Thu, 22 Mar 2012 17:08:52 +0000</pubDate></item><item><title>video missing</title><link>https://www.killersites.com/community/index.php?/topic/7255-video-missing/</link><description><![CDATA[
<p>I was going through the Basic PHP Programming Videos, and found the following video links to be missing. </p>
<p>Processing HTML Forms with PHP:(Part 2 &amp; 3)</p>
<p>More Basic PHP Continued: (all)</p>
<p> </p>
<p>Can you please update the links? </p>
<p>Thanks,</p>
]]></description><guid isPermaLink="false">7255</guid><pubDate>Mon, 27 Feb 2012 16:14:17 +0000</pubDate></item></channel></rss>
