Go Back   Dynamic Drive Forums > General Coding > PHP
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-29-2008, 01:45 AM
thehappyappy thehappyappy is offline
Junior Coders
 
Join Date: Sep 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Newbee needing help.....please

I've got an email link that I want to have a subject header, but I can't see to get it to work. I've got
Code:
print ("<p>"); 
PRINT "<b1>Username: </b1> "; 
print $row["usern"];
print ("<br>");  
PRINT "<b> Account number: </b> "; 
print $row["ID"]." ";
PRINT "<b> Password: </b> "; 
print $row["password"]." "; 
print "<a href='mailto:info@myemailaddy.com?subject=Reference:  .$row["usern"].'> Apply</a>" ;
but it just gives an error whenever I try to got to the page.
The error I get is
Quote:
Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/west/public_html/search.php on line 147
On a seperate page I'm trying to delete details from the database. I'm using
Code:
}$id = $_GET['ID'];
$ok1 = @mysql_query("DELETE FROM members WHERE " . "ID='$id'");
if ($ok1) {
echo '<p>member deleted successfully</p>';
} else {
echo '<p>Error.' . mysql_error() . '</p>';
to delete that particular field but it just says
Quote:
Parse error: syntax error, unexpected $end in /home/west/public_html/deletejob.php on line 30
but line 30 is empty. I think that 5'm getting the error because the previous page isn't sending the 'ID'. The previous page is
Code:
$result = mysql_query("SELECT * FROM users");
echo "<table width='100%' border='1'>
<tr>
<th>Account number</th>
<th>Username</th>
<th> Password </th>
<th>Email</th>
<th>Joined</th>
<th>Real Name</th>
<th></th>
</tr>";
while($row = mysql_fetch_array($result))
  {
   echo "<tr>";
$id = $users['ID'];
   echo "<td>" . $row['ID'] . "</td>";
  echo "<td>" . $row['usern'] . "</td>";
  echo "<td>" . $row['password'] . "</td>";
  echo "<td>" . $row['email'] . "</td>";
  echo "<td>" . $row['date'] . "</td>";
   echo "<td>" . $row['name'] . "</td>";
  echo "<td><a href='deleteuser.php?id=$id'>Delete user</a></td>";
  echo "</tr>";
  }
echo "</table>";
mysql_close($con);
Thanks
Reply With Quote
  #2  
Old 06-29-2008, 04:32 AM
thetestingsite's Avatar
thetestingsite thetestingsite is offline
The Guy That Moderates
 
Join Date: Sep 2006
Location: St. George, UT
Posts: 2,795
Thanks: 3
Thanked 156 Times in 154 Posts
Default

For one, where is $users being defined in which is in this line:

Code:
$id = $users['ID'];
#2: The following:
Code:
$ok1 = @mysql_query("DELETE FROM members WHERE " . "ID='$id'");
should be:
Code:
$ok1 = @mysql_query("DELETE FROM members WHERE `ID`='$id'");
and #3:

Code:
print "<a href='mailto:info@myemailaddy.com?subject=Reference:  .$row["usern"].'> Apply</a>" ;
should be:

Code:
print "<a href='mailto:info@myemailaddy.com?subject=Reference:  ".$row['usern']."'> Apply</a>" ;
Hope this helps.
__________________
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
The Testing Site | Atomic Yeti
Reply With Quote
  #3  
Old 06-29-2008, 12:40 PM
thehappyappy thehappyappy is offline
Junior Coders
 
Join Date: Sep 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for helping, I'm starting to understand it a bit more - albeit slowly
Quote:
Originally Posted by thetestingsite View Post
For one, where is $users being defined in which is in this line:

Code:
$id = $users['ID'];
I don't quite understand this bit - $users is the name of the the table (
$result = mysql_query("SELECT * FROM users"); ) Is that not right?

Quote:
#2: The following:
Code:
$ok1 = @mysql_query("DELETE FROM members WHERE " . "ID='$id'");
should be:
Code:
$ok1 = @mysql_query("DELETE FROM members WHERE `ID`='$id'");
I guess when I get the previous bit right this bit will work?

Quote:
and #3:

Code:
print "<a href='mailto:info@myemailaddy.com?subject=Reference:  .$row["usern"].'> Apply</a>" ;
should be:

Code:
print "<a href='mailto:info@myemailaddy.com?subject=Reference:  ".$row['usern']."'> Apply</a>" ;
Hope this helps.
The email subject now works - thanks

Last edited by thehappyappy; 06-29-2008 at 12:50 PM.
Reply With Quote
  #4  
Old 06-30-2008, 03:57 PM
thetestingsite's Avatar
thetestingsite thetestingsite is offline
The Guy That Moderates
 
Join Date: Sep 2006
Location: St. George, UT
Posts: 2,795
Thanks: 3
Thanked 156 Times in 154 Posts
Default

Sorry, didn't see you replied until just now. Anyways, I believe that if you change $users['ID'] to $row['ID'] all should be well. Let me know if you need anything else.

Hope this helps.
__________________
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
The Testing Site | Atomic Yeti
Reply With Quote
  #5  
Old 06-30-2008, 04:04 PM
thehappyappy thehappyappy is offline
Junior Coders
 
Join Date: Sep 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yep you're right. Thanks
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:56 PM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.