Jump to content

Recommended Posts

you would check it the same way as you check if anything else is in your table.

 

select column from table where column = 'somevalue'

...

if (mysql_num_rows > 0) {

  // something was returned, do something

}

 

edit: that's obviously pseudo-code.

Would this be correct?

 

<?php
$ipchecker = $_SERVER['REMOTE_ADDR'];
mysql_query("select iptable from ipcheck where iptable = '$ipchecker'");
if (mysql_num_rows > 0) {
?>

<form id="form1" method="post" action="redirect.php">
<textarea name="question" cols="52" rows="8"></textarea><br />
<input name="firstname" type="text" /><br />
<input name="email" type="text" /><br />
<input name="submit" type="submit" />
</form>
<?php  
}
else {
?>
       <script type="text/javascript" src="http://forms.aweber.com/form/40/1675361340.js"></script>
       
       <?php } ?>

 

I added my IP manualy to test it out and it goes to the else statement no matter what.

no...i told you, that was pseudo code.  You need to assign the mysql_query to a variable and use that variable as argument in mysql_num_rows.

 

 

mysql_query

mysql_num_rows

 

You mean like this:

<?php

 

$ipchecker = $_SERVER['REMOTE_ADDR'];
$ipsql = mysql_query("select iptable from ipcheck where iptable = '$ipchecker'");
$row_number = mysql_num_rows($ipsql);

if ($row_number > 0) {
?>

<form id="form1" method="post" action="redirect.php">
<textarea name="question" cols="52" rows="8"></textarea><br />
<input name="firstname" type="text" /><br />
<input name="email" type="text" /><br />
<input name="submit" type="submit" />
</form>
<?php  
}
else {
?>
       <script type="text/javascript" src="http://forms.aweber.com/form/40/1675361340.js"></script>
       
       <?php } ?>

 

That doesn't work either...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.