Just another WordPress.com site

Since we all are finishing up our web development project, I was thinking about how I will collect all the data I am using in my site. because if you think about it, how I will write it all down as a sql file. it just will cost me so much time. But Thanks to the free open source developer[phpMyAdmin]. I just download it: there are really easy step to do that if you didn’t use it before

1. Go to phpmyadmin site and download the zip file.
2. then, the file will be in this format [.7z] so you need to download this program to unzip it.
3. and then, put the unzip file into your Apache root directory [the one that has your htdocs folder].
4. Then, inside your phpMyadmin folder, add this php file [where the index.php]:

That’s it,, it’s really damn easyyyyyy!! Now, i can sleep well, next week I will just hit export button, and I am done with project ………..

I am thinking to implement some Jquery plugins such as Date-picker,Dialog. However, about the Date-picker, Thanks to one of my classmate helps to figure it out.. but about the Dialog, does anyone know how to implement picture, and how to handle the click back from the user, if our Dialog has some input method?

Please share if anyone knows, thanks

MySql, Date and Time

Does anyone knows, please, how to manage the date and time in MySql because it’s different from oracle and kinda more complicated? for example, if I need to get the reservation of today and check the time for our restaurant that just open from 10:30 AM until 10:00 PM? and also, about Today’s special, how to check the day of the week, so we are able to display – if we have special- the special of the day.

JavaScript and PHP

I am wondering how to pass in data from JavaScript to PHP since we all know JavaScript is client side language, So how we communicate them together (PHP and JavaScript ) to encrypt the username and the password on the client side before submit them to the server as an example. fortunately, there are some way to do that which is by using Ajax or by using JSON through JavaScript, like this :
this is on your client side :

$.getJSON(‘http://foo/bar.php”, {‘num1’: 12, ‘num2’: 27}, function(e) {
alert(‘Result from PHP: ‘ + e.result);

on your php side

$num1 = $_GET[‘num1’];
$num2 = $_GET[‘num2’];
echo json_encode(array(“result” => $num1 * $num2));

there are a lot to know about php, I have a problem with header function. header function is a function that is used to redirect the php page from one to another, it’s part of HTTP protocol. Header () sends a raw data through HTTP protocol. However, I was trying to build my log in page, and I was thinking how I will transfer the customer – if the user name and password are correct to another page to complete browsing the site, and how I will redirect the employee to the website management tool. I used the header to do that but it doesn’t work, I don’t know guys if anyone has the same issue.


Regular expression

Thanks to our web development course! I’ve never heard before about regular expression and how to deal with them. They are really helpful especially for extraction a text or a phone number, or whatever in a document. However, in our project we need just to check whether the credit card type if the website you create works with that type of card or not.

So the common credit cards companies are Visa, MasterCard, American Express. So for example, I will chose the Visa expression and how they wrote it: ^4[0-9]{12}(?:[0-9]{3})?$. I will break this expression into smaller chunk to explain it.First of all, Visa card has 16 digits, and all its card starts with number (4) so the expression will be

1.^4, this means all the Visa card starts with number (4). so this is the first digit.
2. [0-9]{12}, this means the next 12 digits should be in the range of from [0-9].
3. (?: this means match all the last {3} numbers of [0-9] just once.
4. ?$ this refers to the end of the expression.

So how we do that in PHP. well, there is a function in PHP which is called preg_match($pattern,$string);

where $pattern is your expression pattern and $string is – in this case- your credit card number.

MySQL database with PHP

I was working on my project to build my database, and I want to create a table that has more than one primary key, So it turned out if you need to create a table with multiple primary key, you need to define them all in one primary key constraints. as in the example below :

CREATE TABLE Todays_Special
Table1_ID int NOT NULL,
Table2_ID int NOT NULL,
Table3_ID int NOT NULL,
PRIMARY KEY (Table1_ID,Table2_ID,Table3_ID ),


Session in PHP

Session is one of the important thing in PHP. you can control all of your visitors to your website, from when they logging in until they check out. However, I still didn’t understand how to manage that when you have more than one person log in into your website, how you will give o to each unique ID to track its activity?

Please if any one knows can explain,!


I was thinking, when I was working on my project design , how to store images in your database so you can manage your pictures easily through your database. Well, luckily PHP supports that. You can store image in your database easily by writing couples of codes. I will explain how.

First of all, you need to store all of your pic_ID, and its extension in your database.Then, by using SQL query, you can call your pics and put them in the “src” in the image-tag.

This picture shows how you can manage your pics through your databases.


Login authentication,PHP

I was thinking when I was working on the login authentication in my project. what if the user enters his first letter of his name uppercase?and you saved it in lowercase.Here we don’t need to worry about the password because it should match our database, so how we do that: there is a function in the php that is easily can use to do that, which is called srttolower($value)
there is another one to convert the name to uppercase.

Also, don’t forget to do that for your both sides, with user enters, and what you saved in the database to get match and (if the data correct) authenticates your user access.

I have example here explains more:

$user=$_GET[‘user’] // this is what the user enters
$query=”select * from table_name”;

//your condition
if (strtolower($user==strtolower($query[‘user’]))
do your check


Tag Cloud