Jump to content

euel

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

Contact Methods

  • Yahoo
    euel_15

euel's Achievements

Member

Member (2/5)

0

Reputation

  1. I see... Can you direct me to somewhere i can get more info ? Thanks for the reply!
  2. Good Day! I'm trying to rework a page in my site and its seems i got stuck. I have a page with a generated table where each row has 2 select tags. I want to put a checkbox/radio button at the end of each row so the user can select all the data before submitting the form for processing. The problem is can't think of the code how to select all the data when a checkbox/radio button is checked. Sorry if my explantion is unclear, im confused ryt now... Thanks for the help!
  3. ah, now it make sense to me.. thank you for pointing that simple thing to me! really appreciated.. tried it and worked.. now i just need to get what values goes to where.. >.< Thanks!!
  4. Hi guys! I need your help.. I'm having a problem in getting the post values from my form, I have 2 arrays and some values: $total = 3; $array1 = (branch1, branch2, branch3); $array2 = (100, 200, 300); $count = count($array1) - $total; then i combine them $array3 = combine_array($array1, $array2); if $count is 0, using a foreach loop i echo each value and key foreach($combined_array as $value => $key) { echo "<tr>"; echo "<td><input type='hidden' name='branch' value='{$value}'></td>"; echo "<td id='edit'>" . "<input type='submit' name='edit' value='' />" . "</td>"; echo "<td id='sep'> / </td>"; echo "<td><input type='hidden' name='id' value='{$key}'></td>"; echo "<td id='del'>" . "<input type='submit' name='delete' value='' />" . "</td>"; very simple and it works perfectly fine, but if the variable $count is not equal to 0, i append both arrays(1 & 2) so that it will be equal to 0. (data appended is not important i just need them for the table output.) for($i = 0; $i < $count; $i++) { $array1[] = "null" . $i; $array2[] = $i; } // then combine $array3 = combine_array($array1, $array2); // echo each value and key foreach($combined_array as $value => $key) { echo "<tr>"; echo "<td><input type='hidden' name='branch' value='{$value}'></td>"; echo "<td id='edit'>" . "<input type='submit' name='edit' value='' />" . "</td>"; echo "<td id='sep'> / </td>"; echo "<td><input type='hidden' name='id' value='{$key}'></td>"; echo "<td id='del'>" . "<input type='submit' name='delete' value='' />" . "</td>"; echo "</tr>"; i tried to view the code souce and both hidden fields contain correct data but if i tried to delete/edit it doesn't work. i tried echoing/print_r the $_POST['branch'] & $_POST['id'] after i click on delete/edit and it always gives me the last $value and $key of the combined array for all the submit buttons.. Any thoughts? As i said the appended data is not important but the problem is once i click delete the original values in array1 and 2 are not what post is giving me..therefore i cannot delete or edit them.. Sorry if my post is too long.. Thanks in advance!
  5. missing a stupid space in my query $query = "SELECT username, hashed_password"; should be $query = "SELECT username, hashed_password "; [code]
  6. Because I'm referring to my db $connection which is located somewhere else.. since it does not change.. making it global makes it available if needed it while not repeating my self over and over again.. Anyways back to my problem, i think i do not need to that since it has mysql_error() already in it and it does report about an error on this line : $query .= "WHERE username = '$username' "; $query .= "AND hashed_password = '$password' "; $query .= " LIMIT 1"; the problem is i dunno what's wrong since like i have told from my 1st post that i have a same script for my email checking which works perfectly and it's this: function check_if_email_exist($email) { global $connection; $query = "SELECT email "; $query .= "FROM users "; $query .= "WHERE email = '$email' "; $query .= " LIMIT 1"; $result_set = mysql_query($query, $connection); confirm_query($result_set); if(mysql_num_rows($result_set) == 1) { return true; } else { return false; } }
  7. Gud pm!! So i made this script to check if a username and password exist but it kinda fails me. It gives me a database connection error from my confirm_query() which means it returned false? so here's my code: function check_if_exist($username, $password) { global $connection; $query = "SELECT username, hashed_password"; $query .= "FROM users "; $query .= "WHERE username = '$username' "; $query .= "AND hashed_password = '$password' "; $query .= " LIMIT 1"; $result_set = mysql_query($query, $connection); confirm_query($result_set); if(mysql_num_rows($result_set) == 1) { return true; } else { return false; } } my confirm_query(): function confirm_query($result) { if(!$result) { die("Database connection failure ". mysql_error()); } } I have a another script to check if the email exist and it works perfectly, i dunno why this won't work properly.. :-\ maybe another simple mistake.. Any ideas or Violent reaction? Thanks!
  8. @kamal213 i didnt notice your replies since i marked it solved.. if you still have a problem with echoing this: echo $aDays; since its an array, you should do it like this: print_r($aDays);
  9. eeeee... your right! im sooo mixed up.. didn't realize it was inside my loop... sorry for bothering you guys, 2hrs of sleep <---- i blame you!!!
  10. Thanks for the reply!! Like Muddy Fuster said, that is what i want.. i nid to save $events['event_location'] to $check_location everytime it loops, so if it's the same content it wont repeat it. Sorry if i didnt made it clear.. So.. how can i fix this? Thanks again!
  11. Thanks for the reply! you mean this --> "before the loop is finished, $check_location must store a new events['location']..." ? i just made a typo sorry it should be --> "before the loop is finished, $check_location must store a new events['event_location']..." Actually if i change : $check_location = ""; to a known value that $events['event_location'] have, like this : $check_location = "Theater Area"; it actually works.. i think its not passing the new $check_location properly when the loop finishes ( according to me ).. Any ideas?
  12. Gud pm! I need some help guys! I made this simple code to compare $check_location to $events['location'] every loop so if they are equal it should not echo what's inside the if statement.. Here's my code: $events_set = select_all_events($mall_id, $month, $year, $public); while($events = mysql_fetch_array($events_set)) { $check_location = ""; if($check_location != trim($events['event_location'])) { $check_location = trim($events['event_location']); echo "<tr>"; echo "<td colspan=7 id='header'>"; echo "<br />"; echo $events['event_location']; echo "</td>"; echo "</tr>"; } before the loop is finished, $check_location must store a new events['location']... I know the problem is kinda simple but the comparison can't seem to work.. Thanks in advance!
  13. Right on the spot Muddy_Funster! Thanks!! That's why i don't like putting white space in my db but my boss insist it should be like that, oh well.. Thanks again everyone!! Is there a button for 2ble solved? lol!
  14. Holy Mother of Christ! it seems i solved my stupid problem after a short sleep.. i was editing the wrong php file while looking for changes on the wrong php page.... soo lame.. Anyways just for the record, i tried your code harrisweed and it works perfectly! thanks! Can i ask another help? its kinda related to this..or will i put it in another topic? Anyways here it is: I have a user table with a field name of branch where it contains a string like this - > car1 - branch1, car2 - branch2, car3 - branch3... I need to make it an array so i can separate each (car - branch) so i did this code: function display_user_branches($user_id, $branch = NULL) { $branches = get_all_branch($user_id); $all_branches = mysql_fetch_array($branches); $split_branches = preg_split("/,/", $all_branches['brand'], -1, PREG_SPLIT_NO_EMPTY); foreach($split_branches as $value) { echo "<option value='{$value}' "; if($value == $branch) { echo " selected"; } echo ">$value</option>"; } } and is being called by this: echo "<td>"; echo "<select name='branch' >"; display_user_branches($reserved['users_id'], $reserved['branch']); echo "</select>"; echo "</td>"; everything works fine, it displays all car - branch in each option except for the comparison to make it selected. Can't seem to figure out what's wrong.. Again $value and $branch has a format of Car - Branch like my first solved problem.. Maybe i messed up some simple thingy.. Any advice? Thanks in advance!!!!
  15. Thanks harristweed ! Ill try that as early as i can tomorrow! @Muddy_Funster Come to think of it.. it may probably the answer.. really don't know cuz i cant check it right now, gonna reply as soon i can test everything out! Thanks for the replies guys!
×
×
  • 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.