Jump to content

BigTime

Members
  • Posts

    60
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

BigTime's Achievements

Member

Member (2/5)

0

Reputation

  1. I would like to do a join I think? Not sure if Im going about this the right way, and unsure how to format the query. In one table I have a field called name - I'd like to call all of them - then query another table for any results that exist with that name, and if so show them all grouped together, and if not, then show the name in RED (or whatever). This is basically have they submitted or not. so table1: name Select DISTINCT name from table1 ORDER by name ASC then table2: id (not the same as the first table) user (which will match name) week description SELECT * from table2 WHERE (user='$name' AND week='$week') Then visible results loop looks somthing like: WEEK 1 NAME1 DESCRIPTION ID NAME1 DESCRIPTION ID NAME1 DESCRIPTION ID NAME2 DESCRIPTION ID NAME2 DESCRIPTION ID NAME2 DESCRIPTION ID NAME3 DESCRIPTION ID NAME3 DESCRIPTION ID NAME4 NO SUBMISSION FOUND NAME5 DESCRIPTION ID NAME5 DESCRIPTION ID Do I need to do the first query and then a foreach loop?
  2. Or define new variables from array results? I dont need to loop my form 4 times I just want to know if what Im looking for is WITHIN the array in order to move to my next step If it is in the array - Check something else is set, YES show form, NO show choices If it is not in array - Show form The while loop makes it want to loop as many times as my results are - so 4 results, 4 loops. Im sure Im using the wrong method here. Hoping someone smart out there understands what Im trying to do
  3. I have a form that needs to require certain parameters be set prior to showing it. I query one column to find the conditions in which it might be required the result set into an array if a currently set parameter is found within this array then check for second parameter being set if its set = show the form if its not set = offer choices to set so we can show the form My problem is in the damn while loop How can I take the data that comes out of the initial $results query and store them for use OUTSIDE a while loop? Thanks in adcance for any help # setup SQL statement $SQL = " SELECT DISTINCT column FROM table WHERE condition='$condition' AND condition2 != '' "; # execute SQL statement $result = mysql_db_query($db, $SQL, $cid); # check for errors if (!$result) { echo( mysql_error()); } $check = mysql_num_rows($result); #We have a split needed so print it if($check>'1') { while ($data=mysql_fetch_array($result)){ $columnresults=$data[column]; $columnarray = array($columnresults); #If our current division selected is in this array then show AND REQUIRE the split choice to show the form $this = $_GET['this']; if (in_array($this, $columnarray)) { if (!$that || $that=='') { echo (" THERE IS NO THAT WE NEED TO PROVIDE OPTIONS TO SET IT FIRST <BR>"); } elseif ($that || $that != '') { echo ("THAT IS SET SHOW THE FORM<BR>"); } } else (!in_array($this, $columnarray)){ echo ("I DONT NEED THAT I CAN JUST SHOW THE FORM<BR>"); } } }
  4. slight modification: $db2 = $db2 . $year . "foo"; to $db2 = $db2 . "." . $year . "_foo"; Got me to where I wanted to be. Thank you!
  5. Database one: schedules Database two: schedulesArchive I need to copy a table named foo from database one to database two and rename it to 2012_foo. $usr = "user"; $pwd = "pass"; $db = "schedules"; $db2 = "schedulesArchive"; $host = "localhost"; # connect to database $cid = mysql_connect($host,$usr,$pwd); if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); } $year=Date("Y"); SQL = "CREATE TABLE $db2.$year_foo SELECT * FROM $db.foo"; $result = mysql_db_query($db,$SQL,$cid); # check for error if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); } My problem is in the naming of the new table I want it to read schedulesArchive.2012_foo, but Im confused on how to get my statement to read the $year parameter inline in my query Thanks in advance
  6. Thanks xyph Although I don't really need position, stripos() worked for me
  7. Is this possible? I have a defined variable that I need to check against like: if ($_POST['home'] LIKE '$user%'){ //SQL UPDATE $_POST['home'] might be something like Wellingfield Blue whereas user would always be just Wellingfield Thanks in advance
  8. Hi VanDerSaAr I use a math captcha locally that randomly spits out either text or the numeral for each place.... I then also add ONE hidden (via CSS) form element titled something like URL or link and check to see if that field is empty prior to submission. Never get spam. Ive also employed Key Captcha with great success though its not local
  9. see there? Thanks for your eyes, scootstah!!
  10. Im getting the error: Unknown column 'data2.name' in 'field list' in this SELECT query and I'm at a loss.... The table exists the column exists, I can SQL query SELECT refreport.user, refreport.division, refreport.hometeam, refreport.awayteam, refreport.week, refreport.homeleague, refreport.homeconference, refreport.awayconference, data2.name, data2.email FROM refreport INNER JOIN data on data2.user=refreport.user WHERE gameid='$id'"; Thanks in advance!
  11. yes...nest another if and modify the query if($county){ if($rentmin && $rentmax ){ } if ($rentmin && !$rentmax){ } etc....
  12. I think psycho forgot to change it to user ID in the delete directive $query = "DELETE FROM users WHERE id IN ({$deleteIDs})"; should be $query = "DELETE FROM users WHERE Userid IN ({$deleteIDs})";
  13. you've got a problem in your <.div><./div> s When I do that I right click look at source and count them out open and closed because it can get complicated and only you know what div because you've got the css, but you are likely missing a <./div> just before you open the sidebar div
×
×
  • 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.