Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Posts posted by aebstract

  1. mysql_query("UPDATE participants t1 JOIN registrations t2 ON (t1.regid = t2.id) SET `cr` = 'ql' WHERE class = '$_GET[class]' && eventid = '$_GET[event]'") or die(mysql_error());
    

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

     

    After I ran the query and got this error, I checked my database and it appears that all of the rows are updating correctly, but I'm left with this blank page error and I need to be redirected. Any ideas?

  2. mysql_query("UPDATE participants t1 JOIN registrations t2 ON (t1.regid = t2.id) SET cr = 'ql' WHERE class = '$_GET[class]' && eventid = '$_GET[event]'") or die(mysql_error());
    

     

    Currently look like this, getting this error:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

     

    If I remove the single quotes from the FROM section, I get this error:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10.5 && eventid = 2' at line 1

     

    When you remove the '' around ql I get:

    Unknown column 'ql' in 'field list'

  3. mysql_query("UPDATE participants SET participants.cr = 'ql' JOIN registrations ON registrations.id = participants.regid WHERE registrations.class = '$_GET[class]' && participants.eventid = '$_GET[event]'")
    or die(mysql_error());

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JOIN registrations ON registrations.id = participants.regid WHERE registrations.' at line 1

     

     

    So that I'm not just asking for it to be written for me. I will be working on this code.

  4. I'm needing to update a column in my database, basically I have two tables:

     

    participants:

    id regid cr

     

    registrations:

    id class

     

    The id columns are unique int values. The regid = registrations.id

    I need to update the cr record for every row where the regid's class = "whatever".

    This would be a piece of cake for me if I was just grabbing information, but I'm not so sure about updating the field.

  5. That code is the ONLY thing that generates the colors. Then the variable is just echoed out. You have plenty of code to work with right there. You have the values and the line that is doing the figuring.

     

    $content .= "$r[q1]";
    

     

    Is this line really important to you for this issue?

     

    Here's the query for giggles, though I don't know what you would really need it for either, the values are correct.

     

    $query = mysql_query("
    SELECT registrations.firstname, registrations.lastname, participants.q1, participants.q2, participants.q3, participants.q1s, participants.q2s, participants.q3s, participants.id
    FROM events
    INNER JOIN participants ON participants.eventid = $_GET[event]
    INNER JOIN registrations ON registrations.id = participants.regid
    WHERE events.id = $_GET[event] AND registrations.class = '$var'
    ORDER BY LEAST(q1, q2, q3)
    ") or DIE(mysql_error());

  6. Ah, thought I had those sorted out. Fixed it and it didn't change this particular output. If the value in the database is x, then I want it to display as just a blank result. For the admins on this entering an x will basically clear out the field. So it is actually an x in the database, I just want it to show as blank, if it isn't an x it is a number.

  7. if ($r[q1] == x) {
    $r[q1] = '';
    } elseif (($r[q1] < $r[q2]) && ($r[q1] < $r[q2])) {
    $r[q1] = "<font color=red>$r[q1]</font>";
    }
    if ($r[q2] == x) {
    $r[q2] = '';
    } elseif (($r[q2] < $r[q1]) && ($r[q2] < $r[q3])) {
    $r[q2] = "<font color=red>$r[q2]</font>";
    }
    if ($r[q3] == x) {
    $r[q3] = '';
    } elseif (($r[q3] < $r[q1]) && ($r[q3] < $r[q2])) {
    $r[q3] = "<font color=red>$r[q3]</font>";
    }

     

    Here are my results:

     

    http://outlawracing.com/index.php?page=ladders&event=2

    Curtis Rhodesdropdrop4.478 @ 213.6

    Ken Rainwater4.5 @ 156.554.98 @ 2115.6 @ 203.62

    T Johnson6.03 @ 205.45.85 @ 211.34.99 @ 218.11

    Brian Hurrell5.943 @ 2095.789 @ 215.225.804 @ 209.37

     

    So, I'm wondering, what is causing it to not just get one value with the above code?

  8. I have 3 columns of numbers that go with a user. I want to display the list of users in order based on these numbers, but I want user 1 to be the person with the lowest number, throughout all 3 fields. So on and so on for the rest. I obviously know how to do it for one column ORDER BY column, but is there a built in function or simple way to order by the lowest of the three fields per individual? Thanks

  9. If you want it to go away right when they check it, you're going to have to use javascript. If you want to do it after they click a submit button, you can check to see if that field entry is checked or not to determine if it gets displayed.

    I don't do javascript so I couldn't help you there.

  10. Can you post some of the relevant structures for Customfieldview, product, soitem, and so? With that, I'm sure it would be easier to figure out.

     

     

    Customfieldview: recordid (=part.id), info - this is a view

    Product: id, partid (=part.id)

    Soitem: id, productid (=product.id), soid (=so.id), totalprice

    So: id, dateissued

     

    I'm needing to get a total of the soitem.totalprice column, where so.dateissed = in february 2010 (ill change this for each time I need it) AND customfieldview.info = 'Equipment'.

     

    Hope this clears it a little bit more, it's not too difficult, I just think I'm doing my joins in the wrong order or I should be using something other than just a plain JOIN.

     

     

    Note: When you do the query I mentioned in the first post, it like I said will return some parts that have not been set as "equipment" but rather set as "discount". I have to take the recordid and physically check them to see that they are, but I have on a few and it's grabbing mixed results. Again, I think the issue lies in my joins.

  11. Okay, I got a list of results, and they aren't all associated with "Equipment". So I know for a fact it's the way it's joined together. Results to the above query will be shown below. I'm going to try and explain what I need to do a little better:

     

    Should take all orders in Feb. Grab only soitems that have a part that has an expense of Equipment. To check that you have to grab the part that has the reference to the product in the soitem, to get the expense.

     

    equipmentw.jpg

     

    Everything with a negative value is actually an expense of "Discount". The first 8 results are actually "Purchased".

    I'm sorry the columns aren't labeled. They go from left to right:

    Info, Recordid, Partid, Totalprice, Productid, ID

     

    Thanks!

  12. SELECT customfieldview.info, customfieldview.recordid, product.partid, soitem.totalprice AS TOTALPRICE, soitem.productid, product.id
    
    FROM customfieldview
    JOIN product ON customfieldview.recordid = product.partid
    JOIN soitem ON soitem.productid = product.id
    JOIN so ON so.id = soitem.soid
    
    WHERE customfieldview.info = 'Equipment'
    AND so.dateissued >= '2010-2-1'
    AND so.dateissued <= '2010-2-28'
    
    ORDER BY product.id

     

    The db is slightly sporatic, and may need to be.. it's an inventory control setup. Anyway, I'm basically trying to get a total of "Equipment" sales for the month of February. Here's how it works:

     

    Products get put on to sales orders.

    Every product has a parent part. Part's may have several products.

    Inside a part is a custom field called expense, it can be 1 of several options. We're looking at Expense 'equipment' right now.

    I've got a part number B-FP-5 that is showing up on 5 lines with the above code, when I search through physical orders, it's only one 1 order, and it isn't in February.

     

    Need any more info? Just let me know.

  13. It's 2 things at the top that direct you correctly. A couple if statements to see if the form was all submitted. The query for that form and then the form.

     

     

    Anyway, another user submitted the form and it entered a 0 for their user_id.

    Here is really the only query (except for checking the db at the top):

    
    $query = mysql_query("INSERT INTO registrations (firstname, lastname, address, city, state, zip, email, phone, number, car, class)
    VALUES ('$_POST[firstname]', '$_POST[lastname]', '$_POST[address]', '$_POST[city]', '$_POST[state]', '$_POST[zip]', '$_POST[email]', '$_POST[phone1]$_POST[phone2]$_POST[phone3]', '$_POST[carnumber]', '$_POST[makemodel]', '$_POST[classdropdown]')") or DIE(mysql_error());
    
    $lastid = mysql_insert_id();
    
    $query = mysql_query("INSERT INTO standings (memberid, year)
    VALUES ('$lastid', '2010')") or DIE(mysql_error());
    
    

     

  14. No idea what your talking about.

     

    Well, maybe read what I said? A user submitted the form, it entered 0 for his user_id when it is actually 1331. Then, everyone trying to get there got sent to index.php via the top section. When I changed the 0 to a 1331 in the database, it opened back up and allowed users to access it. I don't know how you want me to explain that any other way...

  15. It's a part of a phpbb integration thing, so it's in their includes and whatnot. I echo'd out that user_id and it gave the correct one, so that isn't the problem for sure.

     

    What I just found: In my database, the 2nd row was where a user submitted the registration, but it entered his user_id as 0 instead of 1331 which is what it was. I manually changed the 0 to 1331 and now the registration page allows you to see it if you haven't filled it out. What's up with that?

  16. Basically, the top of the script is what we're looking at. If you're not logged in, you get taken to the login screen and if you've already filled this form out, you get taken back to the main page of the site. Right now, it's taking everyone to the main page, even if they haven't filled it out. I don't really see why though? There are 2 rows in my table right now.

     

     

    <?php
    if ($user->data['user_id'] == ANONYMOUS)
    {
    header("Location: forums/ucp.php?mode=login");
    exit;
    }
    
    $query = mysql_query("SELECT * FROM registrations WHERE userid = '$user->data[user_id]'") or DIE(mysql_error());
    if(mysql_num_rows($query)!=0){
    	while($r=mysql_fetch_array($query))
    	{
    header("Location: index.php");
    exit;
    }
    }
    
    if (isset($_POST['submit'])){
    
    
    if (empty ($_POST['firstname'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['lastname'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['address'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['city'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['state'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['zip'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['phone1'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['phone2'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['phone3'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['classdropdown'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif ($_POST['classdropdown'] == Classes) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['carnumber'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['makemodel'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    } elseif (empty ($_POST['email'])) {
    $problem = TRUE;
    $error .= 'All fields are required to be fully filled out.';
    }
    
    
    
    
    	if (!$problem) {
    
    
    
    
    $query = mysql_query("INSERT INTO registrations (firstname, lastname, address, city, state, zip, email, phone, number, car, class)
    VALUES ('$_POST[firstname]', '$_POST[lastname]', '$_POST[address]', '$_POST[city]', '$_POST[state]', '$_POST[zip]', '$_POST[email]', '$_POST[phone1]$_POST[phone2]$_POST[phone3]', '$_POST[carnumber]', '$_POST[makemodel]', '$_POST[classdropdown]')") or DIE(mysql_error());
    
    $lastid = mysql_insert_id();
    
    $query = mysql_query("INSERT INTO standings (memberid, year)
    VALUES ('$lastid', '2010')") or DIE(mysql_error());
    
    
    
    
    
    
    
    
    
    	$emailbody = "
    ORSCA REGISTRATION FORM<br /><br />
    
    <table>
    <tr>
    <td>
    Name:
    </td><td>
    </td><td>
    $_POST[firstname] $_POST[lastname]
    </td></tr>
    <tr><td>
    Email:
    </td><td>
    </td><td>
    $_POST[email]
    </td></tr>
    <tr><td>
    Phone Number:
    </td><td>
    </td><td>
    ($_POST[phone1]) $_POST[phone2] - $_POST[phone3]
    </td></tr>
    </table>
    
    $_POST[address]<br />
    $_POST[city], $_POST[state] $_POST[zip]<br /><br />
    
    $_POST[makemodel]<br />
    $_POST[classdropdown]<br />
    $_POST[carnumber]
    
    	";
    
    
    
    
    
    
    	$to  = 'tcantwell@berryequipment.net' . ', '; // note the comma
    
    	// subject
    	$subject = 'ORSCA Registration Form';
    
    	// message
    	$message = "
    	<html>
    	<head>
    	</head>
    	<body>
    	$emailbody
    	</body>
    	</html>
    	";
    
    	// To send HTML mail, the Content-type header must be set
    	$headers  = 'MIME-Version: 1.0' . "\r\n";
    	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    	// Additional headers
    
    	// Mail it
    	mail($to, $subject, $message);
    
    
    
    
            }
    
    
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    $content .= "
    <div id=\"content\">
    <h3>Season Registration Form</h3>
    <p>You will appear on the standings page AFTER your registration information has been received and confirmed. If you notice any information that is wrong and needs to be changed, <a href=\"forums/ucp.php?i=pm&mode=compose&u=2\">click here to send a message to the ADMIN</a> with a request of changed information.</p>
    <h3>Registration Fees</h3>
    
    <p>
    Registration is $125 per year or $25 per event
    <br /><br />
    You can mail check or money order to:
    <br /><br />
    ORSCA<br />
    2732 Oakwood Drive<br />
    Loganville, GA 30052
    
    </p>
    ";
    
    
    if (isset($error)) {
    $content .= "<h2>Error:<br /> $error</h2>";
    }
    
    $content .= "<form action=\"index.php?page=registration\" method=\"post\" name=\"registration\">
    <table><tr><td class=\"rtable1\">
    Name:
    </td><td class=\"tablespace\">
    </td><td>
    <input type=\"text\" maxlength=\"20\" class=\"textfield\" name=\"firstname\" value=\"$_POST[firstname]\" size=\"7\" /> <input type=\"text\" maxlength=\"20\" class=\"textfield\" name=\"lastname\" value=\"$_POST[lastname]\" size=\"10\" />
    </td></tr>
    <tr><td class=\"rtable1\">
    Address:
    </td><td class=\"tablespace\">
    </td><td>
    <input type=\"text\" maxlength=\"60\" class=\"textfield\" name=\"address\" value=\"$_POST[address]\" size=\"20\" /><br />
    </td></tr>
    <tr><td class=\"rtable1\">
    City, State, Zip:
    </td><td class=\"tablespace\">
    </td><td>
    <input type=\"text\" maxlength=\"30\" class=\"textfield\" name=\"city\" value=\"$_POST[city]\" size=\"10\" />, <input type=\"text\" maxlength=\"2\" class=\"textfield\" style=\"text-transform: uppercase; text-align:center;\" name=\"state\" value=\"$_POST[state]\" size=\"1\" /> <input type=\"text\" maxlength=\"5\" class=\"textfield\" style=\"text-align: center;\" name=\"zip\" value=\"$_POST[zip]\" size=\"2\" />
    </td></tr>
    
    
    
    <tr><td class=\"rtable1\">
    Phone Number:
    </td><td class=\"tablespace\">
    </td><td>
    <input type=\"text\" maxlength=\"3\" class=\"textfieldp\" name=\"phone1\" value=\"$_POST[phone1]\" size=\"1\" /><input type=\"text\" maxlength=\"3\" class=\"textfieldp\" name=\"phone2\" value=\"$_POST[phone2]\" size=\"1\" /><input type=\"text\" maxlength=\"4\" class=\"textfieldp\" name=\"phone3\" value=\"$_POST[phone3]\" size=\"2\" />
    </td></tr>
    <tr><td class=\"rtable1\">
    Racing Class:
    </td><td class=\"tablespace\">
    </td><td>
    <select name=\"classdropdown\">
      <option style=\"text-align: center; border-bottom: 1px solid #000; margin-bottom: 10px; padding-bottom: 5px;\">Classes</option>
      <option value=\"Outlaw 10.5\">Outlaw 10.5</option>
      <option value=\"Limited Street\">Limited Street</option>
      <option value=\"EZ Street\">EZ Street</option>
      <option value=\"Real Street\">Real Street</option>
      <option value=\"Modified Street\">Modified Street</option>
      <option value=\"4.70 Index\">4.70 Index</option>
      <option value=\"5.30 Index\">5.30 Index</option>
      <option value=\"6.00 Index\">6.00 Index</option>
      <option value=\"7.00 Index\">7.00 Index</option>
    </select>
    </td></tr>
    <tr><td class=\"rtable1\">
    Desired Car Number:
    </td><td class=\"tablespace\">
    </td><td>
    <input type=\"text\" maxlength=\"10\" class=\"textfield\" name=\"carnumber\" value=\"$_POST[carnumber]\" size=\"5\" />
    </td></tr>
    <tr><td class=\"rtable1\">
    Vehicle Make/Model:
    </td><td class=\"tablespace\">
    </td><td>
    <input type=\"text\" maxlength=\"50\" class=\"textfield\" name=\"makemodel\" value=\"$_POST[makemodel]\" size=\"20\" />
    </td></tr>
    <tr><td class=\"rtable1\">
    Email Address:
    </td><td class=\"tablespace\">
    </td><td>
    <input type=\"text\" maxlength=\"50\" class=\"textfield\" name=\"email\" value=\"$_POST[email]\" size=\"30\" />
    </td></tr>
    </table>
    <input type=\"submit\" name=\"submit\" class=\"textfield\" value=\"Send Registration\" />
    
    </form>
    
    </div>
    
    ";
    
    
    ?>

     

     

    EDIT: Oh, and the first part works, if you're not logged in it takes you to the login page. Other than that you're getting booted to home page.

  17. [sat Mar 06 12:53:51 2010] [error] [client 202.75.211.90] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)

    [sat Mar 06 12:56:10 2010] [error] [client 211.155.228.169] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)

×
×
  • 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.