l95theses Posted May 6, 2008 Share Posted May 6, 2008 I have a php script that goes through a mysql database and checks to see if there is a time placed in a mysql field. This seems to work, except at the end of the php script. If I put anything at the end of this script, does not execute the rest of it. Only the parts within the loop are finished. I can't for the life of me figure out this problem. Here is my script. <?php $courseid = "salad5432101_1_2008"; $link = mysql_connect("***", "***", "***") or die(mysql_error()); mysql_select_db("golf") or die(mysql_error()); $result = mysql_query("SELECT * FROM $courseid"); $row = mysql_fetch_array($result) or die(mysql_error()); $result2 = mysql_query("SELECT * FROM $courseid WHERE courseid='lookhere'"); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $fields = mysql_list_fields("golf", $courseid, $link); $counts = mysql_num_fields($fields); $current = $row['current']; $rowboat = str_replace("543210","-",$courseid); $rowboat = str_replace("_","/",$rowboat); $rowboat = str_replace("012345"," ",$rowboat); $increase2 = 0; $increase2t = 0; $increase = 0; echo "<font size=4><b>Golf Course Tee Times Bid Confirmation</b><br><font size=3><b>".$rowboat."</b><br>"; echo "<table border=1><tr><td><b>Tee time</b></td><td><b>Bidder's Login</b></td><td><b>Full Name</b></td><td><b>Email</b></td><td><b>Address</b></td><td><b>City</b></td><td><b>Zip</b></td><td><b>Phone</b></td><td><b>Amount paid</b></td><td><b>Increase Amount %50</b></td></tr>"; for ( $counter = 6; $counter <= ($counts-1)aa; $counter += 1) { $spliter = mysql_field_name($fields, $counter); $spliter2 = str_replace("_",":",$spliter); $amount3 = mysql_query("SELECT * FROM login WHERE login='$row2[$spliter]'"); $amount2 = mysql_fetch_array($amount3) or die(mysql_error()); $amount = $amount2['current_bid']; if(isset($row2[$spliter])) { $increase = (($amount-$current)/2); $increase2t += (($amount-$current)/2); $increase2 += ($current+($increase)); echo "<tr><td>".$spliter2."</td><td>".$row2[$spliter]."</td><td>".$amount2['firstname'].$amount2['lastname']."</td><td>".$amount2['email']."</td><td>".$amount2['address']."</td><td>".$amount2['city']."</td><td>".$amount2['zip']."</td><td>".$amount2['phone']."</td><td>".$amount."</td><td>".$increase."</td></tr>"; } } echo "Hey Jude2"; ?> Quote Link to comment Share on other sites More sharing options...
dezkit Posted May 6, 2008 Share Posted May 6, 2008 <?php $courseid = "salad5432101_1_2008"; $link = mysql_connect("***", "***", "***") or die(mysql_error()); mysql_select_db("golf") or die(mysql_error()); $result = mysql_query("SELECT * FROM $courseid"); $row = mysql_fetch_array($result) or die(mysql_error()); $result2 = mysql_query("SELECT * FROM $courseid WHERE courseid='lookhere'"); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $fields = mysql_list_fields("golf", $courseid, $link); $counts = mysql_num_fields($fields); $current = $row['current']; $rowboat = str_replace("543210","-",$courseid); $rowboat = str_replace("_","/",$rowboat); $rowboat = str_replace("012345"," ",$rowboat); $increase2 = 0; $increase2t = 0; $increase = 0; echo "<font size=4><b>Golf Course Tee Times Bid Confirmation</b><br><font size=3><b>".$rowboat."</b><br>"; echo "<table border=1><tr><td><b>Tee time</b></td><td><b>Bidder's Login</b></td><td><b>Full Name</b></td><td><b>Email</b></td><td><b>Address</b></td><td><b>City</b></td><td><b>Zip</b></td><td><b>Phone</b></td><td><b>Amount paid</b></td><td><b>Increase Amount %50</b></td></tr>"; for ( $counter = 6; $counter <= ($counts-1)aa; $counter += 1) { $spliter = mysql_field_name($fields, $counter); $spliter2 = str_replace("_",":",$spliter); $amount3 = mysql_query("SELECT * FROM login WHERE login='$row2[$spliter]'"); $amount2 = mysql_fetch_array($amount3) or die(mysql_error()); $amount = $amount2['current_bid']; if(isset($row2[$spliter])) { $increase = (($amount-$current)/2); $increase2t += (($amount-$current)/2); $increase2 += ($current+($increase)); echo "<tr><td>".$spliter2."</td><td>".$row2[$spliter]."</td><td>".$amount2['firstname'].$amount2['lastname']."</td><td>".$amount2['email']."</td><td>".$amount2['address']."</td><td>".$amount2['city']."</td><td>".$amount2['zip']."</td><td>".$amount2['phone']."</td><td>".$amount."</td><td>".$increase."</td></tr>"; } } ?> <?php echo "Hey Jude2"; ?> try that Quote Link to comment Share on other sites More sharing options...
l95theses Posted May 6, 2008 Author Share Posted May 6, 2008 <?php $link = mysql_connect("***", "***", "***") or die(mysql_error()); mysql_select_db("***") or die(mysql_error()); $sql = "SHOW TABLES FROM ***"; $result = mysql_query($sql); echo "<center><table border='1' background=bg.gif width=390>"; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $date = date("n/j/Y"); $time = 12; $date2 = explode("/",$date); $dateday = ($date2[1]-1); while ($row = mysql_fetch_row($result)) { $checker = explode("_",$row[0]); $checker = $checker[0]; if($checker!="backup") { if($row[0]!="login" & $row[0]!="login2") { $rowboat = str_replace("543210","-",$row[0]); $rowboat = str_replace("_","/",$rowboat); $rowboat = str_replace("012345"," ",$rowboat); $rowboat2 = explode("-",$rowboat); $rowboat2 = $rowboat2[1]; $rowboat3 = explode("/",$rowboat2); if($dateday==$rowboat3[1] & $time>=12 & $date2[0]==$rowboat3[0] & $date2[2]==$rowboat3[2]) { // get users to send to next function and amounts // ~~~~~ Declaring variables.. ~~~~~ $result5 = mysql_query("SELECT * FROM $row[0]"); $row5 = mysql_fetch_array($result5) or die(mysql_error()); $result2 = mysql_query("SELECT * FROM $row[0] WHERE courseid='lookhere'"); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $fields = mysql_list_fields("***", $row[0], $link); $count = mysql_num_fields($fields); $current = $row['current']; // ~~~~~ end declaration for ( $counter = 6; $counter <= ($count-1); $counter += 1) { $spliter = mysql_field_name($fields, $counter); $spliter2 = str_replace("_",":",$spliter); $amount3 = mysql_query("SELECT * FROM login WHERE login='$row2[$spliter]'"); $amount2 = mysql_fetch_array($amount3) or die(mysql_error()); $amount = $amount2['current_bid']; if(isset($row2[$spliter])) { // clearing current bids out of user's accounts mysql_query("UPDATE login SET current_slot=NULL WHERE login='$row2[$spliter]'") or die(mysql_error()); mysql_query("UPDATE login SET current_bid=NULL WHERE login='$row2[$spliter]'") or die(mysql_error()); mysql_query("UPDATE login SET current_course=NULL WHERE login='$row2[$spliter]'") or die(mysql_error()); // credit card transactions for everyone in the closing course. //-- using our $amount2 variable that is an array to grab personal information to submit to the credit card query. $ccnumber = $amount2['ccnumber']; $expdate = $amount2['expdate']; $cardcode = $amount2['cardcode']; $firstname = $amount2['firstname']; $lastname = $amount2['lastname']; $address = $amount2['address']; $city = $amount2['city']; $state = $amount2['state']; $zip = $amount2['zip']; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $cap = array(); $cap['x_login'] = "***"; $cap['x_tran_key'] = "***"; $cap['x_version'] = "3.1"; $cap['x_delim_char'] = "|"; $cap['x_delim_data'] = "TRUE"; $cap['x_test_request'] = "FALSE"; $cap['x_relay_response'] = "FALSE"; $cap['x_type'] = "AUTH_ONLY"; $cap['x_method'] = "CC"; $cap['x_relay_response'] = "FALSE"; $cap['x_card_num'] = "4007000000027"; $cap['x_exp_date'] = "0309"; $cap['x_card_code'] = "123"; $cap['x_amount'] = "1.20"; $cap['x_first_name'] = "John"; $cap['x_last_name'] = "Smith"; $cap['x_address'] = "1234 West Main St."; $cap['x_city'] = "Some City"; $cap['x_state'] = "CA"; $cap['x_zip'] = "12345"; foreach( $cap as $key => $value ) $fields .= "$key=" . urlencode( $value ) . "&"; //////////////////////////////////////////////////// $ch = curl_init("https://test.authorize.net/gateway/transact.dll"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $fields, "& " )); $resp = curl_exec($ch); curl_close ($ch); //////////////////////////////////////////////////// $resp = explode("|",$resp); if ($resp[3]=="This transaction has been approved.") { echo "<table border=1><tr><td>Approved</td></tr></table>"; } else { echo "<table border=1><tr><td>".$resp[3]."</td></tr></table>"; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // end credit card transactions // last thing to do is to rename the table so it's closed on the website. if($counter <= ($count-1)) { $newname = "backup_".$row[0]; mysql_query("RENAME TABLE $row[0] TO $newname") or die(mysql_error()); echo "we renamed the table too"; } } } echo "</table>"; } echo "<table border=1><tr><td>"; echo "<a href=spliter.php?course=".$row[0].">".$rowboat."</a>"; echo ", <a href=spliteram.php?course=".$row[0].">am</a>"; echo ", <a href=spliterpm.php?course=".$row[0].">pm</a>"; echo "</td></tr></table>"; } } } ?> this is more like what I need to do. I need it for credit card transmission and it's giving me this error. (13) The merchant login ID or password is invalid or the account is inactive. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.