| | |
login,display,selecting data from database querries
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2009
Posts: 10
Reputation:
Solved Threads: 0
hi everybody i have this code for selecting data from my sql database but when i outpot it it it looses align ment,can someone help me ,pliz,thanks
i also have this code for login as either administrator or user using the same button on the form but its not working whats the problem
sorry i have multiple problems i have this code but doesnt give any out put whats the problem i want to out put the records where a given day,month,year are entered from the form
can some one help me tell how to set colors in php,and also how to use the date type in mysql database,
laslt may some one help on how to pick data from multiple tables thanks
PHP Syntax (Toggle Plain Text)
<?php //The code is for selecting all patients records in the database //This selects the database and connects to the database require_once('Connections/Database.php'); mysql_select_db($database_Database, $Database); $stat="select * from patients"; $stat2=mysql_query($stat) or die('Error, query failed,we cant select any records'); echo"<table>"; echo"<tr><th></th><th>ID</th><th></th><th>SURNAME</th><th></th><th>FIRSTNAME</th><th></th><th>VILLAGE</th><th></th><td></td><td></td> <th>DEPARTMENT</th><th></th><th>AGE</th><th></th><th>SEX</th><th></th><th>TRIBE</th><th></th><th></th><th></th ><th></th><th></th><th></th><th>SYMPTOMS</th><th></th><th></th><th></th><th></th><th></th><th></th><th>DATE</th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th>WEIGHT</th><th></th><th></th><th></th><th></th><th>HEIGHT</th><th></th><th></th><th></th><th></th><th>TEMP</th><th></th><th></th><th></th><th></th><th>BLDPRESSURE</th></tr>"; echo"</table>"; echo"<table>"; while ($stat3=mysql_fetch_array($stat2)) { echo"<tr><th></th><th>$stat3[pID] </th><td></td><td></td><td></td><td></td><td>$stat3[pName] </td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[pfName] </td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[village]</td><td></td><td></td><td></td><td>$stat3[dept] </td><td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></td><td></td><td>$stat3[age] </td><td><td></td><td></td><td></td><td></td></td><td></td><td>$stat3[sex] </td><td></th><td></td><td></td><td></td><td></td><td>$stat3[tribe]</td><td></td><td></td><td></td><td></td><td></td><td>$stat3[symptoms]</td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[day]</td><td>$stat3[month]</td><td>$stat3[year]</td><td></td><td></td><td></td><td></td><td>$stat3[wgt]</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[hgt]</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[temp]</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[bldp]</td></tr>"; } echo"</table>"; ?>
i also have this code for login as either administrator or user using the same button on the form but its not working whats the problem
PHP Syntax (Toggle Plain Text)
<?php // This code will use the username entered to open the wellcome page for kawempe health centre require_once('Connections/Database.php'); mysql_select_db($database_Database, $Database); //This makes sure they did not leave any fields blank if (!$_POST['username'] | !$_POST['password'] ) { die('You did not complete all of the required fields'); } $a=$_POST['username']; $b=$_POST['password']; //This code runs if the form has been submitted if (isset($_POST['SUBMIT'])) { $_POST['username'] = addslashes($_POST['username']); $sql = "SELECT * FROM admin WHERE username = '$a' AND Password = '$b'"; $result = mysql_query($sql); $num=mysql_num_rows($result); if($num==1){ header("location:admnwelcom.html"); } if($num < 1) { $_POST['username'] = addslashes($_POST['username']); $sql1 = "SELECT * FROM users WHERE username = '$a' AND Password = '$b'"; $result1 = mysql_query($sql1); $num=mysql_num_rows($result1); if($num < 1) //username and password not found { exit("username and password you entered are not valid.<br>") ; } else { header("Location:wellcomepage.html"); } } } ?>
sorry i have multiple problems i have this code but doesnt give any out put whats the problem i want to out put the records where a given day,month,year are entered from the form
PHP Syntax (Toggle Plain Text)
<?php //The code is for selecting all patients records in the database where a particular month and year //This selects the database and connects to the database require_once('Connections/Database.php'); mysql_select_db($database_Database, $Database); $a=$_POST['monapt']; $b=$_POST['yearapt']; $c=&_POST['day'] $stat="select * from patients where month='$a',day='$c' AND year='$b'"; $result1=mysql_query($stat)or die('Error, query failed,we cant select any records'); $count=mysql_num_rows($result1); echo "<pre> $count record(s) Found</pre>"; echo"<table >"; while ($result=mysql_fetch_array($result1)) { echo"<pre> Patients number :$result[pID] <br> Patients Names :$result[pName] $result[pfName] <br> Age :$result[age] <br> Patients lives in :$result[village] <br> Department Visited :$result[dept] <br> Sex :$result[sex] <br> Tribe :$result[tribe] <br> Presented with :$result[symptoms] <br> Date visited :$result[month] $result[day] $result[year]<br> Patients Weight :$result[wgt] Kilograms<br> Patients Height :$result[hgt] centimetres<br> Temperature :$result[temp] Degrees centigrade<br> Blood Pressure :$result[bldp]mmhg <br> Doctors ID :$result[dID] <br>"; } echo"</table>"; ?>
can some one help me tell how to set colors in php,and also how to use the date type in mysql database,
laslt may some one help on how to pick data from multiple tables thanks
•
•
•
•
<tr><th></th><th>$stat3[pID]
</th><td></td><td></td><td></td><td></td><td>$stat3[pName]
</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[pfName]
</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[village]</td><td></td><td></td><td></td><td>$stat3[dept]
</td><td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></td><td></td><td>$stat3[age]
</td><td><td></td><td></td><td></td><td></td></td><td></td><td>$stat3[sex]
</td><td></th><td></td><td></td><td></td><td></td><td>$stat3[tribe]</td><td></td><td></td><td></td><td></td><td></td><td>$stat3[symptoms]</td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[day]</td><td>$stat3[month]</td><td>$stat3[year]</td><td></td><td></td><td></td><td></td><td>$stat3[wgt]</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[hgt]</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[temp]</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>$stat3[bldp]</td></tr>
Why, why, WWWWHHHHHHHHYYYYYYYY?. I'm not helping you until you explain this madness.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
![]() |
Similar Threads
- how or wat tool must i use to display or populate data from data from the database, (Visual Basic 4 / 5 / 6)
- displaying data from database to textbox (ASP.NET)
- retrieving data from database into jsp page (JSP)
- Retrving data from database to form (PHP)
- please help with pulling data from database... (PHP)
- How to code for a login form by taking data from Oracle db? (Visual Basic 4 / 5 / 6)
- fetching data from the database (JSP)
- Login and retrieve user data from database (ASP.NET)
- php wont submit data into the database (PHP)
Other Threads in the PHP Forum
- Previous Thread: Oscommerce Problem
- Next Thread: PHP and MySQL DELETE Issue
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javasciptvalidation javascript joomla keywords limit link login mail matching menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube






