mysql - How to build a real live post system on my page using PHP and MySQLi? -
i building php website. main purpose of website site follows:
php check database , see if user's birthdate (day , month) equal today's date (day , month) , if equal, php should echo example "today james oduro's birthday". echoed on main page "go.php"
php should check database , show registered members on main page "go.php" includes user's firstname, lastname , birthdates , picture.
user should able post simple congratulation message on page other users having birthdays.
now, have done 50% percent of work includes "php login script , validation", registration script, , validation using php, php checking database , seeing if user has birthday , echoing on main page , showing registered members on page, logout script , php echoing user's firstname on top of page using sessions variables.
my website on testing server , want give account login see how page looks , ask questions regarding it.
account login : email: jamesoduro@yahoo.com, password: test, address is: www.bsystem.besaba.com
i assume you've login question follows:
how should implement php code when user's write , click on post stored in database , later show on page under post form?
how can let users upload simple avator or photo , show behind name , details on registered members?
please note provide codes , files upon request.
ok first create table in database , name user_post below
create table if not exists `user_post` ( `id` int(11) not null, `user_id` int(11) not null, `user_post` text not null, `post_time` datetime not null default current_timestamp on update current_timestamp, `post_status` int(11) not null ) engine=innodb default charset=latin1; alter table `user_post` add primary key (`id`); alter table `user_post` modify `id` int(11) not null auto_increment;
using post form insert post on submit button click below
$sql=mysql_query("insert `user_post`(`user_id`,`user_post`,`post_time`,`post_status`) values('".$_session['user_id']."','".$_post['post']."',now(),1)");
fetch code below
$sql=mysql_query("select * `user_post` user_id='".$_session['user_id']."' order id desc"); while($result=mysql_fetch_array($sql)) {?> html code <?php }?>
remember session value have taken example have take session value in place of mine
hope you..
Comments
Post a Comment