JavaScript Paging - php

I have the java and everything set up, but it's not paging. It shows the pagination page links but it doesn't limit it. Here is what I have:
<div class="pagination-holder clearfix" style="float: right;">
<div id="compact-pagination" ></div></div>
</div>
<div class="pagination-holder clearfix" style="float: right;">
<div id="compact-pagination" style="float: right;"></div></div>
<div id="compact-pagination" style="float: right;"></div>
<SCRIPT type="text/javascript">
$(function() {
$('#compact-pagination').pagination({
edges: 2,
currentPage: 1,
hrefText: "#page-",
prevText: "Prev",
nextText: "Next",
items: <? echo $count; ?>,
itemsOnPage: 2,
cssStyle: 'compact-theme'
});
});
</SCRIPT>
Then my php here.
So why won't it limit?
Link: http://flaviusmatis.github.com/simplePagination.js/
Php:
<?php $sql = "SELECT
*
FROM
users
ORDER BY user_id";
$result = mysql_query($sql);
if(!$result)
{
echo 'The category could not be displayed, please try again later.' . mysql_error();
}
else
{
if(mysql_num_rows($result) == 0)
{header('/');
echo 'This category does not exist.';
}
else
{
//display category data
while($row = mysql_fetch_assoc($result))
{
?>
<ul class="memberlist">
<li> <div id="memberlist" style="float: left; width: 300px; margin-left: 11px; margin-top: 10px; margin-bottom: 10px; border: 1px solid #CCC; border-radius:7px; background-color:#666;padding:5px 5px 5px 5px;">
<div id="memberlist_top">
<div id="memberlist_avatar">
<img src="<?php echo $row['avatar'] ?>" style="border: 1px solid #CBCBCB; padding: 3px; width: 100px; height: 100px;" />
</div>
<div id="memberlist_top_right">
<p id="memberlist_username"><?php echo $row['user_name'] ?></p>
<p style="text-align: center;"><img src="<?php echo$row['site_rank_image']?>"</p>
<p style="text-align: center;" id="ml_rep"> Reputation: 0 </p>
<p id="ml_posts">Post count: <?php echo $row['post'] ?></p>
</div>
<div class="clearfix" style="height: 5px;"> </div>
</div>
<div id="memberlist_bottom">
<p id="ml_bottom_p"><img src="template/images/layout/icon.png" style="vertical-align: middle" /> Date Registered: <span id="ml_bottom_span"><?php echo date(" F j, Y, g:i A", strtotime($row['user_date']))?> </span></p>
<p id="ml_bottom_p"><img src="template/images/layout/icon.png" style="vertical-align: middle" /> Last online: <span id="ml_bottom_span"><?php echo date(" F j, Y, g:i A", strtotime($row['dt']))?> </span></p>
<p id="ml_bottom_p" style="width: 284px; height: 30px; overflow-x: hidden; cursor: pointer;" title="Coming Soon"><img src="template/images/layout/icon.png" style="vertical-align: middle;" /> Last Activity: <span id="ml_bottom_span" style="text-decoration: underline;">Coming Soon</span></p>
<p id="ml_bottom_p"><img src="template/images/layout/icon.png" style="vertical-align: middle" /> Is online now: <span id="ml_bottom_span"> <? if($row
['online'] == 1) { // checks to see if the user allows their email to be shown, where '1' means they allow it to be shown
echo'Yes';
} else {
echo'No'; // if they allow it, it displays their email
} ?> </span></p>
</div>
</div> </li>
</ul>
<? }}}?>

How To Use
Step 1: together with JQuery, include jquery.simplePagination.js in your page:
<script type="text/javascript" src="path_to/jquery.js"></script>

Related

problem showing repeated whole page when trying to display data from database

I'm trying to display the data from the database, but whenever I connect it the whole page gets repeated - from the head title to a row and then it shows the head title again as if I had split the page, and another row from the database.
I want to show the data like the products page next to each other but it only shows one and then repeats the whole page.
This is my code that I tried - the page gets repeated from the main-container and shows one row, then repeats the main container again.
<?php
require_once 'opp_data.php';
$sql ="SELECT * FROM college_opp";
$allopp =$conn->query($sql);
?>
//i dont know if i have to show the whole code but this is only the code part where everything gets repeated
<?php
while ($row = mysqli_fetch_assoc($allopp)) {
?>
<div class="main-container">
<h2>تصفح الفرص التطوعية </h2>
<div class="post-collect">
<div class="post-main-container">
<div class="all sports">
<div class="post-img">
<img src="imgs/<?php echo $row["images"]; ?>">
<span class="category-name" data-name="sporty">كلية علوم الرياضة </span>
</div>
<div class="post-content">
<div class="post-content-top">
<span>
<i class="fa-solid fa-users-line"></i><?php echo $row["volunteer_num"]; ?>
</span>
<span><i class="fa-regular fa-calendar-days"></i><?php echo $row["Date"]; ?></span>
</div>
<h2>"<?php echo $row["Title"]; ?>"</h2>
<p>"<?php echo $row["Description"]; ?>"</p>
</div>
<div class="button-btn">
التفاصيل والتسجيل
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</body>
for the style.css\\
.main-container{
width: 90vw;
margin: 0 auto;
padding: 40px 0;
}
.main-container h2{
text-align: center;
padding: 90px 0;
font-size: 32px;
color: #fff;
}
.main-container p{
font-weight: 300;
padding: 10px 0;
opacity: 0.7;
text-align: center;
}
.post-main-container{
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 60px;
}
.post-main-container div{
box-shadow: 0px 8px 27px -12px rgba(0, 0, 0, 0.64);
}
.post-img{
position: relative;
width: 2vw;
height: 19vw;
}
.post-img img{
position: absolute;
left: 20px;
width: 17vw;
height: 19vw;
}
.post-content{
padding: 25px;
}
.post-content-top{
background: #2b1055;
color: #fff;
opacity: 0,9;
padding: 5px 0 5px 15px;
}
.post-content-top span{
padding-right: 20px;
}
.post-content h2{
font-size: 22px;
padding: 12px 0;
font-weight: 400;
}
.post-content p{
opacity: 0.7;
font-size: 15px;
line-height: 1.8;
color: ghostwhite;
}
.button-btn a {
padding: 8px 15px;
display: block;
font-family:'Almarai', sans-serif ;
font-size: 15px;
cursor: pointer;
background: transparent;
border-radius: 20px;
width: 50%;
border: 2px solid #fff;
color: #fff;
margin: 5px auto;
padding: 0.4rem;
text-decoration: none;
font-weight: 600;
transition: all 0.2s ease-in-out;
}
.button-btn a:hover{
background:#2b1055;
}
Because your entire page is in the while loop it will duplicate the whole page multiple times. I don't know if this is exactly what you want but I suggest you doing it something like this:
<?php
require_once 'opp_data.php';
$sql ="SELECT * FROM college_opp";
$allopp =$conn->query($sql);
?>
<div class="main-container">
<h2>تصفح الفرص التطوعية </h2>
<div class="post-collect">
<?php while ($row = mysqli_fetch_assoc($allopp)) { ?>
<div class="post-main-container">
<div class="all sports">
<div class="post-img">
<img src="imgs/<?php echo $row[" images "]; ?>">
<span class="category-name" data-name="sporty">كلية علوم الرياضة </span>
</div>
<div class="post-content">
<div class="post-content-top">
<span>
<i class="fa-solid fa-users-line"></i><?php echo $row["volunteer_num"]; ?>
</span>
<span><i class="fa-regular fa-calendar-days"></i><?php echo $row["Date"]; ?></span>
</div>
<h2>"
<?php echo $row["Title"]; ?>"</h2>
<p>"
<?php echo $row["Description"]; ?>"</p>
</div>
<div class="button-btn">
التفاصيل والتسجيل
</div>
</div>
</div>
<?php } ?>
</div>
</div>
This will only loop the post-main-container.
This is the code you are looking for
<div class="main-container">
<h2>تصفح الفرص التطوعية </h2>
<div class="post-collect">
<div class="post-main-container">
<?php
while ($row = mysqli_fetch_assoc($allopp)) {
?>
<div class="all sports">
<div class="post-img">
<img src="imgs/<?php echo $row["images"]; ?>">
<span class="category-name" data-name="sporty">كلية علوم الرياضة </span>
</div>
<div class="post-content">
<div class="post-content-top">
<span>
<i class="fa-solid fa-users-line"></i><?php echo $row["volunteer_num"]; ?>
</span>
<span>
<i class="fa-regular fa-calendar-days"></i><?php echo $row["Date"]; ?>
</span>
</div>
<h2>"<?php echo $row["Title"]; ?>"</h2>
<p>"<?php echo $row["Description"]; ?>"</p>
</div>
<div class="button-btn">
التفاصيل والتسجيل
</div>
</div>
<?php
}
?>
</div>
</div>
</div>

How can we add css in print preview?

code:
<style>
.center {
float: left;
text-align: center;
}
.center h3 {
color: #000;
font-weight: 600;
}
.left {
font-size: 14px;
float: left;
width: 30%;
color: #000;
}
.right {
font-size: 14px;
float: right;
width: 70%;
color: #000;
}
#bot {
margin-bottom: 2em;
}
#left {
font-size: 14px;
float: left;
width: 42%;
color: #000;
}
#right {
font-size: 14px;
float: right;
width: 58%;
color: #000;
}
table, td, th {
border: 1px solid #000;
text-align: left;
font-size: 14px;
font-weight: inherit;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding: 15px;
}
#pp {
font-size:14px;
color:#000;
}
.table-responsive {
overflow-x: hidden!important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
padding:0px!important;
}
</style>
<div class="col-md-12">
<a href="javascript:void(0)" class="btn btn-success" style="float: right;" onclick='printDiv();'>Print Sheet</a>
</div>
<div id="print_wrapp">
<div class="col-md-12" id="bot">
<div class="col-md-2">
<img src="<?php echo base_url(); ?>uploads/images/Lingayas Vidyapeeth Logo.png" class="img-responsive" style="width: 110px;">
</div>
<div class="col-md-10">
<div class="center">
<h3>
Lingaya's Vidyapeeth, Fraidabad<br>
Award Sheet<br>
End Semester Examination<br>
(May-June, 2019)
</h3>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12" id="bot">
<div class="col-md-6">
<div class="left">
<p>Department: </p>
</div>
<div class="right">
<p><?php echo $award[0]['department_name']?></p>
</div>
<div class="left">
<p>Program/Course: </p>
</div>
<div class="right">
<p><?php echo $award[0]['classes']?></p>
</div>
<div class="left">
<p>Subject Name: </p>
</div>
<div class="right">
<p><?php echo $award[0]['subject']?></p>
</div>
<div class="left">
<p>Session: </p>
</div>
<div class="right">
<p><?php echo $award[0]['session']?></p>
</div>
</div>
<div class="col-md-6">
<div class="left">
<p>Semester: </p>
</div>
<div class="right">
<p><?php echo $award[0]['yearsOrSemester']?></p>
</div>
<div class="left">
<p>Subject Code: </p>
</div>
<div class="right">
<p><?php echo $award[0]['subject_code']?></p>
</div>
<div class="left">
<p>Maximum Marks: </p>
</div>
<div class="right">
<p></p>
</div>
</div>
</div>
<div class="col-md-12" id="bot">
<div class="col-md-12">
<div class="table-responsive">
<table id="example1" class="table table-striped table-bordered table-hover dataTable no-footer">
<thead>
<th>S.No.</th>
<th>Roll No.</th>
<th>Marks(In Figure)</th>
<th>Marks(in Words)</th>
</thead>
<tbody>
<?php
$i=1;
foreach($award as $row)
{
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $row['roll']; ?></td>
<td></td>
<td></td>
</tr>
<?php
$i++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-12" id="bot">
<div class="col-md-6">
<div id="left">
<p>Total No. of Student Pass: </p>
</div>
<div id="right">
<p></p>
</div>
</div>
<div class="col-md-6">
<div id="left">
<p>Total No. of Student Fail: </p>
</div>
<div id="right">
<p></p>
</div>
</div>
</div>
</div>
</div>
<script>
function printDiv()
{
var divToPrint=document.getElementById('print_wrapp');
var newWin=window.open('','Print-Window');
newWin.document.open();
newWin.document.write('<html><link rel="stylesheet" href="<?php echo base_url(); ?>assets/plugins/bootstrap/css/bootstrap.css" type="text/css" /><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
newWin.document.close();
setTimeout(function(){newWin.close();},10);
}
</script>
In this code I am simply run print content inside div <div id="print_wrapp"> by click function i.e printDiv and its working properly but the problem is that print preview css not showing div content properly and an image is mention below:
and my original page look like:
So, How can I fix this problem? Please help me.
Thank You
You can apply the style sheet too both print and screen using media='screen,print'
<link ../bootstrap.min.css' rel='stylesheet' media='screen,print'>
or
<link ../bootstrap.min.css' rel='stylesheet' media='all'>
When we want to apply some style when printing a page, we need to apply the styles using #media print. Then only the style will apply for windows print function.
Style.css
#media print
{
.center {
float: left;
text-align: center;
}
.center h3 {
color: #000;
font-weight: 600;
}
.left {
font-size: 14px;
float: left;
width: 30%;
color: #000;
}
.right {
font-size: 14px;
float: right;
width: 70%;
color: #000;
}
}
Then link the css file where you want to print the page with style.
<link rel="stylesheet" type="text/css" href="Style.css">
Call the Print Function on Button Click
<button onclick="printPage()" class="center">Print</button>
<script>
function printPage()
{
print();
}
</script>

how can I get 3 data in cycle with jquery

I have a website which is using the CodeIgniter framework. In my one page I should get some data and list them. and I don't want to use the scrollbar on this page.
how can I get 3 data in cycle with jquery?
This code is getting just 1 data in cycle but I want to get 3 data in the cycle.
<ul class="list">
<?php foreach ($a_list as $hd) { ?>
<div id="content-1">
<a href="single.html">
<li>
<section class="list-left" style="border:0px solid red; width:30%; height:90px;">
<section class="list" style="border-bottom:1px solid red; width:100%; margin-top: 0; text-align: center">
<h6 class="title" >Hasta</h6>
</section>
<p class="adprice" style="color:black; text-align: center; font-size: -5;"><?= $hd->h_adi ?> <?= $hd->h_soyadi ?>
</section>
<section class="list-left"style="border:0px solid red; width:30%; height: 90px">
<section class="list" style="border-bottom:1px solid red; width:100%; margin-top: 0; text-align: center">
<h5 class="title" >Doktor</h5>
</section>
<p class="adprice" style="text-align: center">
<?= $hd->a_unvan ?>
<?= $hd->dr_adi ?>
<?= $hd->dr_sadi ?>
<br>
<p class=catpath style="text-align: center; margin-top: 0px !important; color:black">
<?=$hd->a_brans?>
Uzmanı
</p>
</p>
</section>
<section class="list-left" style="border:0px solid red; width:30%;height: 90px">
<section class="list" style="border-bottom:1px solid red; width:100%; margin-top: 0; text-align: center">
<h5 class="title" >Durum</h5>
</section>
<p class="adprice" style="color:blue;text-align: center"><?=$hd->h_durum?></p>
</section>
<div class="clearfix"></div>
</li>
</a>
</div>
<?php } ?>
<script src='<?=base_url()?>/assets/js/jquery.min.js'></script>
<script>
var divs = $('div[id^="content-"]').hide(),
i = 0;
(function cycle() {
divs.eq(i).fadeIn(400)
.delay(1000)
.fadeOut(400, cycle);
i = ++i % divs.length;
})();
</script>
<a href="single.html">
</a>
</ul>
zxcf

Download PDF using php with logo always on top of each page

I have this code to display on the page, however I also want to give users the option to download PDF , but on top of each PDF page I want there to be a logo picture, how can I do this? Is there a way with datatables? or just plain code?
<table>
<?php
foreach($sheets as $s):
echo "<tr>";
echo "<td>";
$name= explode(' ',$s['customer_name'])
?>
<div style="text-align: center">
<img alt="" src="/adminpanel2/public/logo.png">
</div>
<h2 style="text-align: center">Hi <?php echo $name[0] ?>!</h2>
<div align="center">
<br> Here is your delivery for: <br>
<?php echo date('l, F dS', strtotime($s['delivery_week']));?>
<br>
ORDER NO. <?php echo $s['order_id'] ?> | CUSTOMER NO.<?php echo $s['client_id'] ?>
<hr style="height: 5px;border-top:1px solid #000 !important;margin-bottom:0px">
<hr style="height: 5px;border-top:1px solid #000 !important;margin-top: 5px !important;">
</div>
<?php foreach($s['meals'] as $m):?>
<h3><?php echo $m['display_name'];?> </h3>
<?php echo $m['count']?> SERVING SHIPPED<br><br>
COMPONENTS
<hr align = "left" style="width: 115px; border-top:1px solid #000 !important;margin-top: 5px !important;margin-bottom:0px">
<br>
<?php foreach($m['components'] as $c):?>
<?php echo $c?><br>
<?php endforeach;?>
<hr align="left" style="width: 400px; border-top:1px solid #000 !important;margin-top: 5px !important;margin-bottom:0px" >
<?php endforeach;?>
<hr align="left" style="width: 600px; border-top:1px solid #000 !important;margin-top: 5px !important;margin-bottom:0px" >
<div align="center"><h3> Thank you,<?php echo $name[0] ?>!</h3>
<hr style="width: 600px; border-top:1px solid #000 !important;margin-top: 5px !important;margin-bottom:0px" >
</div>
<br>
<br>
<br>
<br>
<br>
</td>
</tr>
<?php endforeach; ?>
</table>
Here is my code (above) I am using php fuel

Outputs Information depending on the account logged

I am creating a very basic SocialSite, you know like Facebook, Twitter, etc.
And I wonder how can I output the information depending on the account logged in the 'login.php'
I have tried using on my Profile.php
$result = $mysql_query("SELECT * FROM `user` WHERE `UserName`='$user'");
while($row = mysql_fetch_array($result)){
$fname = $row['FirstName'];
}
But it only shows a lot of unidentified index and variable error.
here's my login php in-case you are wondering.
require 'Connect.php';
$username = $_POST['inputUserName'];
$password = $_POST['inputPassword'];
$sql = "SELECT * FROM 'user' WHERE 'UserName' = '$username'";
$res = mysql_query($sql) or die(mysql_error());
if( mysql_num_rows($res) > 0){
$row = mysql_fetch_assoc($res);
if($row['Password'] == $password){
$_SESSION['username'] = $username;
header('Location:../links/profilePage.php');
}
else{
$_SESSION['err_msg'] = "invalid password";
header('Location:../links/signIn.php');
}
}
else{
$sql = "SELECT * FROM 'user' WHERE `UserName` = '$username'";
$res = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res)){
$row = mysql_fetch_assoc($res);
if($row['Password'] == $password){
$_SESSION['username'] = $username;
header('Location:../links/profilePage.php');
}
else{
$_SESSION['err_msg'] = "invalid password";
header('Location:../links/signIn.php');
}
}
else{
$_SESSION['err_msg'] = "User does not exist";
header('Location:../homePage.php');
}
}
Help is always appreciated. thank you.
Edit: The whole ProfilePage
<html>
<?php
session_start();
require 'Connect.php';
$user = mysql_real_escape_string($_POST['username']);
$result = mysql_query("SELECT * FROM `user` WHERE `UserName`='$user'");
while($row = mysql_fetch_array($result)){
$fname = $row['FirstName'];
}
?>
<head>
<!-- bootstrap plugin -->
<link href="../css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<link href="../css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css" />
<link href="../css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- jquery plugin -->
<script src="../js/jquery-1.11.1.js"></script>
<!-- Site body css -->
<style type="text/css">
#SiteBody{
width: 1100px;
margin: 0 auto;
}
</style>
<body>
<div id="SiteBody">
<center>
<div class="hero-unit">
<!-- Start header -->
<img src="../images/logo.png"/>
<!-- End header -->
</center>
<!--Header Bar!-->
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<a class="brand">User Profile</a>
<!--Nav bar items!-->
<p class="navbar-text pull-right">
Search: <input id="search" name="search" type="search" placeholder="search for friends" class="input-medium">
Home
Settings
Sign-Out
</p>
</div>
</div>
<!--Header Bar END !-->
<br>
<!--icon-->
<div class="well span2" style="background-color:white; height: 200px; width: 135px; border: 5px rigid; border-color: white;" >
<ul class="nav nav-list">
<img src="../images/icon.png" alt="displaypic" style="height:200px; width:300px;">
<p style = "text-align: center">
</p>
</ul>
</div>
<!-- Post Status -->
<!-- <div class="row-fluid" style="padding:1px;"> -->
<div class="well span2" style="background-color:#4CBB17; height: 200px; width: 820px; border: 5px rigid; border-color: black;" >
<ul class="nav nav-list">
<strong> *SLIDE SHOW* </strong>
</ul>
</div>
<!-- Basic Information -->
<!-- <div class="row-fluid" > -->
<div class="well span2" style="font-size: 25; background-color:#4DBD33; height:300px; width:620px; border: 5px rigid; border-color: black; " >
<ul class="nav nav-list">
<strong><u>Basic Information</u></strong>
<br>
<br>
<br>
Name:<?php echo '$fname' ?>
<br>
<br>
Gender:
<br>
<br>
Birthday:
<br>
<br>
Address:
<br>
<br>
Email:
<br>
<br>
Contact number:
<br>
<br>
</ul>
</div>
<!-- Display Picture -->
<!-- <div class="row-fluid" style="padding:1px;"> -->
<div class="well span2" style="background-color:#55AE3A; height: 300px; width: 335px; border: 5px rigid; border-color: black; " >
<ul class="nav nav-list">
<img src="../images/def.png" alt="displaypic" style="height:250px; width:285px; border:10px ridge; border-color:green; margin-top: 10px;">
<p style = "text-align: center">
(User Name) <br>
</p>
</ul>
</div>
<!--work and edu boutton-->
<div class="well span2" style="background-color:#93DB70; height: 250px; width: 280px; border: 5px rigid; border-color: black; " >
<ul class="nav nav-list">
<img src="../images/button1.png" alt="displaypic" style="height:250px; width:285px; margin-top: 10px;">
<p style = "text-align: center">
</p>
</ul>
</div>
<!--hobbies and interests boutton-->
<div class="well span2" style="background-color:#4CBB17; height: 250px; width: 280px; border: 5px rigid; border-color: black; " >
<ul class="nav nav-list">
<img src="../images/button2.png" alt="displaypic" style="height:250px; width:285px; margin-top: 10px;">
<p style = "text-align: center">
</p>
</ul>
</div>
<!--upload boutton-->
<div class="well span2" style="background-color:#93DB70; height: 250px; width: 335px; border: 5px rigid; border-color: black; " >
<ul class="nav nav-list">
<img src="../images/button3.png" alt="displaypic" style="height:250px; width:285px; margin-top: 10px;">
<p style = "text-align: center">
</p>
</ul>
</div>
<!-- Friends List -->
<!-- <div class="row-fluid"style="padding:1px;"> -->
<div class="well span2" style="background-color:#4DBD33; height: 250px; width: 620px; border: 5px rigid; border-color: black;">
<ul class="nav nav-list">
<strong>Friends List</strong>
</ul>
</div>
<!--view boutton-->
<div class="well span2" style="background-color:#55AE3A; height: 250px; width: 335px; border: 5px rigid; border-color: black; " >
<ul class="nav nav-list">
<img src="../images/button4.png" alt="displaypic" style="height:250px; width:285px; margin-top: 10px;">
<p style = "text-align: center">
</p>
</ul>
</div>
<div class="well span2" style="background-color:black; height: 2px; width: 1015px; border: 5px rigid; border-color: black; " >
<ul class="nav nav-list">
<p style = "text-align: center" class="navbar-link">
(c) Cabreros.Parman.Victory.Ylanan.
</p>
</ul>
</div>
</div>
</div>
</body>
$result = $mysql_query("SELECT * FROM `user` WHERE `UserName`='$user'");
Try removing the $ sign before the function mysql_query (i assume you mean the function)?
Some other tips: You should never ever pass user input values to your sql query to prevent the risk of SQL Injections. You have some code duplication here (and you do the same sql query twice, why?), maybe you should rethink your code architecture and use classes/functions.
It seems you save the passwords of your users in plain text? You should at least hash these passwords for security reasons.
You need to tell us what errors you are getting. I can suggest that one of the values does not exist such as
$_POST['inputUserName'];
$_POST['inputPassword'];
$row['Password']
You can use isset to see if it has a value
if (isset($_POST['inputUserName'])
$username = $_POST['inputUserName'];
else
$username = '';

Categories