473,385 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

display databse records

77
Hi all,

I have a website set up using database,

what i want to achieve is, i want a user to enter their number and then the database to display the records for only that number they entered...am using dreamweaver cs3
Oct 16 '08 #1
4 1280
Markus
6,050 Expert 4TB
That sounds fun. But where is your question?
Oct 16 '08 #2
Mubs
77
i got this far, but nothing appears just blank, no results are displayed..

[PHP]<?php require_once('Connections/mysql_connect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
mysql_select_db($database_mysql_connect, $mysql_connect);
if(isset($_POST['submit']))
{
//Get the input passed by the user
$student_number=$_POST['student_number'];
//Get the records specific to this student number
$query_Recordset1 = "SELECT * FROM robs_enterprise WHERE student_number='$student_number'";
$Recordset1 = mysql_query($query_Recordset1, $mysql_connect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<p>&nbsp;</p>

<p><input type="hidden" name="MM_insert" value="form1" />
<input type="text" name="Student number" id="Student number" />
<input type="submit" value="Submit" />
</p>
</body>
</html>[/PHP]
Oct 16 '08 #3
code green
1,726 Expert 1GB
got this far, but nothing appears just blank, no results are displayed..
Then what php errors are being reported.
What mysql errors are being reported.
What are the values of your variables
Oct 16 '08 #4
I did few changes in your code.. try this now?

[PHP]<?php require_once('Connections/mysql_connect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
mysql_select_db($database_mysql_connect, $mysql_connect);
if(isset($_POST['student_number']))
{
//Get the input passed by the user
$student_number=$_POST['student_number'];
//Get the records specific to this student number
$query_Recordset1 = "SELECT * FROM robs_enterprise WHERE student_number='$student_number'";
$Recordset1 = mysql_query($query_Recordset1, $mysql_connect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<p>&nbsp;</p>

<p>
<input type="hidden" name="MM_insert" value="form1" />
<input type="text" name="student_number" id="student_number" />
<input type="submit" value="submit" />
</p>
</body>
</html>[/PHP]
Oct 16 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: johnfli | last post by:
Ok, here is something strange. For a webpage that I have, I used to keep a list of names and email address in a delimited text file. Then for some reason, my host company did somethign and now...
5
by: Jack | last post by:
Hi, I need to build a asp page where it would serve as a data entry record page as well as display page for records saved. This page should also allow editing of records that has been saved. ...
9
by: Sandy | last post by:
Hi all, I have a form to list records (frmListIssue) which I call from different other forms. My wish is to display a message when the form is called and empty; no records to display. I want to...
2
by: Rahul | last post by:
Hey Guys I have a development environment, in which the whole SQL syntax is stored in the Database. So the syntax in the databse column could be "where BirthDate = '12/31/2005' and ID =...
5
by: Henning M | last post by:
Hi all, I having some problems with Access and selecting records between dates.. When I try this in access, it works fine!! "Select * from Bilag Where Mdates Between #1/1/2006# And...
1
by: colleen1980 | last post by:
How do i change the whole databse to readonly thru code. Thanks.
4
by: nma | last post by:
<td width="65" valign="top" width="65" height="44" border="1" vspace="2"><img src="<?php echo $row;?>"></td> <td width="195" class="eventEntryText" ><b><? echo " SHOT : $shotNumber";?><br...
1
by: Bakarre | last post by:
To display a field from databse and calculate time different -------------------------------------------------------------------------------- Good day, i have problem to display a field from...
2
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.