Categories
PHP

How to set where clause properly to get ride of fatal error in my syntex in mysql?

I was playing with mysql data selection with condition and following was working like: $DB_con->prepare(‘SELECT productId, productName, productDetails, productPic FROM product ORDER BY productId DESC’) but I wanted to use a WHERE clause with the above code like $DB_con->prepare(‘SELECT productId, productName, productDetails, productPic FROM product ORDER BY productId DESC where productType = xyz’) But That […]

Categories
PHP

php convert square bracket string into array

I have a string such as:- [“5″,”5″,”5″,”20″,”20″,”20″,”19″,”19″,”19″,”6″,”6″,”6″,”3″,”3″,”3″,”16″,”16″,”16”] What is the quickest / easiest way to convert into a PHP array so I can for example loop through the values and so on? I know it is probably really obvious but I am struggling to find the answer! C

Categories
PHP

Creating pagination with PHP and SQL Server, pagination works, but data doesn’t changed when changing page

I’m trying to add pagination function like i asked before, I was facing an error and already fixed it. The “LIMIT” function is working fine using TOP($limit), but the problem is when I clicked into next page the data wasn’t show as expected. I have about 38 data(s), and when I set the limit as […]

Categories
PHP

Using laravel localization in javascript

I am using typeahead in my laravel project. I have in file called main translations. Now I want to use __trans or @lang function in code. I mean that place where is __trans(data.name) because that is not working. In database I have: suggestion: function (data) { return ‘<li class=”list-group-item”>’ + __trans(data.name) + ‘</li>’ }

Categories
PHP

Replace text string with PHP session variable using PHP or Javascript

I have a string of text that is part of a URL on a PHP page that looks like this:. <a href=”http://ift.tt/2kcSMMS}}”>LINK</a> I need to replace the with a session variable I have created $SESSION[‘EmpNo’] Using another question I’ve tried to put this at the bottom of the page to run last but it is […]

Categories
PHP

the return is always 0

Someone can help me? The return is always 0. (Sorry my English is very bad) <?php public function userRegistration($username,$password,$email,$name,$social_id) { try{ require_once (‘../mailer/class.phpmailer.php’); $db = getDB(); $st = $db->prepare(“SELECT id FROM account WHERE login=:username”); $st->bindParam(“username”, $username,PDO::PARAM_STR); $st->execute(); $count=$st->rowCount(); if($count<1) { $stmt = $db->prepare(“INSERT INTO account(id,login,password,real_name,social_id,email,coins,web_ip,web_aktiviert,status,reason,availDt,create_time,safebox_expire,autoloot_expire,silver_expire,gold_expire,fish_mind_expire,marriage_fast_expire,money_drop_rate_expire,channel_company,last_play,web_admin,securitycode,aktivHash) VALUES (”,:username,:hash_password,:name,:social_id,:email,”,”,”,’OK’,NULL,”,”,”,”,”,”,”,”,”,”,”,”,NULL,NULL)”); $stmt->bindParam(“username”, $username,PDO::PARAM_STR) ; $hash_password= hash(‘md5’, $password); //Password encryption […]

Categories
PHP

Block.io API Webhook doesn’t send data

I’m trying to get updates from new blocks, balance changes etc. over the block.io Webhook api function. So, i registered the notification-function over the web api, and it returns “200 SUCCESS” and the function is there. Now if i take a look at my callback php file, which will be called with the specific post […]

Categories
PHP

PHP How to recover from Invalid handle returned from new pdo

My PHP page uses $db = new PDO (“$type:server=$host;database=$name”,$user,$pass); to connect to MS SQLSERVER. and it works like a charm. But sometimes windows auto installs updates and restarts the DB server. If PHP tries to connect at that moment it will get an error, and keeps returning another error every time I open a page. […]

Categories
PHP

SQL, how to get the automated ID from the previous INSERT?

I am using PHP and SQL and trying to insert user data into two tables upon registration. First in the user_table and second into the character_table. I’m using an automatically generating user_id to link the tables and need to get the value of the user_id from the first INSERT (into user_table) then add it to […]

Categories
PHP

Regarding Payeeze payment integration

well iam using payeezy as a payment gateway integration through a single page php script.below is my code 1)index.html <html> <body background=”skyblue”> <h1 style=”text-align:center”>User Payment Page</h1> <br><form action=”Samplegge4payment.php” method=”post”> <table align=”center” border=’1′> <!–<th>Enter Product Description</th>–><th>Enter Amount(USD)</th> <!–<TR><TD><input type=”text” name=”x_desc”/></TD>–> <TD><input name=”x_amount” value=”” type=”text”></TD></TR> <TR><TD colspan=3><center><input type=”submit” value=”Pay Now”></center> </TD></TR> </TABLE> </form> </body> </html> 2)Samplegge4payment.php <!DOCTYPE […]