[Gllug] mySQL PHP

Jackson, Harry HJackson at colt-telecom.com
Tue Jul 10 15:09:01 UTC 2001


Hi all,

	For anyone who is interested this is the PHP page that I am using to
generate the front page. It probably could be a lot neater but it works
except on initial load because the "$var"  variables have not been initiated
and I am not sure how to initiate them only on refresh or first entry of the
page. I have tried to just declare them but they then always default to that
value when I hit the "Enter Information" button on the page.

Happy reading!!


<html>
<body>

<a href=second.php>(For SPR Numbers and Remedy Cases Click here)</a><br><br>

<a href=help.php>(HELP Click here)</a><br>

<h2>Auto Wildcards are being used for the following Query:</h2>

  <form method="post" action="<?php echo $PHP_SELF?>">

 	WHERE	:	<SELECT NAME="var1">
			<OPTION value = CASEID>CASEID
			<OPTION value = Arrived>Arrived
			<OPTION value = Type>Type
			<OPTION value = Name>Name
			<OPTION value = Short>Short
			<OPTION value = Details>Details
			<OPTION value = WorkLog>WorkLog
			<OPTION value = Individual>Individual      /* 20 */
			<OPTION value = Status>Status
			<OPTION value = Pending>Pending                
			</SELECT>
	
	

         IS LIKE 	: <input type="Text" name="var2">

	AND	:	<SELECT NAME="var3">
			<OPTION value = CASEID>CASEID
			<OPTION value = Arrived>Arrived
			<OPTION value = Type>Type
			<OPTION value = Name>Name
			<OPTION value = Short>Short
			<OPTION value = Details>Details
			<OPTION value = WorkLog>WorkLog
			<OPTION value = Individual>Individual
			<OPTION value = Status>Status
			<OPTION value = Pending>Pending
			</SELECT>					

	IS	:	<SELECT NAME="var4">
			<OPTION value = LIKE>LIKE
			<OPTION value = "NOT LIKE">NOT LIKE
			</SELECT>


			:<input type="Text" name="var5">



  <input type="Submit" name="submit" value="Enter information">

  </form>

<?php

$db = mysql_connect("localhost");

mysql_select_db("remedy_harry",$db);                                   //60

$caseid = mysql_query("SELECT * FROM remedy_base where $var1 Like '%$var2%'
and $var3 $var4 '%$var5%'",$db);


printf("<h1><b> The following is a list of Case ID's for Remedy:
</b></h1><br><table border=1>");


while ($myrow = mysql_fetch_row($caseid)) {

$myrow[6] = eregi_replace("\n", "<br>", $myrow[6]);

printf( "<tr><td>%s</td>  <td>%s</td> 
	     <td>%s</td>  <td>%s</td> 
	     <td>%s</td>  <td>%s</td> 
	     <td>%s</td>  <td>%s</td>
	     <td>%s</td>  <td>%s</td>
	</tr>"
	     , $myrow[0],  $myrow[1]
	     , $myrow[2],  $myrow[3]
	     , $myrow[4],  $myrow[5]
	     , $myrow[6],  $myrow[7]
	     , $myrow[7],  $myrow[8]
	     , $myrow[9]
	);

}


echo "</table>\n";


?>

</body>

</html>



     



**********************************************************************
COLT Telecommunications
Registered in England No. 2452736
Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ
Tel. 020 7390 3900

This message is subject to and does not create or vary any contractual
relationship between COLT Telecommunications, its subsidiaries or 
affiliates ("COLT") and you. Internet communications are not secure
and therefore COLT does not accept legal responsibility for the
contents of this message.  Any view or opinions expressed are those of
the author. The message is intended for the addressee only and its
contents and any attached files are strictly confidential. If you have
received it in error, please telephone the number above. Thank you.


**********************************************************************

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list