Jump to content

Archived

This topic is now archived and is closed to further replies.

redarrow

valadating database any idears please.

Recommended Posts

why does this not work nothink happens any idears please cheers.

[code]

$query="select * from members_picture_uploads where id='$id'";
echo $query;
$result=mysql_query($query);

if(!mysql_num_rows($result)==1) {

echo"sorry only 1 picture per profile please use your update picture link on you members page";
exit;
}
[/code]

or

[code]



$query="select * from members_picture_uploads where id='$id'";
echo $query;
$result=mysql_query($query);
while($row=mysql_fetch_assoc($result) {

if(!$row["userfile_name"]==1) {


echo"sorry only 1 picture per profile please use your update picture link on you members page";
exit;
}
}

[/code]

Share this post


Link to post
Share on other sites
[quote]
[code]
$query="select * from members_picture_uploads where id='$id'";
echo $query;
$result=mysql_query($query);

if(!mysql_num_rows($result)==1) {

echo"sorry only 1 picture per profile please use your update picture link on you members page";
exit;
}
[/code]
[/quote]
If [a href=\"http://www.php.net/manual/en/ini.core.php#ini.register-globals\" target=\"_blank\"]register_globals[/a] is not on and you haven't assigned a value to $id using $_GET['id'] or $_POST['id'] etc, then you'll have to do that.
eg:
[code]
$id = $_GET['id']
[/code]
To help track down the problem you can add an "or die()" after the mysql_query call.
eg:
[code]
$result =  mysql_query($query) or die($query."<br />\n".mysql_error());
[/code]
If an error is displayed and your not able to figure out the problem, then post it here.

Also add the following to the top of your script(s) if you haven't done so already.
[code]
error_reporting(E_ALL);
[/code]
You'll see NOTICE errors that aren't usually displayed by default. They tend to help find problems that might otherwise be difficult to find.

Share this post


Link to post
Share on other sites
Seems to me, looking at your script, nothing is SUPPOSED to happen.

Only if !mysql_num_rows($result)==1 something extra gets echoed. (Besides the query, which I assume IS being echoed.)

Share this post


Link to post
Share on other sites
[!--quoteo(post=373457:date=May 13 2006, 07:57 AM:name=448191)--][div class=\'quotetop\']QUOTE(448191 @ May 13 2006, 07:57 AM) [snapback]373457[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Seems to me, looking at your script, nothing is SUPPOSED to happen.

Only if !mysql_num_rows($result)==1 something extra gets echoed. (Besides the query, which I assume IS being echoed.)
[/quote]


[!--sizeo:5--][span style=\"font-size:18pt;line-height:100%\"][!--/sizeo--]solved[!--sizec--][/span][!--/sizec--]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.