Jump to content


Photo

valadating database any idears please.


  • Please log in to reply
3 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 12 May 2006 - 08:14 PM

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


$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;
}

or




$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;
}
}


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 13 May 2006 - 07:51 AM

$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;
}

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:
$id = $_GET['id']
To help track down the problem you can add an "or die()" after the mysql_query call.
eg:
$result =  mysql_query($query) or die($query."<br />\n".mysql_error());
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.
error_reporting(E_ALL);
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.


#3 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 13 May 2006 - 07:57 AM

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.)

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 13 May 2006 - 08:36 PM

[!--quoteo(post=373457:date=May 13 2006, 07:57 AM:name=448191)--][div class=\'quotetop\']QUOTE(448191 @ May 13 2006, 07:57 AM) View Post[/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--]
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users