Posts Tagged ‘variables’

php Programming:search page,. HELP! pls?

kring krung asked:


i dont know if my code is correct but i think it’s not, i want to learn php but it’s knda hard for me i dunno how to define variables and everything, learning php makes my head ache, i want to make a search page, but theres always an error saying,..

unexpected $end
line 7: variable not defined($result=mysql_query(“select fruits from fruits where fruits like ‘%$fruits%’”);
)

pls.. help me,.. thanks,…

muwaAah,..

$fruits=$_POST['fruits'];

//$query=mysql_query("select fruits from fruits where fruits like '%$fruits%'");

$result=mysql_query("select fruits from fruits where fruits like '%$fruits%'");

?>

include ('connect.php');

If (isset($_POST['fruits'])) {
$result = mysql_query("SELECT * FROM fruits where fruits like '%$fruits%' order by fruits");
if (!$result) {
die("Database query failed: " . mysql_error());
}
while ($row = mysql_fetch_array($result)) {
echo "
$row[0]

“. ” ” .” $row[1]

” . ” ” .” $row[2]

“;
}
}

?>
mysql_close($connection);
?>

Website content

Technorati Tags: , ,

PHP Programming Help?

melonie_anne asked:


Ok, I’m doing an assignment for school that is really confusing me. I made an htm form that is supposed to leave a box for you to enter a grade letter, and after doing so, you will get a different result depending on the letter you typed. I made the PHP file, but no matter what grade I type, it gives me the same result every time, “Your grade is excellent!”. I need help with making it give me different results depending on what I type, and I think the main problem is my call statement.

This is my html form (which is fine):




Grade:


And this is my PHP file:





function checkGrade($Grade) {
switch ($Grade) {
case "A":
echo "Your grade is excellent.";
break;
case "B":
echo "Your grade is good.";
break;
case "C":
echo "Your grade is fair.";
case "D":
echo "You are barely passing.";
case "F":
echo "You failed.";
default:
echo "You did not enter a valid letter grade.";
}
}
echo checkGrade("A");

?>

Could someone please help me?
Thanks, Frank! I think it’s a step in the right direction, but the only problem now is that it’s giving me the default answer everytime now, which is, “You did not enter a valid letter grade.”

Do I need to define the A, B, C, D, F variables anywhere?
Ok, it works now, thank you, Frank!!! :D

php programming

Technorati Tags: , ,

PHP Tutorials: Name Splitter (Part 1)

phpacademy asked:


Splits a full name into two seperate variables. Useful for signup forms where you just want to ask the user their full name, and not have two seperate boxes for first and last names. … php programming tutorial tutorials help name names split splitter seperate

Create a video blog

Technorati Tags: , ,

PHP Basics: Arrays

Arrays allow you to store a number of data values inside one variables, which makes it easier to read, quicker to ign and easier to access each element!

Duration : 0:8:45

Read the rest of this entry »

Technorati Tags: , , , , , , , , , , , , , , , ,

Chapter 2 on PHP programming

This is the second PHP tutorial in my web development series. Enjoy.

Duration : 0:8:32

Read the rest of this entry »

Technorati Tags: , , , , , , , , , , , , , ,

Chapter 3 PHP Editors, Comments, and Basic Variables

Another step down the path of learning php programming.

In this chapter we get into the nuts and bolts of PHP.. commenting, variables, and choosing a code editor.

Enjoy!

Duration : 0:8:32

Read the rest of this entry »

Technorati Tags: , , , , , , , , , , , , , , , , , , ,

Extending C: “Variable Variables” like PHP $$var

Tiny C library for a limited amount of dynamic strings. If you need more functionality, feel free to extend it, write your own linked lists or check out GTK’s glib GList object.

Examples:

if(dictionary(“moo”))
strcpy(dictionary(“moo”),”Something about cows.”);
puts(dictionary(“moo”));//prints Something about cows.
dictionary(“destroy()”);

Limitations:
1. Size of strings in this demo are limited to 99 characters (see CHARS in source code).

2. 100 bytes of memory (99 + the terminating NULL) are set aside for each and every word it does not find, so you can add definitions to them. This makes it very friendly and easy to use, but it may not be a good idea to use it in situations where you are looking up a lot of words that are not in the dictionary!

3. Uses fast linear searching, but for a very large dictionary you might want to use something else, the aforementioned GList or a database.

4. You are responsible for freeing the memory used by the dictionary upon program termination. You can do that using the _destroy method:
dictionary_destroy()

Or by passing “destroy()” as a string to the dictionary object directly, vis:
dictionary(“destroy()”);

5. (updated) Like malloc, this library now returns NULL when out of memory. You may desire to check for this.

6. Slightly obfuscated code for compactness. If you don’t like the formatting, run the free “indent” program (available for linux and windows) on it or use your text editor’s automatic indent feature.

The tiny dictionary library and demonstration program may be downloaded from my web site:
http://www.thenerdshow.com/index.php?page=dictionary

Duration : 0:6:49

Read the rest of this entry »

Technorati Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Part 4 – PHP programming – Functions, Functions, Functions

Another step down the path of learning php programming.

In this section we delve into PHP functions. What are they? How do we use them? How do we create our own functions?

Enjoy!

Duration : 0:8:32

Read the rest of this entry »

Technorati Tags: , , , , , , , , , , , , , , , , , , , ,

PHP Tutorial: Installation and The Basics

To get php and apache installed use xampp.
xampp is free and contains php / apache (around 33mb)

1. Download and Install XAMPP from here:

http://www.apachefriends.org/en/xampp.html

2. on windows go to C:\xampp

it should have a folder called htdocs. If you put a file called foo.html
into the htdocs folder you should be able to access it by going to
http://localhost/foo.html or /foo.php.

There’s also something called WAMP

http://www.wampserver.com/en/

There’s a lot of php tutorials out there just search google

http://www.google.com/search?hl=enr&q=php%20tutorial

Request tutorials here

http://youtube.jimmyr.com/

More PHP TUtorials here

http://killerphp.com/

Some people have recommended other editors

http://www.scintilla.org/SciTE.html

http://www.pspad.com/

http://en.wikipedia.org/wiki/Comparison_of_text_editors

http://www.context.cx/

%%programming

Duration : 0:10:53

Read the rest of this entry »

Technorati Tags: , , , , , , , , , , , , , , ,