Jump to content

zazu

Members
  • Content Count

    49
  • Joined

  • Last visited

Community Reputation

0 Neutral

About zazu

  • Rank
    Member
  1. <?php session_start(); $db_username = 'rpre0623_mb95'; $db_password = '0a%Iu(tG6,!@'; $db_name = 'rpre0623_mb95'; $db_host = 'localhost'; $mysqli = new mysqli($db_host, $db_username, $db_password, $db_name); function toate_produsele_active($mysqli) { $push = array(); $result = mysqli_query($mysqli, "SELECT product_id, product_name, category_url, product_short_desc, product_price, product_photo FROM mb95_products") or trigger_error(mysqli_error()); var_dump($result); while($row = mysqli_fetch_array($result, MYSQLI_NUM)) { $push[] = $row; } return $push; } $f = fopen('php://output', 'wb'); if($f) { foreach(toate_produsele_active() as $produs) { $coloane = array( $produs['product_id'], $produs['product_name'], $produs['category_url'], $produs['product_short_desc'], $produs['product_price'], implode('[,]', str_replace('[,]', '[%2C]', $produs['product_photo'])), ); fputcsv($f, $coloane, ';', '"'); } fclose($f); } ?> Yes. This is my entire code.
  2. Ok i've used var_dumb and the select is returning NULL but i cant understand why is that cuz the select query seems to be ok.
  3. function toate_produsele_active() { $push = array(); $result = mysqli_query($mysqli, "SELECT product_id, product_name, category_url, product_short_desc, product_price, product_photo FROM mb95_products"); while($row = mysqli_fetch_array($result, MYSQLI_NUM)) { $row = array_map('stripslashes', $row); $push[] = $row; } return $push; } $f = fopen('php://output', 'wb'); if($f) { foreach(toate_produsele_active() as $produs) { $coloane = array( $produs['product_id'], $produs['product_name'], $produs['category_url'], $produs['product_short_desc'], $produs['product_price'], implode('[,]', str_replace('[,]', '[%2C]', $produs['product_photo'])), ); fputcsv($f, $coloane, ';', '"'); } fclose($f); } This is what i've achived but the script doesn't return anything. what i'm doing wrong?
  4. <?php function toate_produsele_active() { $db_username = 'root'; $db_password = ''; $db_name = 'mb95-romania'; $db_host = 'localhost'; $mysqli = mysqli_connect($db_host, $db_username, $db_password,$db_name); $array_produse = mysqli_query($mysqli, "SELECT product_id, product_name, category_url, product_short_desc, product_price, product_photo FROM mb95_products"); return array($array_produse); } $f = fopen('php://output', 'wb'); if($f) { foreach(toate_produsele_active() as $produs) { $coloane = array( $produs['product_id'], $produs['product_name'], $produs['category_url'], $produs['product_short_desc'], $produs['product_price'], implode('[,]', str_replace('[,]', '[%2C]', $produs['product_photo'])), ); fputcsv($f, $coloane, ';', '"'); } fclose($f); } ?> Ok i've put config.php code into the function now i have the Fatal error: Cannot use object of type mysqli_result as array in D:\EasyPHP-DevServer-14.1VC9\data\localweb\projects\mb95-romania\export-products.php on line 19
  5. <?php require_once("config/db-connect.php"); function toate_produsele_active() { $array_produse = mysqli_query($mysqli, "SELECT product_id, product_name, category_url, product_short_desc, product_price, product_photo FROM mb95_products"); while ($row = mysqli_fetch_assoc($array_produse)) { print_r($row); } } $f = fopen('php://output', 'wb'); if($f) { foreach(toate_produsele_active() as $produs) { $coloane = array( $produs['product_id'], $produs['product_name'], $produs['category_url'], $produs['product_short_desc'], $produs['product_price'], implode('[,]', str_replace('[,]', '[%2C]', $produs['product_photo'])), ); fputcsv($f, $coloane, ';', '"'); } fclose($f); } ?> latest code, not working...the final result needs to be: 1;Product name;product price; etc etc
  6. is not working with all columns, i miss something else?
  7. Hey guys, I have to export all my products from database into a csv file when executin the following script but i can't manage to put together the function that returns all my products from database. <?php require_once("config/db-connect.php"); function toate_produsele_active() { $array_produse = mysqli_query($mysqli, "SELECT product_id FROM mb95_products"); return $array_produse; } $f = fopen('php://output', 'wb'); if($f) { foreach(toate_produsele_active() as $produs) { $coloane = array( $produs['product_id'], $produs['product_name'], $produs['category_url'], $produs['product_short_desc'], $produs['ron'], $produs['product_price'], $produs['cantitate'], implode('[,]', str_replace('[,]', '[%2C]', $produs['product_photo'])), ); fputcsv($f, $coloane, ';', '"'); } fclose($f); } ?>
  8. Hey guys i have 2 buttons that i hide and show depending on users click. What i want to do is when a user click first button to rememeber in a cookie that the button is clicked and show the secound button and viceversa. My js code that i;m using right now is posted bellow. How can i do this? Thank you very much! var first = document.getElementById( 'first' ), second = document.getElementById( 'second' ); function toggle() { if ( first.style.display === "block" ) { first.style.display = "none"; second.style.display = "block"; } else { // switch back first.style.display = "block"; second.style.display = "none"; } } first.onclick = toggle; second.onclick = toggle;
  9. <?php $result = mysqli_query($conn, "SELECT * FROM user_pers_juridica WHERE categorie='marci'"); echo "<form action='compara-marci.php' method='get'>"; echo "<div class='form-group'>"; echo "<select name='id' id='id' class='form-control'>"; echo "<option value='' disabled selected>Alegeti un judet...</option>"; while($row = mysqli_fetch_array($result)) { echo "<option value='" . $row['id_companie'] . "'>" . $row['nume_companie'] . "</option>"; } echo "</select>"; echo "</div>"; echo "<p><button type='submit' class='btn btn-primary'><i class='fa fa-search'></i> Caută</button></p>"; echo "</form>"; $result = mysqli_query($conn, "SELECT nume_companie FROM user_pers_juridica WHERE id_companie = '$id'"); while($row = mysqli_fetch_array($result)) { echo $row['nume_companie']; } ?> This is the code for the first select. Now after submit my url looks like this compara-marci.php?id=23. How can i add anouter select in this script and on submit button to show me the valus from the rows with the selected id and the url to be like compara-marci.php?id=2&id=3?
  10. I've done something similar but with only one select dropdown list. The code is below <form action="oras.php" method="get"> <div class="form-group"> <?php $result = mysqli_query($conn, "SELECT * FROM orase_disponibile ORDER BY titlu_oras ASC"); echo "<select name='id' id='id' class='form-control' required>"; echo "<option value='' disabled selected>Alegeti un oras...</option>"; while($row = mysqli_fetch_array($result)) { echo "<option value='" . $row['id_oras'] . "'>" . $row['titlu_oras'] . "</option>"; } echo "</select>"; ?> </div> <p><button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> Caută dupa oras</button></p> </form>
  11. Hello guys, I have a page named compare.php with two dropdown lists wich are populated with same values from a specific table. Now what i want to do is when a user is selecting one value from the first dropdown and another value from the secound dropdown to be redirected to a page lets say compare-items.php?id=1&id=2 and here in two different cols to get the values for the items, in the first col the values for the first item, and in the secound col the values from the sec item. How can i achive that? Thank you very much!
  12. Hi, I have the following code for playing a video on my page. The problem is that the video works good on desktop browsers, but on desktop safari and mobile browsers it displays me only the cover image not playing the video. I've tried a couple of solutions but none of them seems to be working for me. <video autoplay class="embed-responsive-item" poster="videos/cover.jpg"> <source src="videos/landing_page_video_vimeo5_converted.mp4" type="video/mp4"> <source src="videos/landing page video vimeo5.ogg" type="video/ogg"> <source src="videos/landing page video vimeo5.ogg" type="video/webm"> </video>
  13. Hi guys, I have a video into a bootstrap modal form that is opened on click. Now when i close the modal i want that video to stop playing. I've manage to do some javascript to do that but instead of stopping the the video i want it stops all the video from that page. How can i target in the script below only the ID of the modal that i want to be stoped from playing? <script> $('body').on('hidden.bs.modal', '.modal', function () { $('video').trigger('pause'); }); </script>
  14. I have 3 price tables on my page. These tables under 720px width resolution should get one under the other one (i use bootstrap). The problem is that in any browsers they align well but on desktop safari, ios safari, ios firefox, ios chorome the tables not aligning well at all. You can take a look HERE on safari under 720px resolution to see how it looks. I don't manage to see what is causing the problem.
  15. <script> $(function () { var frm = $('#inscriete-modal'); frm.submit(function (ev) { $.ajax({ type: frm.attr('method'), url: frm.attr('action'), data: frm.serialize(), success: function (data) { $("#form-inscriere").show(data); setTimeout(function(){location.reload();},3000); } }); ev.preventDefault(); }); }); </script>
×
×
  • 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.