Jump to content

ivalea

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ivalea's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks businessman - after talking to the client, I decided instead of removing them from the table completely - which would make it more work to reinstate them - that I would just create another column in the table that either has a 1 or 0 value.  Then I just placed an update in the admin so that it updates this field through a dropdown.  This allows the admin then to turn the student off or on.  Students only gain access to their pages if this active column is set to 1. Works great! Thanks again for the speedy response though!  :)
  2. Hello! I have a database that includes a customers table and a students table.  In my admin I have the ability to update a customers information.  I'm looking to include a dropdown menu on this customers page that allows me to use a dropdown to select a yes or no under a heading of student access. Yes = delete record from students table No = add current customer to students table I'm not really sure on how to go about this - can someone point me in the right direction of how I could accomplish this?  Even direction of where I could find a tutorial for this specifically would greatly help!  Thanks!
  3. I'm working with oscommerce and created a table called students.  We have one product that is actually a course.  Once a customer purchases this course, it's supposed to add them to the students table.  On the checkout success page I first did a select statement that is supposed to look at the order just made and see if the product model matches the one of the course.  If, and ONLY if it does, then select the customers email address from the customers table and add them to the students table along with their customer id.  If the product model of the item just purchased doesn't match then do absolutely nothing.  I've tried this over and over again and I cannot seem to get it to act right.  Either all purchases are added to the students table or none at all whether they've purchased the correct product or not.  i'm ashamed to admit it, but I've been trying to get this small piece to work for a week now.... ??? Any help on this would be sooooo appreciated. Please note that where it says "INSERT CUSTOMERS ID HERE" in the insert statement - this is because I was unsure of where and how to get the customers email from the customers table. Here is my code: [code] <?php       $model_query = mysql_query("select products_model from orders_products where orders_id = '" . (int)$orders['orders_id'] . "' and products_model = 'CBT-0100'"); $result = mysql_query($mod_query); if($result){ $studentsquery = mysql_query("insert into students (students_id, customers_id, students_pmodel, students_email, students_mod1, students_mod2, students_mod3, students_manual, students_cert) values ('', '" . (int)$customer_id['customers_id'] . "', 'CBT-0100', 'INSERT - CUSTOMER ID HERE', '', '', '', '', '')"); }else{ echo ''; }   ?> [/code]
  4. Not sure - just that I need the "if" in there to make sure that the order contains that specific product model. So, I first need to pull the order information and then select the model number purchased.  Only if the model number purchased is equal to a specific string, then insert into the students table.  I'll look into doing an INSERT INTO .... SELECT though - thanks! :)
  5. Hi, I'm trying to grab the results of a select statement and only if the result is equal to a certain string use an insert to add to a different table.  I looks like my select is okay - but now I'm wondering how I can run the insert... here is my code: [code] $a = mysql_query("select * from orders_products as op, customers as c where op.orders_id = '000099' and op.products_id = '29' and c.customers_id = '14'"); while($row = mysql_fetch_assoc($a)){ $id = $row['products_model']; $email = $row['customers_email_address']; $custid = $row['customers_id']; } if ($id == 'CBT-0100'){ echo 'Now run the insert query using $email, $custid, and $id'; $z = mysql_query("insert into students (students_id, customers_id, students_pmodel, students_email, students_mod1, students_mod2, students_mod3, students_manual, students_cert) values ('', '$custid', '$id', '$email', '', '', '', '', ''"); }else{ echo 'something here'; } [/code] Desperately need help with this - project is due today and this is the last piece that I need to lauch!  Thanks! :)
  6. Thanks Jocka - i actually got the fpdf thing worked out - though now file size is huge! :) Also, I'm not altogether sure how use sessions for this purpose - would I have to add anything to the db for this to work?  Thanks! :)
  7. Hi - I'm trying to run a query that first checks to see if a customer has purchased a certain product and then if they have add them to a table in the db and print out a success message.  I swore I had this working a couple of days ago - thought I'd test it again today and now it's not only NOT adding the customer to the table but there's no message either.  Can you spot the error - maybe i've just been looking at it too long??? [code] $products = $cart->get_products(); $anycourse =0; for ($i=0, $n=sizeof($products); $i<$n; $i++)   { $val=mysql_fetch_array( mysql_query("select  pd.products_description, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$products[$i]['id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'")); if ($val = 'CBT-0100'){ $query = "select customers_email_address from customers where customers_id = '" . (int)$customer_id . "'"; $result = mysql_query ($query); $email=mysql_result($result,"customers_email_address"); if ($result){ $query = "INSERT INTO students (students_id, customers_id, students_pmodel, students_email, students_mod1, students_mod2, students_mod3) values ('', '$customer_id', '$model', '$email', '', '', '')"; $result = mysql_query ($query); if ($result) { $anycourse = 1; }else{ echo 'Could not add customer to db'; } } } }//end for if ($anycourse == 1)     echo '<p>Thank you for enrolling in our online course.  To login to your course please go to "My Account".</p>'; [/code] Thanks in advance for any help you can provide!  :)
  8. Hello - I've got a page that includes a link to download a dynamic pdf using the fpdf class and I've got a couple of questions - been searching for awhile now and I can't find the answer!  ??? First, is there a way for me to make the link available to users for only a certain number of attempts without having to set up something in mysql? Second, would anyone familiar with fpdf happen to know how I can get my images to come out looking better?  I'm not sure if it's the way they're are being set on the page or if it's just how the class generates the pdf.  I've tried using a 300dpi jpg and png but still my images are fuzzy. Thanks! 
  9. Hello, I'm trying to pull customers first name and last name from mysql.  What I want to do is say if there is no result returned then either echo an error message or redirect to another page.  But what I have now , lets the user into the page whether they are found in the table or not. All I'm trying to do is get the customers first and last name but only if their email address is found in the students table.  Here is what I have: [code] $result = mysql_query("SELECT customers.customers_firstname, customers.customers_lastname from customers, students where students.students_email = customers.customers_email_address") or die (mysql_error()); if(!result){ echo 'None'; }else{ while ($row = mysql_num_rows($result)) { $first .= $row[ 'customers_firstname' ]; $last .= $row[ 'customers_lastname' ]; } } [/code] This returns a server error when running the script...  Any thoughts on how I can achive this correctly?  Thanks! :)
  10. Thanks roopert!  Basically what I'm doing is building a menu based upon which product a member has purchased.  There should be up to ten model #'s that once purchased give the user access to the corresponding directory.  So on this success page, it should automatically enter the user in a separate members table - since there are other products other than these 10 - later, on their main account page, I use a switch to build the menu based upon the information included in the members table. Unfortunately, I tried the script you provided and it didn't work.  I totally get what you were trying to explain so I'll try something else.  Thanks again! :)
  11. Hi - I'm building a site with a shopping cart and on the checkout success page I would like to check and see what model number they purchased and then run a query based on which model number it was.  What I'm trying to find out is how would I assign my variable for this?  Right now I have this: [code] if ($partno = 'B-100'){ //then run query } [/code] Basically all part no's will begin with B-.  I tried the || w/o any success: [code] if ($partno = 'B-100' || 'B-200') { //then run query } [/code] Any easy ways to accomplish this?  Thanks in advance!  :)
  12. Thanks everyone for the help - I do have it working now.  Thanks printf - after reading your post I realized that all i really needed was the model #.  Now the only problem I have is that if there is more than one row with an email address matching the email address on file how can I get it to show both c1 and c2?  Here's what I have now - works perfect but only returns one row: [code] $query = "select members.members_pmodel from members, customers where members.members_email = customers.customers_email_address"; $result = @mysql_query ($query); $num=mysql_num_rows($result); $i=0; while ($i < $num){ $model=mysql_result($result,$i,"members_pmodel"); echo ""; $i++; } switch($model){ case 'c1': echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_C1, '', 'SSL') . '">' . MY_COURSES_C1 . '</a>'; break; case 'c2': echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_C2, '', 'SSL') . '">' . MY_COURSES_C2 . '</a>'; break; }[/code] I was getting errors trying to use mysql_fetch...() - this way it will at least return one row.  But if there are two or more rows containing the same email address I need it to return both rows.  Not sure what to change here...
  13. Hello - I'm trying to display a menu based upon information in two tables.  I've inserted a query that looks like this: [code]$query = "select * from members, customers"; $result = @mysql_query ($query); $num=mysql_numrows($result); $i=0; while ($i < $num){ $model=mysql_result($result,$i,"members_pmodel"); $first=mysql_result($result,$i,"members_fname"); $last=mysql_result($result,$i,"members_lname"); $company=mysql_result($result,$i,"members_company"); $address=mysql_result($result,$i,"members_address"); $city=mysql_result($result,$i,"members_city"); $state=mysql_result($result,$i,"members_state"); $zip=mysql_result($result,$i,"members_zip"); $email=mysql_result($result,$i,"members_email"); $phone=mysql_result($result,$i,"members_phone"); $email2=mysql_result(result,$i,"customers_email_address"); echo ""; $i++; }[/code] Then right after that I have this: [code]if ($email == $email2){ switch($model){ case 'c1': echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_C1, '', 'SSL') . '">' . MY_COURSES_C1 . '</a>'; break;             case 'c2':             echo tep_image(DIR_WS_IMAGES .'arrow_green.gif') . ' <a href="' . tep_href_link (FILENAME_C2, '', 'SSL') . '">' . MY_COURSES_C2 . '</a>'; } }else{ echo "You are not enrolled in any courses at this time."; }[/code] What I am trying to do is to display a different menu based upon the model number in the members table - but first I need to check if the email address in the customers table exists in the members table. I keep getting this error though: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/www/os.xephor.net/catalog/account.php on line 152 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/www/os.xephor.net/catalog/account.php on line 152 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/www/os.xephor.net/catalog/account.php on line 152 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/www/os.xephor.net/catalog/account.php on line 152 Any thoughts on how to fix this?  Perhaps my code is wrong?  Thanks! :)
  14. Thanks much Keith - that seemed to do the trick! - Irene :)
×
×
  • 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.