PHP - Your Basic Project/ Scripts
I have been been coding in php for about 5/6 years. While at uni I was taught the procedural way, and using all the myql_ functions to do database work. Generally speaking if you google for php coding examples you tend to come across examples using those methods which I now believe are out of date.
In recent years I have learned some MVC, and used some frame works and open source applications (opencart, wordpress etc...)
So im just wondering, these days if you had to write a basic script to get information from a database how would you go about it? or say you were going to make a basic 5 page website with php how would you set it up?
The reason im asking these questions is because I want to get out of bad habits and using outdated methods so rather than write something like the following what would you do?
$dbh1 = mysql_connect('localhost', 'user', 'password') or die(mysql_error()); //DB connection mysql_select_db('db_name', $dbh1);//choose correct database $query = "SELECT * FROM table WHERE something = something"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($result); echo$row["field"];How would you set up a basic website (content pages,contact form)? In the past I have done something this : request ---> index.php (get page & content from db) ---> pass info to content.phpAs i said im looking to get out of bad habits and essentially get up to scratch on modern day practices for basic projects, using a framework or CMS for such simple things seems like overkill. Thanks. Similar TutorialsAbout Me Hi, firstly let me introduce myself. My name is Liam O'Connor and I'm 17 years old, 18 soon (quite excited) living in the UK and I've been learning how to makes websites ever since I was 16. Within the last 2 years I have taught myself (x)HTML/CSS, PHP/MySQL, JavaScript/Ajax to a good standard. I'm currently at college doing a Computing Networking and Security Extended Diploma. The Project I have been working on a website for many months now that I REALLY love doing. When ready for launch the website will be a simple social networking website that lets users communicate in groups or one-on-one, also users will be able to create chats on the topics they like to talk about and personalise them to how they like. What have I done so far? Within the last few months I have created a well working chat system that allows many users to communicate together, and many features within the chat such as emoticons, change status (online, busy, away), control of font size, sound alerts, chat comments, and a thumb rating system. What could you do? If you are interested to help develop a website like this one (for free) in your own time, please contact me and let me know a little about you and what you think you would be able to offer. There is no rush to get this project finished and put live for the world to see so there would be no pressure on you. If you are not interested in developing the website but you believe you have some wise words of wisdom please share them with me or if you believe you can help in any other way please let me know. Please check out the image below Thanks So I am working on a project in which I am taking pictures from an SSH area, running ImageMagick on the picture to crop out what I want and then use the threshold to make it like I want, and then finally run Tesseract OCR on the final picture. I have a new picture coming in to the spot I am taking the pictures from every six seconds and I need the program to run the commands to do all of this every six seconds as the pictures come in forever basically. As of right now, here is my code that I have. I am relatively new to using PHP scripting working for the command line in Ubuntu. So if anyone could help me with some fixes to this code, I would be greatly appreciative. Code: [Select] <?php function tesseract($image) { define($ocmd, `ssh *place i am taking from*`); fwrite("<pre>$ocmd</pre>"); define("$pic1", "`convert $image -crop 1000x170+350+785 -negate -threshold 42000 $image.tif`");//This is a 1920x1080 hd image define("$pic2", "`convert $image -crop 600x95+200+550 -negate -threshold 41000 $image.tif`");//This is a 1280x720 hd image define("$pic3", "`convert $image -crop 650x100+75+550 -negate -threshold 43000 $image.tif`");//This is a 960x720 hd image define("$pic4", "`convert $image -crop 500x62+175+410 -black-threshold 53% $image.tif`");//This is a 960x540 hd image define("$cmd2", "`tesseract $image.tif $image.txt`");//command to take the words of the edited image list($width, $height) = ImageCreateFromJPEG(filename); define("$area", "($width*$height)"); if ($area == 1920*1080) { $line = $pic1; } elseif ($area == 1280*720) { $line = $pic2; } elseif ($area == 960*720) { $line = $pic3; } elseif ($area == 960*540) { $line = $pic4; } else { $line = "Please try a picture of another size."; } echo("<pre>$line</pre>"); if ($line != "Please try a picture of another size.") { echo"<pre>$cmd2</pre>"; } } ?> Hello I am new to the forums and this is my first post A little about me, I have played around with php time to time but don't know how to code it, I can modify it and use scripts and what not but I can't find a script that I wan't to do this I wan't to be able to upload and file share site without using mysql and using cookies instead to keep track of user's upload's without having them to register a account, I don't want a user management system for this I just want them to be able to upload a file and it keep track of their upload's(I can set a limit of course), and be able to share the direct link to their friends for them to quickly download it. I need to know what steps I need to do and how to start basically and if anyone can help me out. Thank you PHP Freaks Hi, I need more than one person on my team for my project, I was wondering if someone will join and help me. My project it a website software (kind of like a CMS). This won't be paid. That's the only problem.
well done really need help but this seemed the best place to put it well i was wondering what would be easy 1st project for a beginner to make in php, So I have decided to do research as my project and gain something from this. But also I will have to include programming which i prefer PHP. and will be testing these for my research. Does this sound like a good project and also If it is good sound.. Where do I start?... need a starting point and then I could go on to doing it.. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=306541.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=319234.0 i am having a problem passing variables from a php file to a html file using a javascript funtion. here is the code i have. Code: [Select] /////////InteractiveMap.HTML//////////////////////////////////////////////////// <script type="text/javascript"> // This function is called when a building is clicked. function buildingClick(id,name,desc) { var mywin; var isOpen = false; var searchInt; var passVal; passVal = desc; mywin = window.location.href = "informationPage.html"; searchInt = setInterval(function(){if(isOpen){var display=mywin.document.getElementById("infoArea"); display.value = passVal;}});} /////////////////////////////////////////////////////////////////// ////////////InformationPage.html/////////////////////////////// <script type="text/javascript"> window.onload = function(){window.opener.window["isOpen"] = true;}; </script> <textarea disabled id="infoArea"></textarea> ////////////////////////////////////////////////////// I am just tryin to display the variable desc in the textarea "infoArea" but it wont work.Any help would be appreciated. eoin Fatal error: Method name must be a string in C:\xampp\htdocs\cmsv2room\model\getTimeTableClass.php on line 216 i am using setters ang getters for arrays while setting an array in a array i get this error the line in which i got the error is below $gettimetableObject->$setFacnameArray($FacnameArrayR); actually iam storing arrays in an array $FacnameArrayR is an array storing in a array with help of object(concept of setters) with my limited PHP programming skills I have managed to successfully a produce a css button maker which makes and produces the code for a number of resolutions and devices. this is the $result displayed Code: [Select] $result = "<a href='#' class='blnk'><li class='btn rnd'>" .$_SESSION['text'] ."</li></a>"; ($_SESSION['result']==$result); this is how each device is called: Code: [Select] #### ANDROID ####### if ($_SESSION['device']=="android") { echo "<div id='andt'></div><div id='andm'><div id='and-st'><div id='btn'>"; $i=1; while($i<=$_SESSION['nbr']){ echo $result; $i++; } echo "<div class='cl'></div></div></div></div><div id='andb'></div>";} This is the dropdown for the bumber of buttons Code: [Select] <legend> Button No</legend> <select name="nbr"><option value="<? echo $_SESSION['nbr'] ?>"><? echo $_SESSION['nbr'] ?></option><?php include('inc/f-1to8.php'); ?></select></fieldset></td> Code: [Select] <tr> <td colspan="3"><fieldset><legend>Button Text </legend><input name="text" type="text" value="<? echo $_SESSION['text'] ?>" size="50" maxlength="16" /></fieldset></td> What I need is to know howto not only produce a number of Button Text input boxes that correspond to Button No but ones that each correspond individual buttons so each button has its own text field. If anyone can help it would be much appreciated - Im suprised I have got as far as I have. here is the link at the mo http://www.d-sine.com/_STYLES/buttons.php - (the reset button will set default settings by going to a page that posts back default settings in hidden fields on a meta refresh) Kind Regards Hi all, I am an intermediate PHP Programmer, but I'm now stuck with getting any further. I am currently developing a CMS with a few people. However, I wish to put that aside for a month or so and learn PHP a bit better. Can anyone suggest a fairly "easy" project for me to do to learn a bit more about PHP? Best Regards, DM hi Guys..............i am final year student and i need to submit a project that should me medium to large size and i want to build it on PHP so it would be very kind if you can kindly suggest me topics for the same however there is just one restriction the process that i cannot build anything like management systems or social networking websites the idea should be new and catchy and ya one more thing no e-com websites as well.....................looking ahead for your advice..................thank you. Okay, let's say I have a block of text like so; 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 I need to be able to add more/less digits to the text. Like so; 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 etc Also if it's greater than a certain number, to subtract. :3 How would I go about doing that? Thank you, Doctor I'm doing a project using PHP to store reviews by people in the database.
http://postimg.org/image/3l9j1uipf/
When the 'Add Reviews' is clicked, it goes here
> http://postimg.org/image/q07qvnluh/
Here comes the problem, I need to add radio buttons / groups for people to select their phone rating 1-5.
& in the front page (the page with add / search / list), it displays the ranking / rating of phones.
Anyone have any idea how do I do the codes?
Edited by Axton, 06 August 2014 - 05:18 AM. Hi guys,
I'm a beginner in php.I know some basic codings in it.I want to do the project in php.Help me how to start..?..and what kind of project is best for beginners to learn..?
hello , Im working on a fictional web-site as a final project for my course.
well I was wanting to make scripts to put on my site and then only let a few people use the site by the ip address, what would be the best way to allow only certain people to use the script on the site, based on the ip? Thanks |