need help with "show if reigion"

Good day everyone,
I’m trying to make a thank you page with “show if” statement
my page has a link that I want to be visible only to the user that has just submitted a “contact us” form
I did read many articles about that in the last two day and i’m getting pretty furious. this what I have now- I know it’s WRONG but…- I hope some one can help:

<?php $ip = "SELECT * FROM displaytable where ip ='$hdw_IP'"; if ($ip == $ip) { echo Edit;

} else {
echo “Thank you”;

thanks in advance

Assuming you’re using MySQL database, try to modify your code like this:

<?php $r = mysql_query("SELECT * FROM displaytable where ip ='$hdw_IP'"); if(mysql_num_rows($r)){ $row_Recordset1 = mysql_fetch_array($r); $ip = $row_Recordset1['ip']; } else{ $ip = ''; } if ($ip == $_SERVER['REMOTE_ADDR']) { echo Edit;

} else {
echo “Thank you”;

php coder, thanks a lot for your quick reply, I tried the code but I got this error on the display page:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL
hope you can help, thanks

Probably there is no such table in your database. Did you create MySQL database and table named ‘displaytable’? Also make sure you have a field named ‘ip’ in this table.

hi, thanks for the reply
I do have “displaytable” table in my MySQL database, and "hdw_IP’ filed, should I change some thing in the code to be consistent with this field name? (i don’t want to change hdw_IP field name)

Thank you,

Yes, just change the ‘ip’ to ‘hdw_IP’ in the sql query. Also, make this change in every instance of: $row_Recordset1[‘ip’]

Sponsor our Newsletter | Privacy Policy | Terms of Service