Welcome! Log In Create A New Profile

Advanced

thumbs up PHP PORTFOLIO USEFUL TIPS

Posted by tatefu 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
thumbs up PHP PORTFOLIO USEFUL TIPS
September 14, 2011 01:33PM
Hey folks...I hope we all at the heart of our porfolio if not done. As i work through the porfolio i
made slippy mistake and they were time consuming to fix. I then decided to create this topic
so we can share tips to save time and useless effort.

My first tip and this is very important: Always write small codes and check if they working before you
continue, i suggest. For instance lets assume you working on you logging page. After checking if the submit
button was clicked you obviously ganna hand over the data from the form names to the php variables, then
you can simply echo the variable to see if indeed they were handed over before you continue with the
rest of your code.

Another tip and this one i got from Mac himself is that you must speak your code, believe me it works.
You simply say in whwever language you wish, what your code must do and then convert it to php code.

Goodluck and please post your tip here!
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 15, 2011 08:52AM
Good one tate.. i can't agree more, but i have been talking my edit page for quite some time now and theorically to me and couple of friends who came to test my system it makes sense and is suppose to work but practically it doesn't work. here are some parts of it maybe you might identify the problem.


Language: PHP
$car_id=$_GET[';car_id';];   // query to retrieve the information of the seslected row **"it works well "**     // while loop{   $car_name = $row[';car_name';]; $model = $row[';model';]; $year = $row[';year';]; $price = $row[';price';];   echo "<form method=';GET'; action=edit.php><center>"; echo "Car name : <input type= ';text'; name =';car_name'; value=';$car_name'; size=';15'; maxlength=';15';></br></br>"; echo "Model : <input type= ';text'; name =';model'; value=';$model'; size=';15'; maxlength=';15';></br></br>"; echo "Year : <input type= ';text'; name =';year'; value=';$year'; size=';15'; maxlength=';4';></br></br>"; echo "Price : <input type= ';text'; name =';price'; value=';$price'; size=15 maxlength=8></br></br>"; echo "<input type=';submit'; name=';submit'; value=';Update';> </br>"; " </center></form> ";   if ($car_name = ';car_name'; && $model = ';model'; && $year = ';year'; && $price = ';price';){   $SQL = "UPDATE cars SET car_name = ';$car_name';, model = ';$model';, year = ';$year';, price = ';$price'; WHERE $car_id = ';car_id';";

i tryed differnt IF conditions but with no luck
avatar
Mac
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 15, 2011 09:22AM
Try reading the other posts....
http://osprey.unisa.ac.za/phorum/read.php?564,155263 towards the end

Language: PHP
echo "Car name : <input type= ';text'; name =';car_name'; value=\"$car_name\" size=';15'; maxlength=';15';></br></br>";   //what is this? if ($car_name = ';car_name'; && $model = ';model'; && $year = ';year'; && $price = ';price';){
thumbs up Re: Re: PHP PORTFOLIO USEFUL TIPS
September 15, 2011 02:57PM
i don't know if im wrong but here im trying to update the table if it has values in it confused smiley
Language: PHP
if ($car_name = ';car_name'; && $model = ';model'; && $year = ';year'; && $price = ';price';){

Honestly i have been on these page for the passed two weeks and experiecing the same problem now im frustrated
avatar
Mac
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 15, 2011 04:34PM
Convert what you are saying to words in the if statement:

Assume $car_name="BMW" and $model ="320i"....etc.

So you are saying:

Language: PHP
if(BMW==car_name and 320i==model....

PHP does not know what you mean by the word car_name on its own - it means NOTHING to PHP. To you it may make sense, but until BMW==BMW and 320i==320i it would always be FALSE and the code in the brackets will not run.

Anyway, why do you want to use an if statement? The user WANTS to update, so there is no need to see if he has actually changes any values and what those values are or if they are equal to anything. You simply update whatever was send, even if it is the same information.

That said.... this topic is about USEFUL TIPS - not about problems.... sad smiley

So start a new thread please.
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 16, 2011 08:44AM
forgive m for that sir, i will start a new one.
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 16, 2011 02:46PM
Hey Mokiri. You have to know how to hand over information from the form part to the php(script) part of your code.
Thats a ridiculously easy thing to do. Google it if you dont get it right.
thumbs up Re: Re: PHP PORTFOLIO USEFUL TIPS
September 16, 2011 02:58PM
My tip today: I suggest, first create a database and then a login page before creating a resgiter page. It works very easy without causing hectic error.
Simply create a database and insert a user(username and password fields) from myphpAdmin then create a simple loggin page. After creating a login page,
login the user you have insert in the database.

That will save you a lot of time and hustle.

Goodluck.
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 19, 2011 11:05AM
Hey folks...hpe you had busy weekend.
Tip: You can import your database on you server space or create a knew one if you like.
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 19, 2011 12:07PM
Tip: If you are gonna upload pictures on your site, it is suggested that you create a seperate directory on your server spaace to hold the.
Its a bad practice to create a field on your database to store pictures as it will overload your database adn slowdown things.
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 20, 2011 08:49AM
I think most of you are done with project because i dont see new topics or comments. Where is everyone?
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 20, 2011 11:24AM
We are here tatefu, busy trying to resolve billions of errorsangry smiley
Guys isnt it easier to just work from the server?? meaning trying to link your tables on the server or unless if importing them is not a husle...let me know if Im wrong here
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 20, 2011 12:38PM
You can do anything you feel confortable with. My suggestion is if you have all your files working on you PC just use your file transfer
protocol(FTP) to copy them to your server space including your database.

It works easy like that.

Goodluck.
thumbs up Re: PHP PORTFOLIO USEFUL TIPS
September 29, 2011 10:57AM
Hi guys, as Chris said we are there, trying to put the ice on the cake about our portfolio. It's quite a lot of work and requires lot of concentration but once one is done with his portfolio, he will be proud of what was done.
Sorry, only registered users may post in this forum.

Click here to login