PDA

View Full Version : Need help with the resultpage


Fronix
01-06-2008, 11:17 AM
Hello i have followed these beginner tut's and everything is workig fine but when i came to the second last tut and he says that he made a own code and he has some wierd number or whatever it is but i cant get it to work.

Here is my code:
I will make the place red where i cant get it working
<?php
require_once("../../../Documents and Settings/oskar/My Documents/Local root/Test/Connections/connection.php"); // database connection script
////////////////////////////////////////////
$data2 = $_POST['data2'];
$data3 = $_POST['data3'];
$data4 = $_POST['data4'];
$submit = $_POST['submit'];
////////////////////////////////////////////
if ($submit ?? $data2 $data3 $data4)(
//////////////////////////////////////////
$query = sprintf("INSTERT info realtech ($field2, $field3, $field4) values ('$data2, $data3, $data4')");
mysql_query[$query]or die(mysql_error()];
//////////////////////////////////////////
)elseif($submit)(
echo "Oce of your fields is empty";
)
/////////////////////////////////////////////////
$query = sprintf("SELECT * FROM realtech");
$result = @mysql_query($query);
$row = mysql_fetch_array($result);
/////////////////////////////////////////////////

/*do (
echo $row['field3']."<br>";
)while ($row = mysql_fetch_array($result))*/


?>

<!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=iso-8859-1" />
<title>Connection</title>
<style type="text/css">
<!--
.style1 (font-size: 10px)
-->
</style>
</head>
<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action=""<?php $_SERVER['PHP_SELF']; ?>">
<table width="452" border="1">
<tr>
<td width="144">data2</td>
<td width="292">data3</td>
<td width="144">data4</td>
</tr>
<tr>
<td height="23"><label for="textfield"></label>
<input type="text" name="data2" id="data2" /></td>
<td><label for="label"></label>
<input type="text" name="data3" id="label" /></td>
<td><label for="label2"></label>
<input type="text" name="data3" id="label2" /></td>
</tr>
<tr>
<td height="39" colspan="3"><label for="textfield"></label>
<label for="Submit"> </label>
<label for="Submit"></label>
<h1>
<label for="Submit"></label>
<input type="submit" name="Submit" value="Submit" id="Submit" />
<input name="submit" type="hidden" id="submit" />
</h1></td>
</tr>
</table>
<p>&nbsp;</p>
</form>
<table width="424" height="57" border="1">
<tr>
<td height="24">ID1</td>
<td>data2</td>
<td>data3</td>
<td>data4</td>
</tr>

<?php do ( ?>
<tr>
<td height="25"><?php echo $row['field1_id'];?></td>
<td><?php echo $row['field2']?></td>
<td><?php echo $row['field3']?></td>
<td><?php echo $row['field4']?></td>
</tr>
<?php )while ($row = mysql_fetch_array($result)); ?>


</table>
</body>
</html>

Plz telle me is there is anything wrong im trying to learn this.

www.realtech.mine.nu

davidj
01-06-2008, 11:27 AM
its an & which is missing

what your saying is..

if ($var & $var2 & $var3)

////////////////////////////////////////////////
if ($var is set and $var2 is set and $var3 is set ){

do stuff here if the condition above is true

}
////////////////////////////////////////////////

also

this is wrong

require_once("../../../Documents and Settings/oskar/My Documents/Local root/Test/Connections/connection.php"); // database connection

it is absolute but it should be relative

Fronix
01-06-2008, 11:34 AM
"require_once("../../../Documents and Settings/oskar/My Documents/Local root/Test/Connections/connection.php"); // database connection
" that part is working its just that i have the connection.php in the local root folder and the otherstuff in the www folder in wamp.

But i still dont get shuld i just take away the "if ($submit ?? $data2 $data3 $data4)(" and replace it with "////////////////////////////////////////////////
if ($var is set and $var2 is set and $var3 is set ){

do stuff here if the condition above is true

}
////////////////////////////////////////////////" ??

davidj
01-06-2008, 11:42 AM
you need to understand what the code means

you cant just copy it as you see it.

what i showed you was pseudo code in a bid to explain what its about

what you need to do in your IF statement is this

if ($var && $var2 && $var3)

with $var being your variables

Fronix
01-06-2008, 11:46 AM
Maan im realy sorry let me explain some stuff before i ask.
Im from sweden so i dont get some of the english so good and im just 14 but i have this website that i want to have something cool on so i decided to check this place out. And the tut's are verry good :D

Now if u see my website i just want to be able to login to the forum via the frontpage so when u visit my page you just login via the frontpage and get redirected to the forum.

I dont realy wanna learn how to code i am a designer but no1 in any other forum wants to help me. //Fronix

davidj
01-06-2008, 03:37 PM
i cant help if your not into learning to code sorry

you cant be picky these days and i would recommend that you learn to code especially at your age. once you leave school you will be able to aim for more than just design jobs and even if you join a design house you will make yourself more valuable by having coding skills

Fronix
01-06-2008, 04:25 PM
It seems that this is wrong but i cant se whats wrong

$query = sprintf("INSTERT info realtech ($field2, $field3, $field4) values ('$data2, $data3, $data4')");
mysql_query[$query]or die(mysql_error()};