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
4 1292 Markus 6,050
Recognized Expert Expert
That sounds fun. But where is your question?
i got this far, but nothing appears just blank, no results are displayed..
[PHP]<?php require_once('C onnections/mysql_connect.p hp'); ?>
<?php
if (!function_exis ts("GetSQLValue String")) {
function GetSQLValueStri ng($theValue, $theType, $theDefinedValu e = "", $theNotDefinedV alue = "")
{
$theValue = get_magic_quote s_gpc() ? stripslashes($t heValue) : $theValue;
$theValue = function_exists ("mysql_real_es cape_string") ? mysql_real_esca pe_string($theV alue) : mysql_escape_st ring($theValue) ;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValu e) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theV alue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValu e : $theNotDefinedV alue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_ SERVER['QUERY_STRING']);
}
mysql_select_db ($database_mysq l_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_Recordse t1 = "SELECT * FROM robs_enterprise WHERE student_number= '$student_numbe r'";
$Recordset1 = mysql_query($qu ery_Recordset1, $mysql_connect) or die(mysql_error ());
$row_Recordset1 = mysql_fetch_ass oc($Recordset1) ;
$totalRows_Reco rdset1 = mysql_num_rows( $Recordset1);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitl ed Document</title>
</head>
<body>
<p> </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]
code green 1,726
Recognized Expert Top Contributor
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
I did few changes in your code.. try this now?
[PHP]<?php require_once('C onnections/mysql_connect.p hp'); ?>
<?php
if (!function_exis ts("GetSQLValue String")) {
function GetSQLValueStri ng($theValue, $theType, $theDefinedValu e = "", $theNotDefinedV alue = "")
{
$theValue = get_magic_quote s_gpc() ? stripslashes($t heValue) : $theValue;
$theValue = function_exists ("mysql_real_es cape_string") ? mysql_real_esca pe_string($theV alue) : mysql_escape_st ring($theValue) ;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValu e) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theV alue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValu e : $theNotDefinedV alue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_ SERVER['QUERY_STRING']);
}
mysql_select_db ($database_mysq l_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_Recordse t1 = "SELECT * FROM robs_enterprise WHERE student_number= '$student_numbe r'";
$Recordset1 = mysql_query($qu ery_Recordset1, $mysql_connect) or die(mysql_error ());
$row_Recordset1 = mysql_fetch_ass oc($Recordset1) ;
$totalRows_Reco rdset1 = mysql_num_rows( $Recordset1);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitl ed Document</title>
</head>
<body>
<p> </p>
<p>
<input type="hidden" name="MM_insert " value="form1" />
<input type="text" name="student_n umber" id="student_num ber" />
<input type="submit" value="submit" />
</p>
</body>
</html>[/PHP]
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 my page can not read teh text file, but it can write to
it. Go figure that one.
ANyway, So I created an access database to replace teh text file and I
imported the data straight from the Text file.
|
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.
e.g.
SAVEBUTTON
SS# EntryBox Name EntryBox Date EntryBox Revenue Generated EntryBox
|
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 use OpenArgs because sometimes I
don't want an empty form and sometime I don't. I tried everything, but
until now without success. I hope that someone can help me out here.
This is an example how I call the form:
|
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 = 345"
Note : The above string is stored and the dates are in US format. so
|
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 #31/1/2006#"
But when I try it from my vb.net app, I get ALL the records in the tabel??
What goes wrong?
I haven't been able to find any info on the net, besides others having
| |
by: colleen1980 |
last post by:
How do i change the whole databse to readonly thru code.
Thanks.
|
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 /></td>
Hi
I want to display jpeg image stored in a databse but have problem the image does not display. only show shotnumber. What is wrong with the first line of code? The code can display list of shots from table but the jpeg does not appear.
...
|
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 databse and calculate time different.
See below my code.
I hope somebody can fix the problem for me.
<?php
|
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 different item no in it..then, these records will be saved in a temporary datatable (which i made in a separate class, the name is WBASKET)...The item nos of these records will be displayed in a combobox, say item1, item2, etc..
then,i have a datagrid...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |