Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. Your connection to the database isn't working...double check you information.
  2. Try changing this: If (mysql_affected_rows() == 0) { To if (mysql_num_rows($resultresult) < 1) {
  3. Oops, I edited mine to work on submit. I do like the way MadTechie did his update query though, I never knew you could do it like that.
  4. Yes you can. Something like this <?php if (isset($_POST['submit'])) { //define all your post variables here $city1 = mysql_real_escape_string($_POST['city1']); $rank1 = mysql_real_escape_string($_POST['rank1']); $query = "UPDATE table SET city1='$city1', rank1='$rank1' WHERE {condition}"; $result = mysql_query($query)or die(mysql_error()); echo "Successfully Updated"; } else { require_once('connect.php'); require_once('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM zipcodes WHERE search_id='$zip_id'"; $result = @mysql_query($query); $count = mysql_num_rows($result); //number of results while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { // Database Values $groupid_sent= $row['account_name'] ; $account_name= $row['company_name'] ; $zip_id = $row['search_id'] ; $zipcode = $row['zipcode']; $city = $row['city']; $rank = $row['rank']; $redirect_url = $row['redirect_url']; $notes_1 = $row['notes_1']; $phone_number = $row['phone_number']; $groupe_name = $row['groupe_name']; $on_off = $row['on_off']; $test_zip = $row['test_zip']; echo "Edit Zip Code <b>$zipcode</b> for $account_name"; echo "<form action='{$_SERVER['PHP_SELF']}' method='post'>"; echo "Company Name: <input type=text name=company_name1 size=75 value='$account_name' > <br>"; echo "Zipcode: <input type=text name=zipcode1 value='$zipcode' > <br>"; echo "City: <input type=text name=city1 size=50 value='$city' ><br>"; echo "Rank: <input type=text name=rank1 value='$rank' ><br>"; echo "Redirect URL: <input type=text name=redirecturl1 size=75 value='$redirect_url' > <br>"; echo "Notes: <input type=text name=notes1 value='$notes_1' ><br>"; echo "Phone Number: <input type=text name=phonenumber1 value='$phone_number' ><br>"; echo "Group Name: <input type=text name=groupname1 value='$groupe_name' ><br>"; echo "On / Off: <input type=text name=onoff1 value='$on_off' ><br>"; echo "Test Zip: <input type=text name=testzip1 value='$test_zip' ><p>"; echo "<input type=submit name=submit value=update>"; echo "</form>"; } } ?>
  5. I don't understand. You did a query, then used a while loop with that query, but your not even using that query within the while loop...that doesn't make sense to me. If your only expecting one result, then there is no need for a loop. <?php require_once('../Connections/connectionpage.php'); mysql_select_db($database, $db) or die(mysql_error()); $Booth_Num = $_GET['WLE_booth']; $Company_Nam = $_GET['Company']; $Booth_Num = mysql_real_escape_string($Booth_Num); $Company_Nam = mysql_real_escape_string($Company_Nam); $query = "SELECT * FROM tablename WHERE WLE_booth = '$Booth_Num'"; $qry_result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($qry_result); $display_string = "<table>"; $display_string .= "<tr>"; $display_string .= "<th>Booth</th>"; $display_string .= "<th>Company</th>"; $display_string .= "</tr>"; $display_string .= "<tr>"; $display_string .= "<td>{$row['booth_num']}</td>"; $display_string .= "<td>{$row['company_nam']}</td>"; $display_string .= "</tr>"; $display_string .= "</table>"; echo $display_string; ?> Obviously you will need to fill in your own column name values from your database on the two variables I used. I'm not sure if this is what your looking for, but you can give it a try.
  6. To see whats in the array, just do print_r($sub_categories); After that...your going to have to explain what your wanting to do. Your either going to need to pick which value in the array you want, or you are going to want to loop through each one of them with your query.
  7. Maybe instead of passing it through the URL you could use a session instead.
  8. Take a look at this post http://www.phpfreaks.com/forums/index.php/topic,95426.0.html
  9. Try this <?php $sub_categories = $info->getSubCategories($categories[$i][id]); $sub_categories = mysql_real_escape_string($sub_categories); $res = sprintf("SELECT * FROM `ad` WHERE `sub_category_id` = .$sub_categories"); $result = mysql_query($res); ?> If that doesn't work, echo $sub_categories out and tell us what it displays.
  10. Change this line: $result = mysql_query($res); To $result = mysql_query($res)or die(mysql_error()); Tell us what you get as an error.
  11. It all works for me as well...I have no idea why it won't for you.
  12. This is crazy, it's like every time someone posts, some of the other ones disappear. Hopefully it's only this topic...
  13. It's probably because you don't have the last line at the very left of your text editor. <?php print<<<HERE blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah HERE; //<---This line has to be all the way to the left ?>
  14. I never saw it...maybe you accidentally posted it on a different topic?
  15. <?php $sub_categories = $info->getSubCategories($categories[$i][id]); $res = sprintf("SELECT * FROM `ad` WHERE `sub_category_id` = .$sub_categories"); $result = mysql_query($res)or die(mysql_error()); $count = mysql_num_rows($result); ?>
  16. If you need to print a large chunk of HTML that has bits of PHP in it, use the example I gave you in my first post.
  17. Yes, because you have PHP below it...so it won't be executed.
  18. Echo $ip out and see what it gives you, just to make sure you are using the right one.
  19. Sorry, I kept that in there for testing it. Use $_SERVER['REMOTE_ADDR'] edit - What isn't working about it?
  20. EDIT - Thorpe beat me to it. The quoted loop seems unnecessary. Why not just do this? <?php if(in_array($ip, $lines) ?> Your right! Sorry about that. <?php $ips = file('ips.txt'); $ip = "55.55.555.5"; if (in_array($ip, $ips)){ echo "You are banned!"; } else { echo 'Not Banned'; } ?> I just tested that code with multiple lines in the text file, it worked just fine. Edit - Thorpe beat me to it.
  21. I just tested it, works perfectly. <?php $lines = file('ips.txt'); foreach ($lines as $line) { $ips[] = $line; } $ip = "55.55.555.5"; if (in_array($ip, $ips)){ echo "You are banned!"; } else { echo "You are not banned."; } ?> I put an else statement in there to help you out.
  22. Instead of us having to download and unzip a zip file, could you just post the relevant code?
  23. Why not just do this? Your text file 77.77.777.7 99.99.999.9 55.55.555.5 <?php $lines = file('ips.txt'); foreach ($lines as $line) { $ips[] = $line; } $ip = "55.55.555.5"; if (in_array($ip, $ips)){ echo "You are banned!"; } ?>
×
×
  • 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.