Jump to content

ebolt007

Members
  • Posts

    119
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

ebolt007's Achievements

Member

Member (2/5)

0

Reputation

  1. Awesome thanks! And yes I know it's not always ideal and never should be used for beginers to keep an array inside a column but in a very complex program sometimes it's a necassary evil to do for organization.
  2. Naw, I have a ton of other tables for things like that, there has to be a way to pull an array out this way. Anyone with any ideas? I know how to easily pull it by grabbing it, exploding it by the , and using a foreach. I also put them in other tables with these id's, but for commenting and other purposes to keep them together I have to do it this way for this table. It's as easy as this to grab them, but what about searching right inside the query? $uploads= $true_row['photos']; $s = explode(",", $uploads); foreach($s as $a) { echo "$s"; }
  3. I have a query where I need to select an ID from a row where a column has an array. for instance I have ID Name photos 1 My Name 300,302,303, 2 2nd Name 304,405,309, How would I grab the ID where the "photos" contains 405,? But it can't select where it contains 1405 or 4054, or anything like that so I can't use LIKE %405% to select this. $sql = "SELECT ID FROM user_images WHERE photos LIKE '%405%'"; $sql_query = mysql_query($sql); $true_row = mysql_fetch_assoc($sql_query);
  4. Ok, so I have a nother JOIN question, still trying to grasp it and the parenthases, the explanations I always get are so short. So here's my question, I have 2 databases again, Users_Friends and Users_Online inside these I need to match up the ID's in UserID and FriendID inside Users_Friends and get the other ID from those, then I need to Check to make sure the Level in that is '1' and not '0' and then Check in the Users_Online that OnlineStatus for these UID's matching with the ID's I pulled from the Users_Friends is '1' and not '0' Below is what I have, and I can get all of the friends ID's correct, but can't get it to give me the OnlineStatus, I always get my OnlineStatus for each friend so it's like everyones always online. How do I get the OnlineStatus from the ID's that aren't mine from Users_Friends? SELECT f.FriendID, f.UserID, f.FriendIDMAIN, f.DateRequested, o.OnlineStatus FROM Users_Friends f INNER JOIN Users_Online o ON f.FriendID = o.UserID WHERE o.OnlineStatus = '1' AND f.FriendID = '$user_ID' AND f.Level = '1' UNION SELECT f.FriendID, f.UserID, f.FriendIDMAIN, f.DateRequested, o.OnlineStatus FROM Users_Friends f INNER JOIN Users_Online o ON f.UserID = o.UserID WHERE o.OnlineStatus = '1' AND f.UserID = '$user_ID' AND f.Level = '1' ORDER BY FriendIDMAIN ASC
  5. Even doing like below gives me 2 returns, with no AND's OR's just querying the "message msg_id" So I don't think it's parenthasis. SELECT m.msg_id, m.uid_fk, m.message, m.ToID, m.created, m.uploads FROM messages m LEFT JOIN Users_WallPosts_Hide w ON m.msg_id = w.PostID JOIN Users_Friends f ON m.uid_fk = f.FriendID JOIN Users_Friends j ON m.uid_fk = j.UserID WHERE m.uid_fk='$uid' ORDER BY m.msg_id DESC limit
  6. I still don't get it. I've tried every parenthesis logic possible and still always get 2 returns.
  7. Hmmm, can you elaborate on that a bit? I tried the below with parentheses and missing single quotes on the LEVEL=1 and get the same results. The 2nd one gives me 2 returns, the first one gives me 4 returns on each query. 4returns: SELECT m.msg_id, m.uid_fk, m.message, m.ToID, m.created, m.uploads FROM messages m LEFT JOIN Users_WallPosts_Hide w ON m.msg_id = w.PostID JOIN Users_Friends f ON m.uid_fk = f.FriendID JOIN Users_Friends j ON m.uid_fk = j.UserID WHERE ((w.Hidden IS NULL AND f.Level = '1' AND m.uid_fk='$uid') OR (w.Hidden IS NULL AND j.Level = '1' AND m.uid_fk='$uid')) ORDER BY m.msg_id DESC limit 10 2 returns: SELECT m.msg_id, m.uid_fk, m.message, m.ToID, m.created, m.uploads FROM messages m LEFT JOIN Users_WallPosts_Hide w ON m.msg_id = w.PostID JOIN Users_Friends f ON m.uid_fk = f.FriendID WHERE (w.Hidden IS NULL AND f.Level = '1' AND m.uid_fk='$uid') ORDER BY m.msg_id DESC limit 10
  8. Nope, unfortunately that didn't do the trick either, it didn't display anything until I modified it a bit like below, I had to use the INNER JOIN for the User_WallPosts_Hide part and then also had to ad the Friend part with UserID because it has to look at 2 different ID to see if Friends are Level 1 (UserID and FriendID) This made it display it 6 times tho per message, and I have 2 messages in the hidden part, and when I take out the FriendID part then it displays 4 of them, so it's still doubling up, but doubling up everything now. Below is what I have. SELECT m.msg_id, m.uid_fk, m.message, m.ToID, m.created, m.uploads FROM messages m LEFT JOIN Users_WallPosts_Hide w ON m.msg_id = w.PostID JOIN Users_Friends f ON m.uid_fk = f.FriendID JOIN Users_Friends j ON m.uid_fk = j.UserID WHERE w.Hidden IS NULL AND m.uid_fk='$uid' OR f.Level = 1 AND m.uid_fk='$uid' OR j.Level = 1 AND m.uid_fk='$uid' ORDER BY m.msg_id DESC limit 10
  9. That almost worked, but I am also doing to other Joins and using UNION to put them together, so now it is doubling up all of my messages that are coming in, altho it only shows one of the hidden ones, so it's hiding one, but I can't figure out why it's doubling up now that I have added it to my other query like below? Any ideas? $query = mysql_query(" SELECT messages.msg_id, messages.uid_fk, messages.message, messages.ToID, messages.created, messages.uploads FROM messages WHERE messages.uid_fk='$uid' UNION SELECT messages.msg_id, messages.uid_fk, messages.ToID, messages.message, messages.created, messages.uploads FROM messages INNER JOIN Users_Friends ON messages.uid_fk = Users_Friends.UserID WHERE Users_Friends.FriendID = '$uid' AND Users_Friends.Level = '1' UNION SELECT messages.msg_id, messages.uid_fk, messages.ToID, messages.message, messages.created, messages.uploads FROM messages INNER JOIN Users_Friends ON messages.uid_fk = Users_Friends.FriendID WHERE Users_Friends.UserID = '$uid' AND Users_Friends.Level = '1' UNION SELECT messages.msg_id, messages.uid_fk, messages.message, messages.created, messages.ToID, messages.uploads FROM messages LEFT JOIN Users_WallPosts_Hide ON messages.msg_id = Users_WallPosts_Hide.PostID AND Users_WallPosts_Hide.Hidden = '1' WHERE Users_WallPosts_Hide.PostID IS NULL order by msg_id ") or die(mysql_error());
  10. I think I need to use Join for this? I have 2 tables, where I have a bunch of messages, and basically on each message I have "hide" button that posts the UserID, PostID, and Hidden as 1 in another table. So my hidden table has 3 columns: UserID, PostID, Hidden My messages table has all that are shown below, but I need to get all the PostIDs from "messages" except the ones that have a "1" under Hidden in the Users_WallPosts_Hide table. I suck at Joins, and can't figure this. Any help would be appreciated. Thanks $query = mysql_query(" SELECT messages.msg_id, messages.uid_fk, messages.message, messages.ToID, messages.created, messages.uploads FROM messages INNER JOIN Users_WallPosts_Hide ON messages.msg_id = Users_WallPosts_Hide.PostID WHERE Users_WallPosts_Hide.Hidden = '1' order by msg_id desc") or die(mysql_error());
  11. I'm trying to make a form that has to carry the name address and all that to Paypal as well as some checkboxes that need to add themselves up if multiples are checked. But the Paypal form submit automatically goes to Paypal so the post doesn't post on my page to get the value if that makes any sence? Has anyone done anything like this? I'm trying to basically do. <FORM action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="myemail@email.com"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="return" value="http://backtomysite.com"> <table style="float:left; margin-bottom:10px;" width="700px"> <tr> <td>Name</td><td colspan="5"><input type="text" name="name" value="" size="40" /></td> </tr> <tr> <td>Address</td><td colspan="5"><input type="text" name="address1" value="" size="40" /></td> </tr> <tr> <td>City</td><td><input type="text" name="city" value="" size="20" /></td><td>State</td><td><input type="text" name="state" value="" size="4" /></td><td>Zip</td><td><input type="text" name="zip" value="" size="6" /></td> </tr> <tr> <td>Phone</td><td><input type="text" name="phone" value="" size="20" /></td> </tr> <tr> <td colspan="6">Professional: <input type="radio" name="item_name" value="Professional Package"> Non-Professional: <input type="radio" name="item_name" value="Non-Professional Package"></td> </tr> <tr> <td colspan="6"><b>REGISTRATION FEE:</b></td> </tr> <tr> <td colspan="6"><input type="checkbox" name="amount" value="150"> Professional – $150.00</td> </tr> <tr> <td colspan="6"><input type="checkbox" name="amount" value="95"> Student – $95.00</td> </tr> <tr> <td colspan="6"><input type="checkbox" name="amount" value="55"> Non-Professional: Single – $55.00 (family/survivors)</td> </tr> <tr> <td colspan="6"><input type="checkbox" name="amount" value="50"> *Optional Workshops - $50 for conference participant</td> </tr> <tr> <td colspan="6"><input type="checkbox" name="amount" value="85"> $85 for non-conference participant</td> </tr> <tr> <input type="hidden" name="on1" value="Comments"> <td>Additional Comments:</td><td colspan="5"><textarea rows="2" cols="50" value="" name="os1"></textarea></td> </tr> <tr> <td colspan="6"><input type="checkbox" name="amount" value="250"> Vendors: Vendor booth is available for $250.</td> </tr> --> <tr> <?echo "<input type=\"hidden\" name=\"amount\" value=\"$amount\">\n";?> <td colspan="6"><input name="Submit" type="submit" value="Submit Registration" /></td> </tr> </table> </form> How do I get the amount checkboxes to total into the amount? I have the Comments working and the Proffesional Radio buttons working to create the product, but I'm not sure if the Name and Address stuff is settup right either. I keep reading and reading, but there isn't much info on paypal, especially doing checkbox arrays. And doing an if (isset($_POST['amount'])) { code to add up the array } Doesn't help either. Any help would be great. Thanks
  12. I have a form where I have a dropdown with all 50 states. The value for each options is the State abbreviation. Now I have an input area that needs the name to change if the state is selected as SD so the shipping can be different where this form posts too. I'm not sure how to change an input name tho. I was trying something like below. <script language="javascript" type="text/javascript"> $(document).ready(function () { $('.group').hide(); $('#option').show(); $('#state').change(function () { $('.group').hide(); $('#option'+$(this).val()).show(); }) }); </script> Then inside my form I would do. <td>State</td><td> <?echo "<select id=\"state\" name=\"xxxState\">\n"; $state_query = mysql_query("SELECT * FROM State"); while ($state_row = mysql_fetch_assoc($state_query)) { $State = $state_row['State']; echo"<option value=\"$State\">$State</option>"; } ?> </select> <td> <td>Quantity</td><td> <div id="option" class="group"><input type="text" size="1" value="0" name="QuantityBook1"></div> <div id="optionSD" class="group"><input type="text" size="1" value="2" name="QuantityBookSD"></div> </td> But that javascript obviously would only hide and show the div's, which I guess might work, but wouldn't those values still be passed? So I need to actually remove and add the names. Plus my script above would only work if I had 50 inputs and then pulled the id's for each and only changed the SD one to the "QuantityBookSD". Any help would be appreciated.
  13. Nevermind, I got it working using the link you posted. THANKS! Still thought a group could be broken up to simplify it further.
  14. Why does it count all the rows even inside the Group tho? My problem is, I have to have the entire thing, even the title inside one while loop, because I can echo the title and put the other info in another inside the main loop, but with the pagination I have, then it'll either count the title, or count the info inside the while loop so my pages aren't correct. For instance, if I have my pages set to display 15 queries, using the LIMIT I have below, if I use $query_pag_data2 = "SELECT DISTINCT Whosendscard FROM Contacts WHERE ClientsAnniversary LIKE '%".$searchmonth."%' ORDER BY Whosendscard ASC LIMIT $start, $per_page"; $result_pag_data2 = mysql_query($query_pag_data2) or die('MySql Error' . mysql_error()); while ($contact_row2 = mysql_fetch_array($result_pag_data2)) { $Whosendscard = $contact_row2['Whosendscard']; $query_pag_data = "SELECT * FROM Contacts WHERE Whosendscard ='$Whosendscard' AND ClientsAnniversary LIKE '%".$searchmonth."%' ORDER BY Whosendscard ASC"; $result_pag_data = mysql_query($query_pag_data) or die('MySql Error' . mysql_error()); while ($contact_row = mysql_fetch_array($result_pag_data)) { //Blah code } } Then it'll need to display 15 Whosendscard before it shows another page, and at the same time, if one WhosendsCard has 10 queries and the next has 20, then all of those will show on the same page because it's only counting the "title" and if I put the LIMIT in the second SQL query, if the first query has 20 queries, and the 2nd has 10 queries, it counts these separately, so it will break up the first one and not do 15 of the next one on another page correctly.
  15. Anyone? Did I write it that confusing? All I need is to get all of the information in each group, and return those, but return the group once. I want it to display like the following basically. Joe:(with 3 record) 1st record 2nd record 3rd record Frank:(with 2 records) 1st record 2nd record Paul:(with 3record) 1st record 2nd record 3rd record But right now all I am getting is Joe:(with 3 record) 1st record Frank:(with 2 records) 1st record Paul:(with 3record) 1st record So they are grouping and I am writing the Names as titles in the groups, but I can't get the rest of the information from the groups.
×
×
  • 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.