Jump to content

Search the Community

Showing results for tags 'php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hi, I don't know what amI do wrong. I have 3 tables, (authors, text, kategories). I want to print every group names from database and + 3 text below kategory name. After first record (text) separately two more (next) records. With this code I give only the first category with 3 text... Please if You can help me.... <?php /* SELECT FROM DATABASE */ $QuerySelect = ' SELECT c_kat.c_kat_onoff, c_kat.c_kat_delete, c_kat.c_kat_order, c_autor.c_autor_onoff, c_autor.c_autor_delete, c_autor.c_autor_prezime, c_autor.c_autor_ime, c_autor.c_autor_id, c_kat.c_kat_id, c_kat.c_kat_ime, c_vesti.c_vesti_id, c_vesti.c_vesti_date, c_vesti.c_vesti_sat, c_vesti.c_vesti_min, c_vesti.c_vesti_naslov, c_vesti.c_vesti_text, c_vesti.c_vesti_kat, c_vesti.c_vesti_autor, c_vesti.c_vesti_onoff, c_vesti.c_vesti_delete FROM c_vesti INNER JOIN c_kat ON c_kat.c_kat_id = c_vesti.c_vesti_kat INNER JOIN c_autor ON c_autor.c_autor_id = c_vesti.c_vesti_autor WHERE `c_vesti_onoff` = 1 AND `c_vesti_delete` = 0 ORDER BY `c_kat_order` ASC, `c_vesti_date` DESC, `c_vesti_sat` DESC, `c_vesti_min` DESC, `c_vesti_id` ASC LIMIT 3 '; $query_select = mysqli_query($dbConnect, $QuerySelect) or die (mysqli_error($dbConnect)); if(!$query_select){ echo mysqli_error($dbConnect); exit; } while($request = mysqli_fetch_array($query_select)) { $group_by_cat[$request['c_kat_ime']][] = $request; } foreach($group_by_cat as $group => $rows) { echo '<div class="catcolor">' . $group . '</div>'; // Category name $first_rec = true; foreach($rows as $row) { if ($first_rec) { // first record echo '<div>First text headline - ', $row['c_vesti_naslov'], '</div>'; $first_rec = false; } else { // other records echo '<div>Other text headline -', $row['c_vesti_naslov'], '</div>'; } } } ?>
  2. I'm working on a website involving local restaurants, and one thing I need to do is store hours of operation. This is how I get operating hours from business owners. // Sunday - Saturday 11AM - 6PM $_POST['from'], $_POST['to'], $_POST['opening_time'], $_POST['closing_time'] Then I need to store these operating hours in `MySql` like below format. - Sunday: 9am - 11pm - Monday: 9am - 11pm - Tuesday: 9am - 11pm - Wednesday: 9am - 11pm - Thursday: 9am - 11pm - Friday: 9am - 11pm - Saturday: 9am - 11pm This is how my mysql table looks like. CREATE TABLE business_hours ( id integer NOT NULL PRIMARY KEY, restaurant_id integer NOT NULL, day integer NOT NULL, open_time time, close_time time ) I am not sure How to do this in php. so can anybody pointed my to right direction here? Any idea would be greatly appreciated. Thank you.
  3. Im having a problem with login system. its telling me my username and password are wrong when i know they are not. here is my login.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta charset="UTF-8"> <title>Server 2 Server | Log in</title> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> <!-- Bootstrap 3.3.4 --> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <!-- Font Awesome Icons --> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> <!-- Theme style --> <link href="dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" /> <!-- iCheck --> <link href="plugins/iCheck/square/blue.css" rel="stylesheet" type="text/css" /> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body class="login-page"> <div class="login-box"> <div class="login-logo"> <a href="../../index2.html"><b>Server</b>2SERVER</a> </div><!-- /.login-logo --> <div class="login-box-body"> <p class="login-box-msg">Sign in to view the control panel</p> <?php if(!empty($_GET['msg'])) { $msg = $_GET['msg']; //GET the message if($msg!=''): echo '<p>'.$msg.'</p>'; endif; } ?> <form action="check_login.php" method="post"> <div class="form-group has-feedback"> <input type="text" class="form-control" placeholder="Email" name="username" id="username"/> <span class="glyphicon glyphicon-envelope form-control-feedback"></span> </div> <div class="form-group has-feedback"> <input type="password" class="form-control" placeholder="Password" name="password" id="password"/> <span class="glyphicon glyphicon-lock form-control-feedback"></span> </div> <div class="row"> <div class="col-xs-8"> </div><!-- /.col --> <div class="col-xs-4"> <button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button> </div><!-- /.col --> </div> </form> <a href="#">I forgot my password</a><br> </div><!-- /.login-box-body --> </div><!-- /.login-box --> <!-- jQuery 2.1.4 --> <script src="../../plugins/jQuery/jQuery-2.1.4.min.js"></script> <!-- Bootstrap 3.3.2 JS --> <script src="../../bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <!-- iCheck --> <script src="../../plugins/iCheck/icheck.min.js" type="text/javascript"></script> <script> $(function () { $('input').iCheck({ checkboxClass: 'icheckbox_square-blue', radioClass: 'iradio_square-blue', increaseArea: '20%' // optional }); }); </script> </body> </html> check_login.php <?php define(DOC_ROOT,dirname(__FILE__)); // To properly get the config.php file $username = $_POST['username']; //Set UserName $password = $_POST['password']; //Set Password $msg =''; if(isset($username, $password)) { ob_start(); include(DOC_ROOT.'/config.php'); //Initiate the MySQL connection // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($username); $mypassword = stripslashes($password); $myusername = mysqli_real_escape_string($dbC, $myusername); $mypassword = mysqli_real_escape_string($dbC, $mypassword); $sql="SELECT * FROM login_admin WHERE user_name='$myusername' and user_pass=SHA('$mypassword')"; $result=mysqli_query($dbC, $sql); // Mysql_num_row is counting table row $count=mysqli_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "dashboard.php" session_register("admin"); session_register("password"); $_SESSION['name']= $myusername; header("location:dashboard.php"); } else { $msg = "Wrong Username or Password. Please retry"; header("location:login.php?msg=$msg"); } ob_end_flush(); } else { header("location:login.php?msg=Please enter a username and password"); } ?> it just keeys telling my my password and user and incorrect please help
  4. Hi, I am building a website using PHP. By default the SESSION is kept active for 24(1440 seconds) minutes of inactivity. What i want is to refresh the SESSION as soon as the user interacts with the website (movement of the mouse, click on links inside the website, etc.) The way i am trying to refresh the session is by calling PHP script named refreshSession.php with AJAX as follow: $.ajax({ cache: false, type: "GET", url: "refreshSession.php" }); and the PHP script goes as follow: refreshSession.php <?php session_start(); echo 'test'; ?> But the session does not refresh. The only way to refresh the session is to reload the page. What am i doing wrong? Any suggestions? Regards, Christos
  5. Is there away to get something unique on a client computer? I read about ActiveX but it is only works on IE. I need something that can work on other browsers also, maybe on PHP or on Javascript.
  6. I have a website which shows lots of products by PHP/mysql database. Currently only cash payments are available. I want to add PayPal in, which I've never done before. Having looked at the integration guides, I found the PayPal payments standard bit but with this you need PayPal's buttons. If you have the add to cart buttons, apparently you need to write out each product into PayPal which shouldn't happen as the products are generated by a while loop so I should only paste the code once, but it looks like this needs to be posted individually for each product. Ideally I'd have the PayPal code only happen if the user chooses PayPal at the cart, and then send them to PayPal. The cart products, prices, options and option prices are all in session arrays. Is this possible? Is there a better way?
  7. I am trying to send a basic email that is multipart via the mail() function in php. I am not interested in using PHPmail. This should be very light weight. Currently when I send email to gmail, it is sending the html part as plain text so all the tags are showing. Here is my code: //GET VAR INPUT $to = htmlentities($_GET['to']); $friendly_from = htmlentities($_GET['friendly_from']); $email_from = htmlentities($_GET['email_from']); $subject = htmlentities($_GET['subject']); $text = htmlentities($_GET['text']); $html = htmlentities($_GET['html']); //SEND EMAIL # Setup mime boundary $mime_boundary = 'Multipart_Boundary_x' . md5(time()) . 'x'; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\r\n"; $headers .= "Content-Transfer-Encoding: 7bit\r\n"; $headers .= "Reply-To: " . $email_from . " \r\n"; # Add in plain text version $body.= "--$mime_boundary\n"; $body.= "Content-Type: text/plain; charset=\"charset=us-ascii\"\n"; $body.= "Content-Transfer-Encoding: 7bit\n\n"; $body.= $text; $body.= "\n\n"; # Add in HTML version $body.= "--$mime_boundary\n"; $body.= "Content-Type: text/html; charset=\"UTF-8\"\n"; $body.= "Content-Transfer-Encoding: 7bit\n\n"; $body.= $html; $body.= "\n\n"; # End email $body.= "--$mime_boundary--\n"; # <-- Notice trailing --, required to close email body for mime's # Finish off headers $headers .= "From: " . $friendly_from . " <" . $email_from . ">\r\n"; $headers .= "X-Sender-IP: " . $_SERVER[SERVER_ADDR] . "\r\n"; $headers .= 'Date: ' . date('n/d/Y g:i A') . "\r\n"; # Mail it out return mail($to, $subject, $body, $headers); Here is what I am receiving. (And yes I can accept html emails).
  8. Hi, I'm trying to merge the JSON results of playlists returned from soundcloud.com although I'm having some trouble getting this to display correctly. The results are being displaying nested, where am I going wrong and how can I get this to merge so there is just one array with three sets of data. Check the image of how it is displayed at the moment Any help would be amazing, thanks you in advance <?php $playlists = array( 'https://api.soundcloud.com/playlists/121967270/?&client_id=###', 'https://api.soundcloud.com/playlists/121906753/?&client_id=###', 'https://api.soundcloud.com/playlists/121906816/?&client_id=###' ); $json = array(); foreach ($playlists as $playlist) { $data = json_decode(file_get_contents($playlist)); $json = array_merge(array($json, $data)); } $json = json_encode($json); header('Content-Type: application/json'); echo $json; ?>
  9. I'm having an issue sorting an array. I'm getting an error of "Warning: ksort() expects parameter 1 to be array, null given in" The print_r output of the array is Array ( [0] => Array ( [text] => 96.1 km [value] => 96113 ) [1] => Array ( [text] => 52.1 km [value] => 52096 ) [2] => Array ( [text] => 102 km [value] => 102064 ) [3] => Array ( [text] => 30.0 km [value] => 29992 ) [4] => Array ( [text] => 43.9 km [value] => 43864 ) [5] => Array ( [text] => 57.4 km [value] => 57408 ) [6] => Array ( [text] => 82.2 km [value] => 82154 ) [7] => Array ( [text] => 73.6 km [value] => 73620 ) [8] => Array ( [text] => 118 km [value] => 118016 ) [9] => Array ( [text] => 137 km [value] => 136921 ) [10] => Array ( [text] => 61.6 km [value] => 61574 ) [11] => Array ( [text] => 74.2 km [value] => 74193 ) [12] => Array ( [text] => 226 km [value] => 226166 ) [13] => Array ( [text] => 140 km [value] => 140145 ) [14] => Array ( [text] => 126 km [value] => 126140 ) [15] => Array ( [text] => 45.5 km [value] => 45520 ) [16] => Array ( [text] => 211 km [value] => 211070 ) [17] => Array ( [text] => 54.1 km [value] => 54145 ) [18] => Array ( [text] => 187 km [value] => 186855 ) [19] => Array ( [text] => 271 km [value] => 271334 ) [20] => Array ( [text] => 219 km [value] => 218848 ) [21] => Array ( [text] => 67.0 km [value] => 67016 ) [22] => Array ( [text] => 13.6 km [value] => 13591 ) [23] => Array ( [text] => 153 km [value] => 153396 ) [24] => Array ( [text] => 11.5 km [value] => 11492 ) ). All I want to do is be able to sort the array by the lowest number in either text or value and display that single number. <?php include 'config/db_functions.php'; //run the query $loop = mysql_query("SELECT * FROM NEW_Venues WHERE game_nights = '5' AND status = '1'") or die (mysql_error()); while ($row = mysql_fetch_array($loop)) { $postcode2 = $row['zip']; $venue = $row['venue']; $postcode1=('33071');; $url = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=$postcode2&destinations=$postcode1&mode=driving&language=en-EN&sensor=false"; $data = @file_get_contents($url); $result = json_decode($data, true); ksort($items); foreach($result['rows'] as $distance) {; echo '' . $venue . ' - ' . $distance['elements'][0]['distance']['text'] . ' <br>'; $items[] = $distance['elements'][0]['distance']; $items1[] = $distance['elements'][0]['distance']; $itemsname[] = $venue; } } ksort($items1); foreach ($items1 as $key => $val) { echo "$key = $val <br>"; } print_r(array_values($items)); ?>
  10. I am trying to display some images dynamically from a mysql table. This is what I tried it with PHP and its working for me. // Fetch all the records: while ($stmt->fetch()) { $html = " <div class='row-fluid custom'>\n"; $html .= " <div class='span6'>\n"; $html .= " <img src='images/{$image}'>\n"; $html .= " </div>\n"; $html .= " </div>\n"; //Add images to array $images[] = $html; } And this is the markup from about PHP: <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-1.png'> </div> </div> <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-2.png'> </div> </div> <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-3.png'> </div> </div> <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-4.png'> </div> </div> But my problem is, now I need to modify above Markup to like this. <div class="row-fluid custom"> <div class="span6"> <img src="images/cond-1.png"> </div> <div class="span6"> <img src="images/cond-2.png"> </div> </div> <div class="row-fluid custom"> <div class="span6"> <img src="images/cond-3.png"> </div> <div class="span6"> <img src="images/cond-4.png"> </div> </div> Can anybody tell me how I create like that markup using php? Hope somebody may help me out. Thank you.
  11. I am trying to populate HTML table with the data comes from my database. Here I have stored "services" in my table. each service may have multiple images. So when populating the table it should have 3 table cells one for "service name" and second for "discription" and third one for images. This is my sql query looks like: $prep_stmt = " SELECT s.id , s.name , s.description , i.image , i.image_path FROM services s LEFT JOIN images i ON i.service_id = s.id"; This is how my while look like this: while ($stmt->fetch()) { $html = "<tr>\n"; $html .= " <td><input type='checkbox'></td>\n"; $html .= " <td>\n"; $html .= " <a href='' class='name'>{$name}</a>\n"; $html .= " </td>\n"; $html .= " <td class='view_html'>{$description}</td>\n"; $html .= " <td>\n"; --- My images should be display here ---- $html .= " </td>\n"; $html .= "</tr>\n"; //Add output to array $output[] = $html; } My problem is How I display multiple images in one table cell? If one service have only one image then I can do it, but it has multiple images then I am not sure how to do it. Hope somebody may help me out. Thank you.
  12. Hi, I need to dump php / html output of a single page to "Swifmailer" I was prevouisly using the $MesBody = <<<ENDFF1 ..... php generated text ENDFF1; Any other recomodations.
  13. I am having trouble with having my page remember a POST item. What I'm trying to do is to have the data updated message to include a link using a userid, a random number that's used to find things in the database. I've tried several ways but still having trouble. Below are 2 such ways (along with others). I keep getting a page where the userid doesn't show up. It doesn't make sense though because it gets inserted into the database. Could someone take a look? Instead of coming up with a link like this: http://www.mynewpage.com/visitdetails.php?userid=113555588701606e973.42256784 It looks like this and I get a page doesn't exist error. http://www.mynewpage.com/visitDetails.php?userid= connection info here..... $today = date("F j, Y, g:i a"); $careComments = htmlspecialchars("$_POST[careComments]", ENT_QUOTES); $feedComments = htmlspecialchars("$_POST[feedComments]", ENT_QUOTES); $waterComments = htmlspecialchars("$_POST[waterComments]", ENT_QUOTES); $ventilationComments = htmlspecialchars("$_POST[ventilationComments]", ENT_QUOTES); $recordsComments = htmlspecialchars("$_POST[recordsComments]", ENT_QUOTES); $invNotes = htmlspecialchars("$_POST[invNotes]", ENT_QUOTES); $facilityComments = htmlspecialchars("$_POST[facilityComments]", ENT_QUOTES); $summaryComments = htmlspecialchars("$_POST[summaryComments]", ENT_QUOTES); $deads = "$_POST[deads]"; $start = "$_POST[start]"; $mortality = $deads/$start*100; $userid = "$_POST[userid]"; $sql="INSERT INTO visitNotes (id,today,userid,date,site,name,groupID,caretaker,reason,careComments,cough,looseness,sorting,treating,walking,med1,med2,euthanasia,biosecurity,feed,feedComments,adjustments,tickets,water,waterComments,cleanwater,meter,temps,ventilationComments,humidity,fans,curtains,inlets,hilo,alarm,backup,pitLevel,recordsComments,medRecords,rodent,testAlarm,lp,lpLevels,genFuel,genFuelLevel,genHoursRecord,genHours,invRecords,invNotes,currentInv,start,deads,mortality,cleanOffice,facilityComments,mow,gates,chute,lights,deadDisp,summaryComments) VALUES ('$_POST[id]','$today','$_POST[userid]','$_POST[date]','$_POST[site]','$_POST[name]','$_POST[groupID]','$_POST[caretaker]','$_POST[reason]','$careComments','$_POST[cough]','$_POST[looseness]','$_POST[sorting]','$_POST[treating]','$_POST[walking]','$_POST[med1]','$_POST[med2]','$_POST[euthanasia]','$_POST[biosecurity]','$_POST[feed]','$feedComments','$_POST[adjustments]','$_POST[tickets]','$_POST[water]','$waterComments','$_POST[cleanwater]','$_POST[meter]','$_POST[temps]','$ventilationComments','$_POST[humidity]','$_POST[fans]','$_POST[curtains]','$_POST[inlets]','$_POST[hilo]','$_POST[alarm]','$_POST[backup]','$_POST[pitLevel]','$recordsComments','$_POST[medRecords]','$_POST[rodent]','$_POST[testAlarm]','$_POST[lp]','$_POST[lpLevels]','$_POST[genFuel]','$_POST[genFuelLevel]','$_POST[genHoursRecord]','$_POST[genHours]','$_POST[invRecords]','$invNotes','$_POST[currentInv]','$_POST[start]','$_POST[deads]','$mortality','$_POST[cleanOffice]','$facilityComments','$_POST[mow]','$_POST[gates]','$_POST[chute]','$_POST[lights]','$_POST[deadDisp]','$summaryComments')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added <br>"; echo "<a href='visitDetails.php?userid='$_POST[userid]'>Email Visit Results</a>"; echo "<br><br><a href='visitDetails.php?userid='" . $userid . "'>Visit Results</a>"; mysqli_close($con); ?>
  14. I have used hierarchical data modal to store animals in database. Animal have only main and subcategory, and this is the result when I retrieving the Full Tree of Animals. SELECT t1.name AS lev1, t2.name as lev2, t3.name as lev3 FROM categories AS t1 LEFT JOIN categories AS t2 ON t2.parent = t1.category_id LEFT JOIN categories AS t3 ON t3.parent = t2.category_id WHERE t1.name = 'Pets'; +------+------+-------------------+ | lev1 | lev2 | lev3 | +------+------+-------------------+ | Pets | Dogs | Bulldog | | Pets | Dogs | Bullmastiff | | Pets | Dogs | Chow Chow | | Pets | Dogs | Cocker Spaniel | | Pets | Dogs | German Shepherd | | Pets | Dogs | Gordon Setter | | Pets | Cats | American Bobtail | | Pets | Cats | Balinese | | Pets | Cats | Birman | | Pets | Cats | British Shorthair | | Pets | Cats | Burmese | +------+------+-------------------+ 11 rows in set (0.04 sec) My question is, I'm having trouble displaying this information as an unordered list. My expecting result would be something like this: <ul class="list-unstyled categorychecklist "> <li><input type="checkbox" value=""> Dogs <ul class="children"> <li><input type="checkbox" value=""> Bulldog</li> <li><input type="checkbox" value=""> Bullmastiff</li> <li><input type="checkbox" value=""> Chow Chow</li> <li><input type="checkbox" value=""> Cocker Spaniel</li> <li><input type="checkbox" value=""> German Shepherd</li> <li><input type="checkbox" value=""> Gordon Setter</li> </ul> </li> <li><input type="checkbox" value=""> Cats <ul class="children"> <li><input type="checkbox" value=""> American Bobtail</li> <li><input type="checkbox" value=""> Balinese</li> <li><input type="checkbox" value=""> Birman</li> <li><input type="checkbox" value=""> British Shorthair</li> <li><input type="checkbox" value=""> Burmese</li> </ul> </li> <li><input type="checkbox" value=""> Birds</li> </ul> Hope somebody may help me out. Thanks in advance.
  15. Hi Guys, Can someone please help me. I have following PHP code that works fine. I get Stripe token, I get all good results, and see that Stripe transaction appears in my test account. This scenario should work if: Shelly buys widget from Paul and pays Paul directly. I made this code to to make sure I get good results from simplest type of transaction, and I do, it works fine. \Stripe\Stripe::setApiKey(STRIPE_PRIVATE_KEY); $charge = \Stripe\Charge::create(array( "amount" => $amount, // amount in cents "currency" => "usd", "source" => $token, "description" => $email ) ); But when I try to add these two parameters, so that: Shelly uses Jill's site to buy widget, Jill gets 1.50 as a fee, Paul gets 18.50 for widget. I'm Jill, and this is my code to try and send Paul his money and get my 1.50. I don't want managed account scenario, I want direct connect so that Paul deals with refunds, etc. Private key below is Jill's (my) private key and the destination below is Paul's Stripe ID \Stripe\Stripe::setApiKey(STRIPE_PRIVATE_KEY); \Stripe\Charge::create(array( 'amount' => $amount, 'currency' => 'usd', 'source' => $token, 'application_fee' => $jillfee, 'destination' => 'rp_16ElxDFGdfgFGd7jL7Vj4QU' )); I do have a try/catch in place and when I use this catch area, I get result 5 } catch (\Stripe\Error\Card $e) { // Card was declined. $e_json = $e->getJsonBody(); $err = $e_json['error']; $errors['stripe'] = $err['message']; echo '1 card declined'; } catch (\Stripe\Error\ApiConnection $e) { echo '2 Network problem, perhaps try again.'; } catch (\Stripe\Error\InvalidRequest $e) { echo '3 You screwed up in your programming.'; } catch (\Stripe\Error\Api $e) { echo '4 Stripe servers are down!'; } catch (\Stripe\Error\Base $e) { echo '5 Something else that is not customer fault.'; } any help very much appreciated!
  16. <p>Current Images Inside Gallery <br /> <?php foreach($rows as $row): ?> <div class="t"> <table class="table2"> <tr> <td class="table2"><?php echo $row["id"]; ?></td> </tr> <tr> <td><img src="images/<?php echo $row["photo"] ; ?>" alt="" width="130" height="130" /></td> </tr> <tr> <td><textarea class="js-copyfilename" readonly="readonly" ><?php echo $row["photo"];?></textarea> <button class="js-copyfilenamebtn">Copy Filname</button> </td> </tr> </table> </div> <?php endforeach;?> </div> <script type="text/javascript"> var copyfilenameBtn = document.querySelector('.js-copyfilenamebtn'); copyfilenameBtn.addEventListener('click', function(event) { var copyfilename = document.querySelector('.js-copyfilename'); copyfilename.select(); try { var successful = document.execCommand('copy'); var msg = successful ? 'successful' : 'unsuccessful'; console.log('Copying text command was ' + msg); } catch (err) { console.log('Oops, unable to copy'); } }); </script> I am trying to create a button so the user can copy `$filename` then paste it into a field (this part I will code after this is sorted) I have this code which works but it only works for the first row I understand that I will need array the that this is because I would probably need to array the js-copyfilename and js-copyfilenamebtn classes so each one is different but i know very little about JavaScript so would know where to start Thanks in advance
  17. I am using AJAX to send an array of values to a PHP page that will insert the data into MySQL database. For some reason only the last 5 values are inserted into the MySQL database and I am woundering how to fix that. I am using foreach loop. AJAX Request: Array: [".testimonial", 1119, 316, 1663, 608, "#header", 723, 66, 1663, 608] Posting the array: Sending Array Parameters using " ; " to split. clicks .testimonial;1119;316;1663;608;#header;723;66;1663;608 Source Sent: clicks=.testimonial%3B1119%3B316%3B1663%3B608%3B%23header%3B723%3B66%3B1663%3B608 PHP Page <?php $clicks = $_GET["clicks"]; $clickArray = explode(";",$clicks); $arrays = array_chunk($clickArray, 5); $servername = "localhost"; $username = "root"; $password = "password"; $dbname = "clickmap"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $keys = array('postIdentifier', 'postPos_x', 'postPos_y','postWindowWidth','postWindowHeight'); foreach ($arrays as $array_num => $array) { $values = array(); foreach ($array as $item_num => $item) { $values[] = $item; } $data = array_combine($keys, $values); extract($data); // now your variables are declared with the right values http://php.net/manual/en/function.extract.php $sql = "INSERT INTO data (user_id, identifier_name, pos_x, pos_y, window_width, window_height, status) VALUES ('1', '$postIdentifier', '$postPos_x', '$postPos_y','$postWindowWidth','$postWindowHeight', 'ok')"; } if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } $conn->close(); ?> Is this the correct way of coding it, and why does it post only the last 5 values? Any help would be much appreciated!
  18. I am trying to echo out product names onto php mail. I have it in the $message variable, code is below (have cut out a lot of other stuff in there, HTML code is all working fine) $message = ' 'for($z=0;$z<$h;$z++) { echo "<tr>"; echo '<td colspan="18">'.$_SESSION['transferproducts'.$z.''].'</td>'; echo '<td colspan="2">'.$_SESSION['transferprices'.$z.''].'</td>'; echo "</tr>"; }' '; I'm getting an error on the line where the "for" starts. How can I get it to work correctly?
  19. Hi look for some help with querying based on todays date. I'm trying to count all the entries in the database based on username, status, date. The date bit is where I' stuck (see screen shot of database) Based on data in database I should get a count of 3 but get nothing?? The result I get is 0 and should be 3 based on date Any help would be a great help Cheers Chris //date bit $d=strtotime("today"); $wholedate2 = date("Y-m-d", $d); //query $query_rsUser = "SELECT COUNT(*) FROM quotes WHERE quotes.quote_user = 'username' AND quotes.quote_complete = '$date2' AND quotes.quote_status = 'Complete'";
  20. I want to make a select query to search seeking person between min and max ages. This is how search values comes from my search form. Array ( [iam] => Man [seeking] => Woman [age_min] => 18 [age_max] => 19 [country_id] => 25 ) I have stored these values in two mysql tables. One is `user` and other one is `Countries`. My problem is there is not a column in user table to store user's age. Age is calculating according to the users Date of Birth and user table have a column to store users DOB. My `users` table something like this: CREATE TABLE IF NOT EXISTS users ( user_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, country_id SMALLINT UNSIGNED NOT NULL, username VARCHAR(20) NOT NULL, email varchar(40) NOT NULL, first_name VARCHAR(30) DEFAULT NULL, sex ENUM('Male', 'Female') DEFAULT 'Male', dob VARCHAR(10) NOT NULL, address VARCHAR(40) DEFAULT NULL, city VARCHAR(25) NOT NULL, last_login TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', date_registered TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (user_id), UNIQUE (email), UNIQUE (username) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; In country table it has `country_id` and `country_name`. So. Can I know is there a way to do this using MySql `SELECT` query. Hope somebody may help me out. Thank you.
  21. Hi, I could do with a bit of help with this, not sure where I'm going wrong. The following code is used to change the colour of a row based on date. I want to compare to todays date with the following results If < today (turns red) if == today (turns orange) if > today (turns green) I have included a screen shot of result I'm getting with below if statement <?php $requireddate = date('l jS F',$row_rsActiveQuotes['quote_requireddate']); //this is anthing before today's date if ($today < $requireddate) { echo '<tr class="tableBody2">'; } //this is anthing with today's date elseif ($today == $requireddate) { echo '<tr class="tableBody3">'; } //this is anthing with today's date elseif ($today > $requireddate) { echo '<tr class="tableBody1">'; } else //this is anthing from tommorow { echo '<tr class="tableBody4">'; } ?>
  22. I've got this: mail($to,$subject,$message,"Content-type: text/html; charset=iso-8859-1"); It sends through HTML e-mail fine, but I can't get it to show both who its from, and get the HTML bits in ("Content-type: text/html; charset=iso-8859-1"). Can anyone help please?
  23. I succeed to create the vertical data, but I just add checkbox in data table in PHP. I know how to set up the value in checkbox, but i can't figure how to put name and value that from database. for example, when you can see name list in columns, you click checkbox that which has name that selected data from database. here example in code: I can get value from outside of php in html: <input type="checkbox" name="???" value="<?php echo $data['Name'] ?>"> But I can't figure to set up the value that inside php: echo "<tr><td><input type="checkbox" name="???" value=?></td></tr>"; my point is I can use echo to print, but echo is used already, php cannot take two name code in same time, same line number. Can you help? If you want to see my full code in php, Let me know...I will put my code in next comment in this thread. Thank you so much! Gary Taylor
  24. Unfortunately my ideas out pace my skills. I have a database that I would like certain people to access their own info, but nobody else's. It's not super sensitive info and won't mean much to anyone other than the end user but we don't like the idea of others accessing it so we'd like to put some protection on it. What I was hoping for is a dropdown list (there's about 30 or so clients that would be in a mysql table) where they can pick out their name, then text box for the password. When they hit submit button it would lead them to their own page with a table and their own info from a mysql table. I can get each one of these details to work separately, but I'm having trouble putting them all together (the password is where things get muddled). Can anyone point me to a place where they've already figured this out? Thanks!
  25. hi The value of the input tag need to be added to a href tag. Is it possible to get the value of qty1 without using jquery or posting of a form. Need to create <a Href tag.. echo "<td> <input type=\"text\" name=\"qty1\" id=\"qty1\" autocomplete=\"off\"></td>" . "<td><a href=\"index123.php?qty1='+document.getElementById('qty1').value'&prodid=" . $product1->id . "\">add product</a>"
×
×
  • 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.