[Solved] Is this prepared statement?

[ad_1] Yes you are using a prepared statement with a parameter. That’s the right thing to do. Parameters are the best way to write safe SQL statements in the majority of cases. There are just a few edge cases where they don’t help (see my answer to how safe are PDO prepared statements) I can … Read more

[Solved] How to extract value from xml to php [closed]

[ad_1] Using SimpleXMLElement() you can get your product data from xml string; ref // Your xml string $xmlString = ‘<?xml version=”1.0″?> <ABCD xmlns=”http://abcd.com”> <PRODUCT xmlns=””> <CNHEADER> <CNTRACK>true</CNTRACK> <FIELD name=”PRODUCTNO” value=”Z41346020″/> <FIELD name=”ProductType” value=”DP”/> <FIELD name=”strProdCode” value=”NL1754″/> </CNHEADER> </PRODUCT> </ABCD>’; $xmlData = new SimpleXMLElement($xmlString); $productData = []; foreach ($xmlData->PRODUCT->CNHEADER->FIELD as $productField) { $productData[(string)$productField{‘name’}] = (string)$productField{‘value’}; } … Read more

[Solved] Random value json in php [duplicate]

[ad_1] try this $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, ‘http://havanzee.tk/api/quote.json’); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); $strc = json_decode(curl_exec($curl),true); curl_close($curl); $i = rand(0,count($strc[‘danh-ngon’])-1); echo $strc[‘danh-ngon’][$i][‘content’]; 4 [ad_2] solved Random value json in php [duplicate]

[Solved] Json string conversion to json object

[ad_1] You are trying to decode an array, either specify the specific item within the array, or make it a string. For instance: $unBillableArr=”{“id”:”123″, “to”:”+923412268656″, “MsgReceivedFrom”:”03349433314″, “message”:”Qwertyy”, “recdate”:”2017-11-20 19:01:49″}”; $json = json_decode($unBillableArr, true); // Or $unBillableArr = [‘{“id”:”123″, “to”:”+923412268656″, “MsgReceivedFrom”:”03349433314″, “message”:”Qwertyy”, “recdate”:”2017-11-20 19:01:49″}’]; $json = json_decode($unBillableArr[0], true); However, given the string you are receiving does … Read more

[Solved] How to use proper variable in php? [closed]

[ad_1] You should better a try var_dump($row) or print_r($row) first to see if the array contains the datas at right keys. $lang[$row[0]] doesnt work because $row[0] is empty. Your are probably not assigning Hello to $row[0]. So try print_r($row); to see whats stored in the whole array. Add : $lang[$row[0]] will give you $lang[hello]. It … Read more

[Solved] Insert form into database [closed]

[ad_1] You need inputs on your form: <form action=”insert.php” method=”post”> Username: <input type=”text” name=”username”> Password: <input type=”password” name=”password”> Confirm Password: <input type=”password” name=”confirm”> <input type=”submit” name=”submit”> </form> Then on insert.php if (isset($_POST[‘submit’])){ $Error = 0; if (!isset($_POST[‘username’])){ $Error++; } if (!isset($_POST[‘password’])){ $Error++; } if (!isset($_POST[‘confirm’])){ $Error++; } if ($Error > 0){ echo “Error in HTML … Read more

[Solved] PHP parameter variable vs reference [duplicate]

[ad_1] A parameter passage by value – value of a variable is passed. $b = 1; function a($c) { $c = 2; // modifying this doesn’t change the value of $b, since only the value was passed to $c. } a($b); echo $b; // still outputs 1 A parameter pass by reference? – a pointer … Read more

[Solved] how to Multiply 2 columns from different tables but same database mysqli php [closed]

[ad_1] $con = mysqli_connect(“localhost”, “root”, “”, “zoo”); if (mysqli_connect_error()) { echo “Failed to connect” . mysqli_connect_error(); } $sel = “select (quantity* bill) as total from animal inner join price on animal.id=price.animal_id group by price.animal_id”; $result = mysqli_query($con, $sel); while ($row = mysqli_fetch_array($result)) { echo “<tr>”; echo”<td>” . $row[‘total’] . “</td>”; } Before copy and paste … Read more

[Solved] A script to count the total number of products

[ad_1] Seems like what you need is NOT javascript at all. If you are talking about OpenCart (as your title suggests), you need access to the total number of the products in your database (not in the page itself or DOM elements). The ‘professional approach’ will be to extend your model and controller files with … Read more