database search and show in website?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
bd_safa
Forum Newbie
Posts: 8
Joined: Thu Jan 08, 2009 1:33 pm

database search and show in website?

Post by bd_safa »

hello everyone

i am having a little problem with how i can have a page similar to the images below, i am still a noob in php and sql , so please help me out :wink:
Last edited by bd_safa on Sat Jan 10, 2009 6:56 am, edited 1 time in total.
User avatar
it2051229
Forum Contributor
Posts: 312
Joined: Tue Dec 25, 2007 8:34 pm

Re: database search and show in website?

Post by it2051229 »

what do you mean by similar page? you mean those two output should be located in a single PHP file and using PHP to decide which one to display?
User avatar
bd_safa
Forum Newbie
Posts: 8
Joined: Thu Jan 08, 2009 1:33 pm

Re: database search and show in website?

Post by bd_safa »

it2051229 wrote:what do you mean by similar page? you mean those two output should be located in a single PHP file and using PHP to decide which one to display?
no, you give the refrence number and password in image 1, and php returns the info about the entery in image number 2, thats what i mean
User avatar
it2051229
Forum Contributor
Posts: 312
Joined: Tue Dec 25, 2007 8:34 pm

Re: database search and show in website?

Post by it2051229 »

great, have you started coding it?
User avatar
bd_safa
Forum Newbie
Posts: 8
Joined: Thu Jan 08, 2009 1:33 pm

Re: database search and show in website?

Post by bd_safa »

it2051229 wrote:great, have you started coding it?
well , since i am not good at sql, so i don't know where to start from!? 8O
User avatar
it2051229
Forum Contributor
Posts: 312
Joined: Tue Dec 25, 2007 8:34 pm

Re: database search and show in website?

Post by it2051229 »

this is not a tutorial website.. you start coding and when you have stuff that you dont understand or can't get it working then this is where we come in. There are a lot of free PHP Mysql Books you can download from the internet.
User avatar
bd_safa
Forum Newbie
Posts: 8
Joined: Thu Jan 08, 2009 1:33 pm

Re: database search and show in website?

Post by bd_safa »

it2051229 wrote:this is not a tutorial website.. you start coding and when you have stuff that you dont understand or can't get it working then this is where we come in. There are a lot of free PHP Mysql Books you can download from the internet.
well , then let me finish the coding then i will let you know about it.
User avatar
bd_safa
Forum Newbie
Posts: 8
Joined: Thu Jan 08, 2009 1:33 pm

Re: database search and show in website?

Post by bd_safa »

Cheers, I finished the coding and it works well, if you want the codes , just let me know. :)
User avatar
it2051229
Forum Contributor
Posts: 312
Joined: Tue Dec 25, 2007 8:34 pm

Re: database search and show in website?

Post by it2051229 »

just make sure its worth looking at it.
User avatar
bd_safa
Forum Newbie
Posts: 8
Joined: Thu Jan 08, 2009 1:33 pm

Re: database search and show in website?

Post by bd_safa »

here we go :
<style type="text/css">
<!--
body {
margin-left: 30px;
}
-->
</style><?
$refr_field = $_POST['refr'];
$pass_field = $_POST['pass'];
$user="user";
$password="pass";
$database="database";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM status WHERE ref=$refr_field";
$result=mysql_query($query);
echo "<b><center>Onine Paper Status Report</center></b><br><br>";
if (mysql_num_rows($result)==0){
echo "The refrence number or password is incorrect or the paper is removed, please contact the office for more information";
exit;
}
while ($row=mysql_fetch_assoc($result)){
if ($pass_field==$row["pass"]){
echo "<b>Refrence Number:</b><br>";
echo $row["ref"];
echo "<br><b>Paper Title:</b><br>";
echo $row["title"];
echo "<br><b>Authors:</b><br>";
echo $row["auth"];
echo "<br><b>Correspondens:</b><br>";
echo $row["cor"];
echo "<br><b>Paper Status:</b><br>";
echo $row["stat"];
echo "<br><b>Message from editor:</b><br>";
echo $row["msg"];
} else {
echo "The refrence number or password is incorrect or the paper is removed, please contact the office for more information";
}
}
mysql_free_result($result);
?>
User avatar
it2051229
Forum Contributor
Posts: 312
Joined: Tue Dec 25, 2007 8:34 pm

Re: database search and show in website?

Post by it2051229 »

ok you wasted my time, it's not worth looking at. oh and good start.
Post Reply