/    Sign up×
Community /Pin to ProfileBookmark

Resource id #9

Alright, when I try putting in a valid user, it doesn’t pop up the user name, but instead pops up “Resource id #9”.

Are you sure you want to delete user Resource id #9? — is the line it gives me.

This isn’t the ninth user in the table, I don’t even have nine users.

Thanks in advance everyone.

[code=php]
<?php
include(‘header.php’);
if($username!=NULL)
{
if(!isset($_POST[‘submit’]))
{?>
<table>
<form action=”” method=”post”>
<tr>
<td>Username: <input type=”text” name=”username”></td>
</tr>
<tr>
<td><input type=”submit” value=”submit” name=”submit”></td>
</tr>
</form>
</table>
<? }
else{
$sqlDel=”select * from `user` where `name` = ‘” . $_POST[‘username’] . “‘”;
$results=mysql_query($sqlDel);
echo “Are you sure you want to delete user “, $results, “?”;
}
}
include(‘footer.php’);
?>
[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@chazzyNov 09.2005 — [code=php]
<?php
include('header.php');
if($username!=NULL)
{
if(!isset($_POST['submit']))
{?>
<table>
<form action="" method="post">
<tr>
<td>Username: <input type="text" name="username"></td>
</tr>
<tr>
<td><input type="submit" value="submit" name="submit"></td>
</tr>
</form>
</table>
<? }
else{
$sqlDel="select * from user where name = '" . $_POST['username'] . "'";
$results=mysql_query($sqlDel);
echo "Are you sure you want to delete user ", $_POST['username'], "?";
}
}
include('footer.php');
?>
[/code]


is the correct method. $results is a result set, not an item.
Copy linkTweet thisAlerts:
@bokehNov 09.2005 — This is how you can see the query result:[code=php]$sqlDel = "select * from user where name = '" . $_POST['username'] . "'";
$result = mysql_query($sqlDel);
$user_array = mysql_fetch_array($result);
foreach($user_array as $k => $v){
print '$user_array["'.$k.'"] = "'.$v.'"<br>';
}[/code]
×

Success!

Help @R_Noon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...