Posts

Showing posts with the label mysql

Simple Login logout system using php Mysql

Image
Login and logout system is the most important thing for the user management, session management is one important thing for manage the user for the whole time of login time. for that we have to use session for this. it should have 5 files for this. we have to fetch the same value for the user and check the session and register the session value. and make destroy for logout. let see it detail, DOWNLOAD             LIVE DEMO it should need 5 files for this login-logout system, they are login/index page datafetch/usercheck page session/check page welcome/profile page logout page the above files must me needed for this. we can named it as our wish. let see what i done here. and the database file is needed, if you have any doubt about insert coding check here for insert code  database name --> 2mylogin table name --> login DB.PHP <?php $conn = mysql_connect ( 'localhost' , 'root' , '' ); $db = mysql_se...

Insert session variable into MySQL database

<?php session_start(); if(!isset($_SESSION['Username'])){ header("Location: login.php"); } ?>   $eventname = $_POST [ 'eventname' ]; $Username = $_SESSION [ 'Username' ] $sql = mysql_query ( "INSERT INTO tbl_name VALUES('','$eventname','{$_SESSION['Username']}')" ); echo "You have been added to the event" ;

php code to insert selected checkbox values into single mysql column comma separated

Image
Insert comma separated values into database column in mysql using PHP Download

One More Fieldset Multi Step Form with Js validation spam protection

Image
multi-step form with multifieldset   download

PHP NESTED LOOP (WHILE) TO DISPLAY DATA IN CATEGORIES

$query1= "SELECT DISTINCT OMEX_CAT FROM extras"; $result1=mysqli_query($conn, $query1); while($row1=mysqli_fetch_assoc($result1)){         $value=$row1['OMEX_CAT'];         echo  '<h3>'. $value.'</br></h3>';                 $query2= "SELECT * FROM extras where OMEX_CAT ='". $value. "'";         $result2=mysqli_query($conn, $query2);         while($row2=mysqli_fetch_assoc($result2)){             $value2=$row2['OMEX_NAME'];             echo $value2.'</BR>';         } echo "</br>"; } CATEGORY ONE Item 1 Item 2 CATEGORY TWO option 1 option 2

alter table Drop / Deleting Foreign Key in MySQL

To remove the key: ALTER TABLE table_name DROP KEY `key_column`; To remove  foreign key: ALTER TABLE table_name DROP FOREIGN KEY `table_name_ibfk_1`;

fetch data fron mysql different table connected using foreing key based on id

Image
  PHP File: readphp.php <!DOCTYPE html> < html > < head > < title > Read Data From Database Using PHP - Demo Preview </ title > < meta content = " noindex, nofollow " name = " robots " > < link href = " style.css " rel = " stylesheet " type = " text/css " > </ head > < body > < div class = " maindiv " > < div class = " divA " > < div class = " title " > < h2 > Read Data Using PHP </ h2 > </ div > < div class = " divB " > < div class = " divD " > < p > Click On Menu </ p > <?php $connection = mysql_connect ( "localhost" , "root" , "" ) ; // Establishing Connection with Server $db = mysql_select_db ( "company" , $connection ) ; // Selecting Database //MySQL Query to r...

mysql select query with two value in comman column (Is it possible to query a comma separated column for a specific value?)

ID | CATEGORIES --------------- 1 | c1 2 | c2 , c3 3 | c3 , c2 4 | c3 5 | c4 , c8 , c5 , c100     SELECT id FROM table WHERE categories LIKE '%c2%'; Would return rows 2 and 3 SELECT id FROM table WHERE categories LIKE '%c3%' and categories LIKE '%c2%'; Would again get me rows 2 and 3, but not row 4 SELECT id FROM table WHERE categories LIKE '%c3%' or categories LIKE '%c2%'; Would again get me rows 2, 3, and 4           sometimes   select * from YourTable where ',' || CommaSeparatedValueColumn || ',' LIKE '%,SearchValue,%'