Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
I'm a newbee having a few problems
Old 06-28-2008, 09:40 PM I'm a newbee having a few problems
Skilled Talker

Posts: 60
Trades: 0
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
thehappyappy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-28-2008, 11:13 PM Re: I'm a newbee having a few problems
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
Replace:

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

with:

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

And on the delete block, use a closing } at the end.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 06-29-2008, 08:28 AM Re: I'm a newbee having a few problems
Skilled Talker

Posts: 60
Trades: 0
Quote:
Originally Posted by mgraphic View Post
Replace:

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

with:

print '<a href="mailto:info@myemailaddy.com?subject=Referenc e: ' . $row['usern'] . '">Apply</a>';
Brilliant thanks, that now works

Quote:
And on the delete block, use a closing } at the end.
Also I added the closing } and I no longer get the error, but it's still not sending the ID.
The code that is supost to send the ID is
PHP 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); 
I think that for both problems I just need to get it to send the information to the next page/email but I don't seem to be able to get that right.

Last edited by thehappyappy; 06-29-2008 at 08:47 AM..
thehappyappy is offline
Reply With Quote
View Public Profile
 
Old 06-29-2008, 01:11 PM Re: I'm a newbee having a few problems
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
instead of using $users[ID], use:

$id = $row['ID'];
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 06-29-2008, 07:43 PM Re: I'm a newbee having a few problems
Skilled Talker

Posts: 60
Trades: 0
Quote:
Originally Posted by mgraphic View Post
instead of using $users[ID], use:

$id = $row['ID'];
Okay, it's now sending the ID to the next page. but it's still not deleting the entry from the database, although it is saying
Quote:
member deleted successfully
The code I've got to do that is:
PHP Code:
if (!@mysql_select_db("west_db")) {
exit(
'<p>Unable to connect to database.</p>');
}
$id intval($_GET['ID']);
$ok1 mysql_query("DELETE FROM members WHERE ID =$id") or die(mysql_error());
if (
$ok1) {
echo 
'<p>member deleted successfully</p>';
} else {
echo 
'<p>Error.' mysql_error() . '</p>';
}
?> 
thehappyappy is offline
Reply With Quote
View Public Profile
 
Old 06-29-2008, 07:51 PM Re: I'm a newbee having a few problems
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
URL GET parameters are case sensitive, and since you are passing the parameter ?id=1 (for example), you will need to reflect that in your code. Calling intval($_GET['ID']) will return a zero integer.

$id = intval($_GET['id']);
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 06-29-2008, 07:56 PM Re: I'm a newbee having a few problems
Skilled Talker

Posts: 60
Trades: 0
Thank you so much for your help. It now works perfectly.
thehappyappy is offline
Reply With Quote
View Public Profile
 
Old 07-01-2008, 12:26 AM Re: I'm a newbee having a few problems
Novice Talker

Posts: 10
Trades: 0
You forgot to scape the " in the $row['usern']


Quote:
$var = $row['usern'];
print "<a href='mailto:info@myemailaddy.com?subject=Referenc e: $var'> Apply</a>" ;
__________________
Dream to be alive!

Please login or register to view this content. Registration is FREE

&
Please login or register to view this content. Registration is FREE
apolo13 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I'm a newbee having a few problems
 

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.85852 seconds with 12 queries