darrenwindle Posted December 28, 2012 Share Posted December 28, 2012 Ok ill give the run down of the php[ and sql first before the problem. table - pd_giftcert columns - cust_id, cre_email, pd_gcnumber, timestamp, pd_expiry here's the php pd_giftert.php <?php session_start(); $page_title = 'My Events'; $username = $_SESSION['cre_email']; if (!isset($_SESSION['loggedin'])) { echo "<script language=\"Javascript\">window.location='buy.php?id=$id'</script>"; } include("includes/headerOut.php"); include("dbconn2.php"); include("email.php");?> <!--main Nav--> <?php include('includes/mainNav.php'); ?> <!--Section Title--> <!--primary Content--> <div id="primaryContent"> <?php include('includes/login.php'); ?> </div> <!--Main Content--> <div id="mainContent"> <h1>Buy Gift Certificate</h1> <p></p> <p>Gift cards cost £20 and must be used within 6 months of purchase </p><tr> <td><h3>buy Gift Certifactes</h3></td></tr> <tr> <td height='102'><p>************</p></td> </tr> <tr> <td height='278' class='aligntop'><form action='https://www.paypal.com/cgi-bin/webscr' method='post'> <input type='hidden' name='cmd' value='_xclick'> <input type='hidden' name='business' value='bookings@************.co.uk'> <input type='hidden' name='item_name' value='Gift Certificate'> <input type='hidden' name='amount' value='20'> <br /> <br /> <input type='hidden' name='undefined_quantity' value='1'> <input type='hidden' name='currency_code' value='GBP'> <input type='hidden' name='return' value='http://www.************.co.uk/gc_thanks_payment.php'> <input type='hidden' name='cancel_return' value='http://www.************.co.uk/payment_failed.html'> <input type='hidden' name='receiver_email' value='bookings@************.co.uk'> <input type='hidden' name='mrb' value='************'> <input type='hidden' name='pal' value='************'> <input type='hidden' name='no_shipping' value='0'> <input type='hidden' name='no_note' value='1'> <br /><input type='image' name='submit' src='images/continue.gif' border='0' alt='continue to secure server'> </p> </form> </p> </div> <!--primary Content--> <div id="primaryContent"> <?php include('includes/newEvents.php'); ?> </div> <!--Footer--> <?php include('includes/footer.php'); ?> </div> </div> </body> I need to enter a random 8-16 digit number that is unique in the gc_number column upon clicking the ontinue button on this page. I then need to make sure it is linked to the logged in user who is buying the gift certificate. Also I need to generate a thanks payment page that shows the unique gift certificate with the number that is generated and the email that it is linked to. All this must be inserted into the db table above with all the otjher relevant info. How can I do this. Any help would be appreciated. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/272448-help-with-inserting-to-sql-from-php/ Share on other sites More sharing options...
Muddy_Funster Posted December 28, 2012 Share Posted December 28, 2012 why must the gc number be random? what format is the gc number field? int/varchar? Quote Link to comment https://forums.phpfreaks.com/topic/272448-help-with-inserting-to-sql-from-php/#findComment-1401820 Share on other sites More sharing options...
darrenwindle Posted December 28, 2012 Author Share Posted December 28, 2012 why must the gc number be random? what format is the gc number field? int/varchar? the gcnumber field is a varhar with a max of 30 chars Quote Link to comment https://forums.phpfreaks.com/topic/272448-help-with-inserting-to-sql-from-php/#findComment-1401821 Share on other sites More sharing options...
Muddy_Funster Posted December 28, 2012 Share Posted December 28, 2012 and why random? Quote Link to comment https://forums.phpfreaks.com/topic/272448-help-with-inserting-to-sql-from-php/#findComment-1401822 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.