Page 1 of 2

new to php

Posted: Thu May 26, 2005 8:30 am
by cr-isp
hi all,

im having a little problem with some coding i need to do, the problem lies i think with the fact im trying to echo out commands in an html table. the script just keeps bombing out. does any one have any idead hoe to fix this script.

many thanks in advance

Alan

script is as follows...

Code: Select all

<?PHP 
$cfgProgDir = crispsession/; 
include($cfgProgDir . secure.php);
?>

<html>

<head>
<meta http-equiv=Content-Language content=en-gb>
<meta http-equiv=Content-Type content=text/html; charset=windows-1252>
<title>New Page 1</title>
</head>

<?
    
mysql_connect(localhost,database,password);

$query1 = SELECT * FROM table WHERE username=$login and password=$password;
$result1 = mysql_db_query(database,$query1);
while($row = mysql_fetch_object($result1)) {

echo(

<body>

<table cellpadding=0 cellspacing=0 width=450>
	<!-- MSTableType=layout -->
	<tr>
		<td height=34 width=181>
		<p align=right><font face=Tahoma size=2>Test Php Table Echo</font></td>
		<td height=34 width=9> </td>
		<td height=34><font face=Tahoma size=2>Details</font></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181 valign=top align=right>
		<font face=Tahoma size=2>First Name:</font></td>
		<td height=13 width=9></td>
		<td height=13><font face=Tahoma size=2>$row->first_name</font></td>
	</tr>
	<tr>
		<td height=13 width=181 valign=top align=right>
		<font face=Tahoma size=2>Last Name:</font></td>
		<td height=13 width=9></td>
		<td height=13><font face=Tahoma size=2>$row->last_name</font></td>
	</tr>
	<tr>
		<td height=13 width=181 align=right><font face=Tahoma size=2> </font></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181 valign=top align=right>
		<font face=Tahoma size=2>Wireless Adapter:</font></td>
		<td height=13 width=9></td>
		<td height=13><font face=Tahoma size=2>$row->wireless_adapter</font></td>
	</tr>
	<tr>
		<td height=13 width=181 valign=top align=right>
		<font face=Tahoma size=2>Speed:</font></td>
		<td height=13 width=9></td>
		<td height=13><font face=Tahoma size=2>$row->speed</font></td>
	</tr>
	<tr>
		<td height=13 width=181 align=right><font face=Tahoma size=2> </font></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181 align=right><font face=Tahoma size=2> </font></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
	<tr>
		<td height=13 width=181></td>
		<td height=13 width=9></td>
		<td height=13></td>
	</tr>
</table>

</body>

</html>

);
    
 }
                
?>

Posted: Thu May 26, 2005 8:32 am
by cr-isp
ive also removed the final " out of the script
i know the code i submitted had some left in it

Alan

Posted: Thu May 26, 2005 8:34 am
by patrikG
see how nice the code looks now? Why is that? Because I added

Code: Select all

-tags[/url] around it. Next time you do it yourself. Saves your time, my time, and the time of the people who anwer. Wow. Amazing, innit?

Posted: Thu May 26, 2005 8:37 am
by cr-isp
ahh right

cool, looks alot better now, easier to understand

thanks

Posted: Thu May 26, 2005 8:43 am
by JayBird
and what is your error?

Posted: Thu May 26, 2005 8:44 am
by artexercise
First on line 22 and line 204 of the above code.
Line 22 needs to have an open quote such as
echo ("
Line 204 needs to close that quote
");

JOE--

Posted: Thu May 26, 2005 8:45 am
by shiznatix
This function is deprecated, do not use this function. Instead, use mysql_select_db() and mysql_query() instead.
for mysql_db_query

from php.net

also

Code: Select all

$query1 = "SELECT * FROM table WHERE username='$login' and password='$password'";
put quotes around your query.

what is this "bombing out" that your script does, be specific

Posted: Thu May 26, 2005 8:55 am
by cr-isp
sorry should of said what was specific, my php ini file has error checking turned off so the white page is all i get, i have seen error checking done by using echo commands for each step.

will try points above and get back to you all

many thanks for the speedy response, a little over whelmed how helpfull and quick every one is.

tarrrr for now

Alan

Posted: Thu May 26, 2005 8:57 am
by JayBird
put this at the top of your script

Code: Select all

error_reporting(E_ALL);        // error reporting set to display all

Posted: Thu May 26, 2005 8:57 am
by cr-isp
did a find and replace on " thats wht line 22 and 204 were lissing open and close statements

Alan

Posted: Thu May 26, 2005 9:20 am
by cr-isp
tried all suggested and still its not working, even the error checking has not worked when inserting it at th top of the page.

open to more suggestions

Alan

Posted: Thu May 26, 2005 9:23 am
by patrikG
line 2:

Code: Select all

$cfgProgDir = "crispsession/";
You want to assign a string to $cfgProgDir.

Posted: Thu May 26, 2005 9:25 am
by cr-isp
code looks like this

Code: Select all

<?PHP 
$cfgProgDir = session/; 
include($cfgProgDir . secure.php);
// error reporting set to display all
error_reporting(E_ALL);        
?>

<html>

<head>
<meta http-equiv=Content-Language content=en-gb>
<meta http-equiv=Content-Type content=text/html; charset=windows-1252>
<title>New Page 1</title>
</head>

<?
    
mysql_connect(localhost,database,password);

$query1 = "SELECT * FROM table WHERE username='$login' and password='$password'";
$result1 = mysql_db_query(databsse,$query1);
while($row = mysql_fetch_object($result1))  {

echo("
thats the top part

and the bottom is finshed like this

Code: Select all

");
    
 }
                
?>
and trying to echo feilds out in the table looks like this

Code: Select all

<tr>
  <td height=13 width=181 valign=top align=right>
  <font face=Tahoma size=2>First Name:</font></td>
  <td height=13 width=9></td>
  <td height=13><font face=Tahoma size=2>$row-  >first_name</font></td>
</tr>
any ideas now guys

Posted: Thu May 26, 2005 9:28 am
by shiznatix
patrikG wrote:line 2:

Code: Select all

$cfgProgDir = "crispsession/";
You want to assign a string to $cfgProgDir.
you gotta put the quotes around the $cfgProgDir value

Posted: Thu May 26, 2005 9:28 am
by patrikG
1. read my previous post
2. Error reporting doesn't work properly if you insert it after the erroneous PHP.

Use this

Code: Select all

error_reporting(E_ALL);        
$cfgProgDir = "crispsession/"; 
include($cfgProgDir . secure.php);
// error reporting set to display all