ok what is up with this

Discussion in 'PHP' started by mutley, Mar 20, 2008.

  1. #1
    ok i have been at my computer for a long time now and i can not see seem to work this out when i run my script i get this error

    this the code on line 53

    echo '<b>Name:</b> <a href="mailto"'.$email.'">.'$name.'</a>';
    	}
    Code (markup):
    and here is the next few lines of the code

    <tr>
    	<td width="50%"bgcolor#EEEEE>';
    	if ($email_len >0)
    	{
    	echo '<b>Name:</b> <a href="mailto"'.$email.'">.'$name.'</a>';
    	}
       else
    	{
    	echo  '<b>Name:</b> '.$name;
    	}
    	echo'
    	<br>
    	<b>Comment:</b> ' .$Comment. '
    	<td>
    	<td width="1%" valign="top" nowwrap bgcolor="#EEEEE">
    	<b>Date:</b> ' . $date_show . '	
    	</td>
    	</tr>
    Code (markup):
    Thank you for your help
     
    mutley, Mar 20, 2008 IP
  2. turulojko

    turulojko Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try this:

    echo "<b>Name:</b> <a href=\"mailto:$email\">$name</a>";
    PHP:
    or like your code, but the dot on right place:

    echo '<b>Name:</b> <a href="mailto"'.$email.'">'[COLOR="Red"][B].[/B][/COLOR]$name.'</a><br>';
    Code (markup):
    ;)
     
    turulojko, Mar 20, 2008 IP
  3. mutley

    mutley Peon

    Messages:
    356
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ok now i am getting even more mess ups

    so here is my code

    thank you for your help

    <?php
    require("inc/db.php");
    if(isset($_POST['txt_name'])) { //Check if the user has actually sent the form yet
    $connection= mysql_connect($db_host,$db_user,$db_password,$db_name) or die ("Connection failed: " . mysql_error());
    $db = mysql_select_db($db_name,$connection) or die ("Database select failed: " . mysql_error());
    $name = $_POST['txt_name'];
    $len = strlen($name);
    if ($len > 0)	
    {
    	$email = $_POST['txt_email'];
    	$comment = $_POST['txt_comment']; 
    	$date = time();
    	$query = "INSERT INTO guestbook[autoID,name,email,comment,date_auto]" .		
    		"Values[NULL,'$name','$email','$comment','$date']";
    	mysql_query($query,$connection) or die(mysql_error());	
    }
    } else {
    	//no comment has been submitted
    }
    ?>
    <html>
    <head>
    <title>book</title>
    <head>
    <body>
    <center>
    <form action="<?php echo $_SEVER[PHP_SELF]; ?> "medthod="POST">
    <!-- Don't use FONT tags, they don't exist any more -->
    <span style="font-family: sans-serif; font-size: 1em;">
    Name: <input type="text" name="txt_name"> <!-- fixed missing quote -->
    Email:<input type="text" name"txt_email"> <br><br>
    Comment:<br>
    <textarea style="width 75%" row="10" name="txt_comment"></textarea> <!-- fixed missing quote -->
    <center><input type="submit" value="submit"></center>
    </span>
    </form>
    <table bgcolor"#AAAAA" boder="0" width"="755%"cellspacing"1"cellpading"2">
    <?php
    $result=myql_query($query,$comment);
    for ($i=0; $i < mysql_num_rows($result);$i++);//here
    {
    	$name=mysql_result($result,$i,"name");
    	$email=mysql_result($result,$i,"email");
    	$email_lem= strlen($email);
    	$comment=mysql_result($result,$i,"comment");
    	$date=mysql_result($result,$i,"date");
    	$show_date= date("H:i:s d/m/y",$date_auto);
    	echo '
    	<tr>
    	<td width="50%"bgcolor#EEEEE>';
    	if ($email_len >0)
    	{
    	echo '<b>Name:</b> <a href="mailto"'.$email.'">".'$name.'</a>';
    	}
       else
    	{
    	echo  '<b>Name:</b> '.$name;
    	}
    	echo'
    	<br>
    	<b>Comment:</b> ' .$Comment. '
    	<td>
    	<td width="1%" valign="top" nowwrap bgcolor="#EEEEE">
    	<b>Date:</b> ' . $date_show . '	
    	</td>
    	</tr>
    
    }	
    	
    ?>
    </table>
    </center>
    </body>
    </html>
    
    Code (markup):
     
    mutley, Mar 20, 2008 IP
  4. turulojko

    turulojko Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ok i correct your code, try:

    <?php
    require("inc/db.php");
    if(isset($_POST['txt_name'])) { //Check if the user has actually sent the form yet
    $connection= mysql_connect($db_host,$db_user,$db_password,$db_name) or die ("Connection failed: " . mysql_error());
    $db = mysql_select_db($db_name,$connection) or die ("Database select failed: " . mysql_error());
    $name = $_POST['txt_name'];
    $len = strlen($name);
    if ($len > 0)	
    {
    	$email = $_POST['txt_email'];
    	$comment = $_POST['txt_comment']; 
    	$date = time();
    	$query = "INSERT INTO guestbook[autoID,name,email,comment,date_auto]" .		
    		"Values[NULL,'$name','$email','$comment','$date']";
    	mysql_query($query,$connection) or die(mysql_error());	
    }
    } else {
    	//no comment has been submitted
    }
    ?>
    <html>
    <head>
    <title>book</title>
    <head>
    <body>
    <center>
    <form action="<?php echo $_SEVER[PHP_SELF]; ?>" medthod="POST">
    <!-- Don't use FONT tags, they don't exist any more -->
    <span style="font-family: sans-serif; font-size: 1em;">
    Name: <input type="text" name="txt_name"> <!-- fixed missing quote -->
    Email: <input type="text" name="txt_email"> <br><br>
    Comment:<br>
    <textarea style="width 75%" rows="10" name="txt_comment"></textarea> <!-- fixed missing quote -->
    <center><input type="submit" value="submit"></center>
    </span>
    </form>
    <table bgcolor="#AAAAA" border="0" width="755%" cellspacing="1" cellpadding="2">
    <?php
    $result=myql_query($query,$comment);
    for ($i=0; $i < mysql_num_rows($result);$i++);//here
    {
    	$name=mysql_result($result,$i,"name");
    	$email=mysql_result($result,$i,"email");
    	$email_lem= strlen($email);
    	$comment=mysql_result($result,$i,"comment");
    	$date=mysql_result($result,$i,"date");
    	$show_date= date("H:i:s d/m/y",$date_auto);
    	echo '
    	<tr>
    	<td width="50%" bgcolor="#EEEEE">';
    	if ($email_len >0)
    	{
    	echo '<b>Name:</b> <a href="mailto"'.$email.'">"'.$name.'</a>';
    	}
       else
    	{
    	echo  '<b>Name:</b> '.$name;
    	}
    	echo '
    	<br>
    	<b>Comment:</b> ' .$Comment. '
    	<td>
    	<td width="1%" valign="top" nowrap="nowrap" bgcolor="#EEEEE">
    	<b>Date:</b> ' . $date_show . '	
    	</td>
    	</tr>';
    
    }	
    	
    ?>
    </table>
    </center>
    </body>
    </html>
    Code (markup):
     
    turulojko, Mar 20, 2008 IP
  5. mutley

    mutley Peon

    Messages:
    356
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    man i really was having a bad day


    i think i may have to re write all of the script lol :eek::eek::eek:
     
    mutley, Mar 20, 2008 IP
  6. turulojko

    turulojko Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I've changed the code, try it again.
     
    turulojko, Mar 20, 2008 IP
  7. mutley

    mutley Peon

    Messages:
    356
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ok great thank you turulojko the php works could you drop me a pm with what you change in comments so i now what i did wrong

    i just got to work out the problem with mysql now lol :p


    cheers

    again thank you for your help one day i hope i can help you too
     
    mutley, Mar 20, 2008 IP